nicer automatic reference variables for comptued property names and property method assignment #54

This commit is contained in:
Sebastian McKenzie
2014-10-14 08:50:34 +11:00
parent 1f61e7675b
commit 6af0ffd97e
7 changed files with 45 additions and 36 deletions

View File

@@ -1,16 +1,18 @@
var _slice = Array.prototype.slice;
var Test = function(Foo) {
var Test = function Test() {
woops.super.test();
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.call.apply(Foo, [this].concat(_slice.call(arguments)));
Foo.call.apply(Foo, [this, "test"].concat(_slice.call(arguments)));
Foo.prototype.test.call.apply(Foo.prototype, [this].concat(_slice.call(arguments)));
Foo.prototype.test.call.apply(
Foo.prototype,
[this, "test"].concat(Array.prototype.slice.call(arguments))
[this, "test"].concat(_slice.call(arguments))
);
};
@@ -31,11 +33,11 @@ var Test = function(Foo) {
value: 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].concat(_slice.call(arguments)));
Foo.prototype.test.call.apply(
Foo.prototype.test,
[this, "test"].concat(Array.prototype.slice.call(arguments))
[this, "test"].concat(_slice.call(arguments))
);
}
}
@@ -47,8 +49,8 @@ var Test = function(Foo) {
value: 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)));
Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments)));
Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments)));
}
}
});

View File

@@ -1,5 +1,5 @@
var obj = function (_ref) {
Object.defineProperties(_ref, {
var obj = function (_obj) {
Object.defineProperties(_obj, {
foo: {
get: function () {
return 5 + 5;
@@ -9,5 +9,5 @@ var obj = function (_ref) {
}
}
});
return _ref;
return _obj;
}({});

View File

@@ -1,10 +1,10 @@
var obj = function (_ref) {
Object.defineProperties(_ref, {
var obj = function (_obj) {
Object.defineProperties(_obj, {
foo: {
get: function () {
return 5 + 5;
}
}
});
return _ref;
return _obj;
}({});

View File

@@ -1,10 +1,10 @@
var obj = function (_ref) {
Object.defineProperties(_ref, {
var obj = function (_obj) {
Object.defineProperties(_obj, {
foo: {
set: function (value) {
this._foo = value;
}
}
});
return _ref;
return _obj;
}({});