fix spread and super resolution - fixes #42

This commit is contained in:
Sebastian McKenzie
2014-10-11 10:44:51 +11:00
parent 603ae290cd
commit 3fb17b00a6
8 changed files with 44 additions and 11 deletions

View File

@@ -4,13 +4,23 @@ class Test extends Foo {
super();
super.test();
foob(super);
super(...arguments);
super("test", ...arguments);
super.test(...arguments);
super.test("test", ...arguments);
}
test() {
super();
super(...arguments);
super("test", ...arguments);
}
static foo() {
super();
super(...arguments);
super("test", ...arguments);
}
}

View File

@@ -4,6 +4,13 @@ var Test = function (Foo) {
Foo.call(this);
Foo.prototype.test.call(this);
foob(Foo);
Foo.call.apply(Foo, [this].concat(Array.prototype.slice.call(arguments)));
Foo.call.apply(Foo, [this, "test"].concat(Array.prototype.slice.call(arguments)));
Foo.prototype.test.call.apply(Foo.prototype, [this].concat(Array.prototype.slice.call(arguments)));
Foo.prototype.test.call.apply(
Foo.prototype,
[this, "test"].concat(Array.prototype.slice.call(arguments))
);
}
Test.prototype = Object.create(Foo.prototype, {
constructor: {
@@ -16,9 +23,16 @@ var Test = function (Foo) {
Test.__proto__ = Foo;
Test.prototype.test = function () {
Foo.prototype.test.call(this);
Foo.prototype.test.call.apply(Foo.prototype.test, [this].concat(Array.prototype.slice.call(arguments)));
Foo.prototype.test.call.apply(
Foo.prototype.test,
[this, "test"].concat(Array.prototype.slice.call(arguments))
);
};
Test.foo = function () {
Foo.foo.call(this);
Foo.foo.call.apply(Foo.foo, [this].concat(Array.prototype.slice.call(arguments)));
Foo.foo.call.apply(Foo.foo, [this, "test"].concat(Array.prototype.slice.call(arguments)));
};
return Test;
}(Foo);

View File

@@ -1 +1,2 @@
foob.add(foo, bar, ...numbers);
foob.test.add(foo, bar, ...numbers);

View File

@@ -2,3 +2,7 @@ foob.add.apply(foob, [
foo,
bar
].concat(numbers));
foob.test.add.apply(foob.test, [
foo,
bar
].concat(numbers));

View File

@@ -1 +1,2 @@
foob.add(...numbers);
foob.test.add(...numbers);

View File

@@ -1 +1,2 @@
foob.add.apply(foob, numbers);
foob.test.add.apply(foob.test, numbers);