2018-07-30 21:06:29 +03:00
|
|
|
global.Method = class Method {
|
|
|
|
constructor(value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
myCmp(other) {
|
|
|
|
return this.value === other.value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
global.Property = class Property {
|
|
|
|
constructor(value) {
|
|
|
|
this._value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
get value() {
|
|
|
|
return this._value;
|
|
|
|
}
|
|
|
|
|
|
|
|
set value(value) {
|
|
|
|
this._value = value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
global.NamedConstructor = class NamedConstructor {
|
|
|
|
constructor() {
|
|
|
|
this._value = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
get value(){
|
|
|
|
return this._value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
global.NamedConstructorBar = class NamedConstructorBar extends NamedConstructor {
|
|
|
|
constructor(_value) {
|
|
|
|
super();
|
|
|
|
this._value = _value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
global.StaticMethod = class StaticMethod {
|
|
|
|
static swap(value) {
|
|
|
|
const res = StaticMethod.value;
|
|
|
|
StaticMethod.value = value;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
StaticMethod.value = 0;
|
|
|
|
|
|
|
|
global.StaticProperty = class StaticProperty {
|
|
|
|
static get value(){
|
|
|
|
return StaticProperty._value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static set value(value) {
|
|
|
|
StaticProperty._value = value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
StaticProperty._value = 0;
|
|
|
|
|
|
|
|
global.UndefinedMethod = class UndefinedMethod {
|
|
|
|
constructor() {}
|
|
|
|
ok_method() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-08-13 23:18:16 +03:00
|
|
|
global.NullableMethod = class NullableMethod {
|
2018-08-03 16:28:35 +03:00
|
|
|
constructor() {}
|
|
|
|
opt(a) {
|
|
|
|
if (a == undefined) {
|
|
|
|
return undefined;
|
|
|
|
} else {
|
|
|
|
return a + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-07-30 21:06:29 +03:00
|
|
|
global.Unforgeable = class Unforgeable {
|
|
|
|
constructor() {
|
|
|
|
this.uno = 1;
|
|
|
|
}
|
|
|
|
get dos() {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-08-29 01:19:31 +03:00
|
|
|
global.m = () => 123;
|
2018-08-05 18:05:20 +03:00
|
|
|
|
2018-08-07 00:42:47 +03:00
|
|
|
global.Indexing = function () {
|
|
|
|
return new Proxy({}, {
|
|
|
|
get(obj, prop) {
|
|
|
|
return obj.hasOwnProperty(prop) ? obj[prop] : -1;
|
|
|
|
},
|
|
|
|
set(obj, prop, value) {
|
|
|
|
obj[prop] = value;
|
|
|
|
},
|
|
|
|
deleteProperty(obj, prop) {
|
|
|
|
delete obj[prop];
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2018-08-13 23:18:16 +03:00
|
|
|
global.OptionalAndUnionArguments = class OptionalAndUnionArguments {
|
|
|
|
constructor() {}
|
|
|
|
m(a, b = true, c = 123, d = 456) {
|
|
|
|
return [typeof a, a, typeof b, b, typeof c, c, typeof d, d].join(', ');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-07-30 21:06:29 +03:00
|
|
|
global.PartialInterface = class PartialInterface {
|
|
|
|
get un() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
deux() {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
get trois() {
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
quatre() {
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
global.MixinFoo = class MixinFoo {
|
|
|
|
constructor(bar) {
|
|
|
|
this._bar = bar | MixinFoo.defaultBar;
|
|
|
|
}
|
|
|
|
static get defaultBar() {
|
|
|
|
return MixinFoo._defaultBar;
|
|
|
|
}
|
|
|
|
static set defaultBar(defaultBar) {
|
|
|
|
MixinFoo._defaultBar = defaultBar;
|
|
|
|
}
|
|
|
|
get bar() {
|
|
|
|
return this._bar;
|
|
|
|
}
|
|
|
|
addToBar(other) {
|
|
|
|
this._bar += other;
|
|
|
|
}
|
|
|
|
};
|
2018-08-29 02:32:31 +03:00
|
|
|
|
|
|
|
global.Overloads = class {
|
|
|
|
foo() {}
|
|
|
|
};
|