remove isDynamic checks and always execute those expressions **once**

This commit is contained in:
Sebastian McKenzie
2015-01-03 21:48:06 +11:00
parent 5a622ac9c7
commit d945379b5b
24 changed files with 238 additions and 164 deletions

View File

@@ -16,30 +16,33 @@ var _inherits = function (child, parent) {
var Test = (function () {
var _Foo = Foo;
var Test = function Test() {
var _Foo$prototype$test, _Foo$prototype$test2;
woops["super"].test();
_Foo.call(this);
_Foo.prototype.test.call(this);
foob(_Foo);
_Foo.call.apply(_Foo, [this].concat(_slice.call(arguments)));
_Foo.call.apply(_Foo, [this, "test"].concat(_slice.call(arguments)));
_Foo.call.apply(null, [this].concat(_slice.call(arguments)));
_Foo.call.apply(null, [this, "test"].concat(_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(_slice.call(arguments)));
(_Foo$prototype$test = _Foo.prototype.test).call.apply(_Foo$prototype$test, [this].concat(_slice.call(arguments)));
(_Foo$prototype$test2 = _Foo.prototype.test).call.apply(_Foo$prototype$test2, [this, "test"].concat(_slice.call(arguments)));
};
_inherits(Test, _Foo);
Test.prototype.test = function () {
var _Foo$prototype$test3, _Foo$prototype$test4;
_Foo.prototype.test.call(this);
_Foo.prototype.test.call.apply(_Foo.prototype.test, [this].concat(_slice.call(arguments)));
_Foo.prototype.test.call.apply(_Foo.prototype.test, [this, "test"].concat(_slice.call(arguments)));
(_Foo$prototype$test3 = _Foo.prototype.test).call.apply(_Foo$prototype$test3, [this].concat(_slice.call(arguments)));
(_Foo$prototype$test4 = _Foo.prototype.test).call.apply(_Foo$prototype$test4, [this, "test"].concat(_slice.call(arguments)));
};
Test.foo = function () {
var _Foo$foo, _Foo$foo2;
_Foo.foo.call(this);
_Foo.foo.call.apply(_Foo.foo, [this].concat(_slice.call(arguments)));
_Foo.foo.call.apply(_Foo.foo, [this, "test"].concat(_slice.call(arguments)));
(_Foo$foo = _Foo.foo).call.apply(_Foo$foo, [this].concat(_slice.call(arguments)));
(_Foo$foo2 = _Foo.foo).call.apply(_Foo$foo2, [this, "test"].concat(_slice.call(arguments)));
};
return Test;

View File

@@ -1,7 +1,8 @@
"use strict";
var _obj;
var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
obj[method].apply(obj, [foo, bar].concat(_toArray(args)));
(_obj = obj)[method].apply(_obj, [foo, bar].concat(_toArray(args)));

View File

@@ -1,7 +1,8 @@
"use strict";
var _obj;
var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
obj[method].apply(obj, _toArray(args));
(_obj = obj)[method].apply(_obj, _toArray(args));

View File

@@ -1,8 +1,9 @@
"use strict";
var _foob, _foob$test;
var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
foob.add.apply(foob, [foo, bar].concat(_toArray(numbers)));
foob.test.add.apply(foob.test, [foo, bar].concat(_toArray(numbers)));
(_foob = foob).add.apply(_foob, [foo, bar].concat(_toArray(numbers)));
(_foob$test = foob.test).add.apply(_foob$test, [foo, bar].concat(_toArray(numbers)));

View File

@@ -1,8 +1,9 @@
"use strict";
var _foob, _foob$test;
var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
foob.add.apply(foob, _toArray(numbers));
foob.test.add.apply(foob.test, _toArray(numbers));
(_foob = foob).add.apply(_foob, _toArray(numbers));
(_foob$test = foob.test).add.apply(_foob$test, _toArray(numbers));

View File

@@ -1,2 +1,6 @@
foo::bar();
foo::bar("arg");
var test = "test";
test::bar();
test::bar("arg");

View File

@@ -1,4 +1,9 @@
"use strict";
bar[Symbol.referenceGet](foo).call(foo);
bar[Symbol.referenceGet](foo).call(foo, "arg");
var _foo, _foo2;
_foo = foo, bar[Symbol.referenceGet](_foo).call(_foo);
_foo2 = foo, bar[Symbol.referenceGet](_foo2).call(_foo2, "arg");
var test = "test";
bar[Symbol.referenceGet](test).call(test);
bar[Symbol.referenceGet](test).call(test, "arg");

View File

@@ -1,3 +1,3 @@
delete foo::bar;
if (delete foo::bar);
if (delete foo::bar) {}

View File

@@ -2,4 +2,4 @@
bar[Symbol.referenceDelete](foo);
if ((bar[Symbol.referenceDelete](foo), true)) ;
if ((bar[Symbol.referenceDelete](foo), true)) {}

View File

@@ -1,2 +1,3 @@
var baz = "foo";
foo::bar = baz;
if (foo::bar = baz);
if (foo::bar = baz) {}

View File

@@ -1,4 +1,5 @@
"use strict";
var baz = "foo";
bar[Symbol.referenceSet](foo, baz);
if ((bar[Symbol.referenceSet](foo, baz), baz)) ;
if ((bar[Symbol.referenceSet](foo, baz), baz)) {}

View File

@@ -1,25 +1,27 @@
"use strict";
var _ref2, _obj2, _ref4;
var _obj2, _obj4, _ref2, _obj6, _ref4;
var _hasOwn = Object.prototype.hasOwnProperty;
var obj = {};
if (!_hasOwn.call(obj, "x")) obj.x = 2;
var _obj = obj;
if (!_hasOwn.call(_obj, "x")) _obj.x = 2;
console.log((!_hasOwn.call(obj, "x") && (obj.x = 2), obj.x));
console.log((_obj2 = obj, !_hasOwn.call(_obj2, "x") && (_obj2.x = 2), _obj2.x));
var _obj3 = obj;
var _ref = x();
if (!_hasOwn.call(obj, _ref)) obj[_ref] = 2;
if (!_hasOwn.call(_obj3, _ref)) _obj3[_ref] = 2;
console.log((_ref2 = x(), !_hasOwn.call(obj, _ref2) && (obj[_ref2] = 2), obj[_ref2]));
console.log((_obj4 = obj, _ref2 = x(), !_hasOwn.call(_obj4, _ref2) && (_obj4[_ref2] = 2), _obj4[_ref2]));
var _obj = obj[y()];
var _obj5 = obj[y()];
var _ref3 = x();
if (!_hasOwn.call(_obj, _ref3)) _obj[_ref3] = 2;
if (!_hasOwn.call(_obj5, _ref3)) _obj5[_ref3] = 2;
console.log((_obj2 = obj[y()], _ref4 = x(), !_hasOwn.call(_obj2, _ref4) && (_obj2[_ref4] = 2), _obj2[_ref4]));
console.log((_obj6 = obj[y()], _ref4 = x(), !_hasOwn.call(_obj6, _ref4) && (_obj6[_ref4] = 2), _obj6[_ref4]));

View File

@@ -1,22 +1,22 @@
"use strict";
var _temp, _args;
var fn = obj.method.bind(obj);
var fn = obj.method.bind(obj, "foob");
var fn = obj[foo].method.bind(obj[foo]);
var fn = obj.foo.method.bind(obj.foo);
var fn = (_temp = obj[foo()], _temp.method.bind(_temp));
var _obj, _obj2, _obj$foo, _obj$foo2, _obj3, _args, _args2, _args3;
var fn = (_obj = obj, _obj.method.bind(_obj));
var fn = (_obj2 = obj, _obj2.method.bind(_obj2, "foob"));
var fn = (_obj$foo = obj[foo], _obj$foo.method.bind(_obj$foo));
var fn = (_obj$foo2 = obj.foo, _obj$foo2.method.bind(_obj$foo2));
var fn = (_obj3 = obj[foo()], _obj3.method.bind(_obj3));
["foo", "bar"].map(function (_val) {
["foo", "bar"].map((_args = [], function (_val) {
return _val.toUpperCase();
});
[1.1234, 23.53245, 3].map(function (_val2) {
return _val2.toFixed(2);
});
}));
[1.1234, 23.53245, 3].map((_args2 = [2], function (_val2) {
return _val2.toFixed(_args2[0]);
}));
var get = function () {
return 2;
};
[1.1234, 23.53245, 3].map((_args = [get()], function (_val3) {
return _val3.toFixed(_args[0]);
[1.1234, 23.53245, 3].map((_args3 = [get()], function (_val3) {
return _val3.toFixed(_args3[0]);
}));