Fix over-parenthesizing of function expressions

This commit is contained in:
Amjad Masad 2015-12-24 14:55:51 -08:00
parent 15760dfed2
commit 0d8e5a9e86
78 changed files with 213 additions and 187 deletions

View File

@ -1,7 +1,7 @@
(function (global) {
var babelHelpers = global.babelHelpers = {};
babelHelpers.createClass = (function () {
babelHelpers.createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
@ -17,5 +17,5 @@
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();
}();
})(typeof global === "undefined" ? self : global);

View File

@ -1,4 +1,4 @@
var Foo = (function (_Bar) {
var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo(options) {
@ -12,4 +12,4 @@ var Foo = (function (_Bar) {
}
return Foo;
})(Bar);
}(Bar);

View File

@ -1,4 +1,4 @@
var Test = (function () {
var Test = function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
}
@ -10,7 +10,7 @@ var Test = (function () {
}
}]);
return Test;
})();
}();
var test = new Test();
test.bar;

View File

@ -5,7 +5,7 @@ import * as parens from "./parentheses";
import each from "lodash/collection/each";
import * as t from "babel-types";
function find(obj, node, parent) {
function find(obj, node, parent, printStack) {
if (!obj) return;
let result;
@ -15,7 +15,7 @@ function find(obj, node, parent) {
if (t.is(type, node)) {
let fn = obj[type];
result = fn(node, parent);
result = fn(node, parent, printStack);
if (result != null) break;
}
}
@ -79,14 +79,14 @@ export default class Node {
return Node.needsWhitespace(node, parent, "after");
}
static needsParens(node, parent) {
static needsParens(node, parent, printStack) {
if (!parent) return false;
if (t.isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
}
return find(parens, node, parent);
return find(parens, node, parent, printStack);
}
}

View File

@ -176,7 +176,7 @@ export function UnaryLike(node: Object, parent: Object): boolean {
return false;
}
export function FunctionExpression(node: Object, parent: Object): boolean {
export function FunctionExpression(node: Object, parent: Object, printStack: Array<Object>): boolean {
// (function () {});
if (t.isExpressionStatement(parent)) {
return true;
@ -187,7 +187,31 @@ export function FunctionExpression(node: Object, parent: Object): boolean {
return true;
}
return UnaryLike(node, parent);
// Walk up the tree and determine if the function will be printed first in a statement.
let i = printStack.length - 1;
node = printStack[i];
i--;
parent = printStack[i];
while (i > 0) {
if (t.isExpressionStatement(parent, { expression: node })) {
return true;
}
if ((t.isCallExpression(parent, { callee: node })) ||
(t.isSequenceExpression(parent) && parent.expressions[0] === node) ||
(t.isMemberExpression(parent, { object: node })) ||
(t.isConditional(parent, { test: node })) ||
(t.isBinary(parent, { left: node })) ||
(t.isAssignmentExpression(parent, { left: node }))) {
node = parent;
i--;
parent = printStack[i];
} else {
return false;
}
}
return false;
}
export function ArrowFunctionExpression(node: Object, parent: Object): boolean {

View File

@ -8,6 +8,7 @@ export default class Printer extends Buffer {
super(...args);
this.insideAux = false;
this.printAuxAfterOnNextUserNode = false;
this._printStack = [];
}
print(node, parent, opts = {}) {
@ -32,10 +33,12 @@ export default class Printer extends Buffer {
throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`);
}
this._printStack.push(node);
if (node.loc) this.printAuxAfterComment();
this.printAuxBeforeComment(oldInAux);
let needsParens = n.needsParens(node, parent);
let needsParens = n.needsParens(node, parent, this._printStack);
if (needsParens) this.push("(");
this.printLeadingComments(node, parent);
@ -58,6 +61,7 @@ export default class Printer extends Buffer {
if (needsParens) this.push(")");
// end
this._printStack.pop();
this.map.mark(node, "end");
if (opts.after) opts.after();

View File

@ -1,4 +1,4 @@
var fact5 = (function fact(n) {
var fact5 = function fact(n) {
if (n <= 1) return 1;
return n * fact(n - 1);
})(5);
}(5);

View File

@ -1 +1 @@
a && (a.b && a.b.c());
a && (a.b && a.b.c()) && function() {}();

View File

@ -1 +1 @@
a && a.b && a.b.c();
a && a.b && a.b.c() && function () {}();

View File

@ -1,8 +1,8 @@
var foo = (function () {
var foo = function () {
var ref = babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
});
return function foo() {
return ref.apply(this, arguments);
};
})();
}();

View File

@ -1,8 +1,8 @@
var foo = (function () {
var foo = function () {
var ref = babelHelpers.asyncToGenerator(function* () {
console.log(bar);
});
return function bar() {
return ref.apply(this, arguments);
};
})();
}();

View File

@ -1,6 +1,6 @@
let foo = (function () {
let foo = function () {
var ref = babelHelpers.asyncToGenerator(function* (bar) {});
return function foo(_x) {
return ref.apply(this, arguments);
};
})();
}();

View File

@ -1,10 +1,10 @@
function normalFunction() {}
let foo = (function () {
let foo = function () {
var ref = babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
});
return function foo() {
return ref.apply(this, arguments);
};
})();
}();

View File

@ -1,5 +1,5 @@
import { coroutine as _coroutine } from "bluebird";
var foo = (function () {
var foo = function () {
var ref = _coroutine(function* () {
var wat = yield bar();
});
@ -7,4 +7,4 @@ var foo = (function () {
return function foo() {
return ref.apply(this, arguments);
};
})();
}();

View File

@ -1,5 +1,5 @@
import { coroutine as _coroutine } from "bluebird";
var foo = (function () {
var foo = function () {
var ref = _coroutine(function* () {
console.log(bar);
});
@ -7,4 +7,4 @@ var foo = (function () {
return function bar() {
return ref.apply(this, arguments);
};
})();
}();

View File

@ -1,6 +1,6 @@
import { coroutine as _coroutine } from "bluebird";
let foo = (function () {
let foo = function () {
var ref = _coroutine(function* () {
var wat = yield bar();
});
@ -8,4 +8,4 @@ let foo = (function () {
return function foo() {
return ref.apply(this, arguments);
};
})();
}();

View File

@ -1,4 +1,4 @@
let Foo = (function () {
let Foo = function () {
let _class2 = class {};
var _classCall = function () {
@ -15,4 +15,4 @@ let Foo = (function () {
_class.__proto__ = _class2;
return _class;
})();
}();

View File

@ -1,4 +1,4 @@
var Foo = (function (_Bar) {
var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo(...args) {
@ -9,4 +9,4 @@ var Foo = (function (_Bar) {
}
return Foo;
})(Bar);
}(Bar);

View File

@ -1,6 +1,6 @@
"use strict";
var Child = (function (_Parent) {
var Child = function (_Parent) {
babelHelpers.inherits(Child, _Parent);
function Child() {
@ -16,4 +16,4 @@ var Child = (function (_Parent) {
}
return Child;
})(Parent);
}(Parent);

View File

@ -1,4 +1,4 @@
var Foo = (function (_Bar) {
var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo() {
@ -11,4 +11,4 @@ var Foo = (function (_Bar) {
}
return Foo;
})(Bar);
}(Bar);

View File

@ -1,4 +1,4 @@
var Foo = (function (_Bar) {
var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo() {
@ -11,4 +11,4 @@ var Foo = (function (_Bar) {
}
return Foo;
})(Bar);
}(Bar);

View File

@ -1,12 +1,12 @@
var _class, _temp;
call((_temp = _class = (function () {
call((_temp = _class = function () {
function _class2() {
babelHelpers.classCallCheck(this, _class2);
}
return _class2;
})(), _class.test = true, _temp));
}(), _class.test = true, _temp));
var _class3 = function _class3() {
babelHelpers.classCallCheck(this, _class3);
@ -15,4 +15,3 @@ var _class3 = function _class3() {
_class3.test = true;
export default _class3;
;

View File

@ -1,7 +1,7 @@
function withContext(ComposedComponent) {
var _class, _temp;
return _temp = _class = (function (_Component) {
return _temp = _class = function (_Component) {
babelHelpers.inherits(WithContext, _Component);
function WithContext() {
@ -10,7 +10,7 @@ function withContext(ComposedComponent) {
}
return WithContext;
})(Component), _class.propTypes = {
}(Component), _class.propTypes = {
context: PropTypes.shape({
addCss: PropTypes.func,
setTitle: PropTypes.func,

View File

@ -1,20 +1,20 @@
function foo() {
var _this = this;
arr.map((function (x) {
arr.map(function (x) {
babelHelpers.newArrowCheck(this, _this);
return x * x;
}).bind(this));
var f = (function (x, y) {
}.bind(this));
var f = function (x, y) {
babelHelpers.newArrowCheck(this, _this);
return x * y;
}).bind(this);
}.bind(this);
(function () {
var _this2 = this;
return (function () {
return function () {
babelHelpers.newArrowCheck(this, _this2);
return this;
}).bind(this);
}.bind(this);
})();
}

View File

@ -1,10 +1,10 @@
function test () {
let value = "outer";
return (function () {
return function () {
let value = "inner";
return value;
})();
}();
}
assert(test(), "inner");

View File

@ -2,14 +2,14 @@ foo.func1 = function () {
if (cond1) {
for (;;) {
if (cond2) {
var _ret = (function () {
var _ret = function () {
function func2() {}
function func3() {}
func4(function () {
func2();
});
return "break";
})();
}();
if (_ret === "break") break;
}

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -22,4 +22,4 @@ var Test = (function (_Foo) {
}
return Test;
})(Foo);
}(Foo);

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -12,4 +12,4 @@ var Test = (function (_Foo) {
}
return Test;
})(Foo);
}(Foo);

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -16,4 +16,4 @@ var Test = (function (_Foo) {
};
return Test;
})(Foo);
}(Foo);

View File

@ -1,4 +1,4 @@
var x = (function () {
var x = function () {
x.prototype.f = function f() {
1;
2;
@ -14,4 +14,4 @@ var x = (function () {
}
return x;
})();
}();

View File

@ -1,4 +1,4 @@
var Foo = (function () {
var Foo = function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
@ -6,4 +6,4 @@ var Foo = (function () {
Foo.prototype["bar"] = function bar() {};
return Foo;
})();
}();

View File

@ -1,4 +1,4 @@
var BaseController = (function (_Chaplin$Controller) {
var BaseController = function (_Chaplin$Controller) {
babelHelpers.inherits(BaseController, _Chaplin$Controller);
function BaseController() {
@ -7,9 +7,9 @@ var BaseController = (function (_Chaplin$Controller) {
}
return BaseController;
})(Chaplin.Controller);
}(Chaplin.Controller);
var BaseController2 = (function (_Chaplin$Controller$A) {
var BaseController2 = function (_Chaplin$Controller$A) {
babelHelpers.inherits(BaseController2, _Chaplin$Controller$A);
function BaseController2() {
@ -18,4 +18,4 @@ var BaseController2 = (function (_Chaplin$Controller$A) {
}
return BaseController2;
})(Chaplin.Controller.Another);
}(Chaplin.Controller.Another);

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -7,4 +7,4 @@ var Test = (function (_Foo) {
}
return Test;
})(Foo);
}(Foo);

View File

@ -16,7 +16,7 @@ var _binarySerializer2 = babelHelpers.interopRequireDefault(_binarySerializer);
// import ...
var Connection = (function (_EventEmitter) {
var Connection = function (_EventEmitter) {
babelHelpers.inherits(Connection, _EventEmitter);
function Connection(endpoint, joinKey, joinData, roomId) {
@ -43,6 +43,6 @@ var Connection = (function (_EventEmitter) {
}
}]);
return Connection;
})(_events.EventEmitter);
}(_events.EventEmitter);
exports.default = Connection;

View File

@ -8,7 +8,7 @@ var _BaseFoo2 = require('./BaseFoo');
var _BaseFoo3 = babelHelpers.interopRequireDefault(_BaseFoo2);
var SubFoo = (function (_BaseFoo) {
var SubFoo = function (_BaseFoo) {
babelHelpers.inherits(SubFoo, _BaseFoo);
function SubFoo() {
@ -24,6 +24,6 @@ var SubFoo = (function (_BaseFoo) {
}
}]);
return SubFoo;
})(_BaseFoo3.default);
}(_BaseFoo3.default);
exports.default = SubFoo;

View File

@ -8,7 +8,7 @@ var _react = require('react');
var _react2 = babelHelpers.interopRequireDefault(_react);
var RandomComponent = (function (_Component) {
var RandomComponent = function (_Component) {
babelHelpers.inherits(RandomComponent, _Component);
function RandomComponent() {
@ -31,6 +31,6 @@ var RandomComponent = (function (_Component) {
}
}]);
return RandomComponent;
})(_react.Component);
}(_react.Component);
exports.default = RandomComponent;

View File

@ -8,7 +8,7 @@ var b = function b() {
babelHelpers.classCallCheck(this, b);
};
var a1 = (function (_b) {
var a1 = function (_b) {
babelHelpers.inherits(a1, _b);
function a1() {
@ -23,9 +23,9 @@ var a1 = (function (_b) {
}
return a1;
})(b);
}(b);
var a2 = (function (_b2) {
var a2 = function (_b2) {
babelHelpers.inherits(a2, _b2);
function a2() {
@ -40,6 +40,6 @@ var a2 = (function (_b2) {
}
return a2;
})(b);
}(b);
exports.default = a2;

View File

@ -1,7 +1,7 @@
"use strict";
var x = {
Foo: (function (_Foo) {
Foo: function (_Foo) {
babelHelpers.inherits(_class, _Foo);
function _class() {
@ -10,5 +10,5 @@ var x = {
}
return _class;
})(Foo)
}(Foo)
};

View File

@ -4,7 +4,7 @@ var A = function A() {
babelHelpers.classCallCheck(this, A);
};
var B = (function (_A) {
var B = function (_A) {
babelHelpers.inherits(B, _A);
function B() {
@ -16,5 +16,4 @@ var B = (function (_A) {
}
return B;
})(A);
}(A);

View File

@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
function _default() {
return (function () {
return function () {
function Select() {
babelHelpers.classCallCheck(this, Select);
}
@ -14,6 +14,6 @@ function _default() {
value: function query(_query) {}
}]);
return Select;
})();
}();
}
exports.default = _default;

View File

@ -2,7 +2,7 @@
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Example = (function () {
var Example = function () {
function Example() {
_classCallCheck(this, Example);
}
@ -27,4 +27,4 @@ var Example = (function () {
}, test2, this);
});
return Example;
})();
}();

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -41,4 +41,4 @@ var Test = (function (_Foo) {
}
}]);
return Test;
})(Foo);
}(Foo);

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -12,4 +12,4 @@ var Test = (function (_Foo) {
}
return Test;
})(Foo);
}(Foo);

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -18,4 +18,4 @@ var Test = (function (_Foo) {
}
}]);
return Test;
})(Foo);
}(Foo);

View File

@ -1,4 +1,4 @@
var Foo = (function () {
var Foo = function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
@ -17,4 +17,4 @@ var Foo = (function () {
value: function value() {}
}]);
return Foo;
})();
}();

View File

@ -4,7 +4,7 @@ var Test = function Test() {
this.state = "test";
};
var Foo = (function (_Bar) {
var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo() {
@ -17,7 +17,7 @@ var Foo = (function (_Bar) {
}
return Foo;
})(Bar);
}(Bar);
var ConstructorScoping = function ConstructorScoping() {
babelHelpers.classCallCheck(this, ConstructorScoping);

View File

@ -1,4 +1,4 @@
var Foo = (function (_Bar) {
var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo() {
@ -11,4 +11,4 @@ var Foo = (function (_Bar) {
}
return Foo;
})(Bar);
}(Bar);

View File

@ -1,4 +1,4 @@
var _class = (function (_A) {
var _class = function (_A) {
babelHelpers.inherits(_class, _A);
function _class() {
@ -7,6 +7,6 @@ var _class = (function (_A) {
}
return _class;
})(A);
}(A);
export default _class;

View File

@ -1,4 +1,4 @@
var Test = (function () {
var Test = function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
}
@ -13,4 +13,4 @@ var Test = (function () {
}
}]);
return Test;
})();
}();

View File

@ -1,4 +1,4 @@
var Test = (function () {
var Test = function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
}
@ -10,4 +10,4 @@ var Test = (function () {
}
}]);
return Test;
})();
}();

View File

@ -1,4 +1,4 @@
var Test = (function () {
var Test = function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
}
@ -10,4 +10,4 @@ var Test = (function () {
}
}]);
return Test;
})();
}();

View File

@ -1,4 +1,4 @@
var Test = (function () {
var Test = function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
}
@ -10,4 +10,4 @@ var Test = (function () {
}
}]);
return Test;
})();
}();

View File

@ -2,7 +2,7 @@
var _a2 = require("./a");
var Foo = (function () {
var Foo = function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
@ -14,4 +14,4 @@ var Foo = (function () {
}
}]);
return Foo;
})();
}();

View File

@ -1,6 +1,6 @@
// #1649
var Foo = (function () {
var Foo = function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
@ -13,4 +13,4 @@ var Foo = (function () {
value: function value() {}
}]);
return Foo;
})();
}();

View File

@ -10,7 +10,7 @@ var BaseView = function BaseView() {
this.autoRender = true;
};
var BaseView = (function () {
var BaseView = function () {
function BaseView() {
babelHelpers.classCallCheck(this, BaseView);
}
@ -22,4 +22,4 @@ var BaseView = (function () {
}
}]);
return BaseView;
})();
}();

View File

@ -1,4 +1,4 @@
var A = (function () {
var A = function () {
function A() {
babelHelpers.classCallCheck(this, A);
}
@ -12,4 +12,4 @@ var A = (function () {
set: function set(b) {}
}]);
return A;
})();
}();

View File

@ -1,4 +1,4 @@
var TestEmpty = (function (_ref) {
var TestEmpty = function (_ref) {
babelHelpers.inherits(TestEmpty, _ref);
function TestEmpty() {
@ -7,15 +7,15 @@ var TestEmpty = (function (_ref) {
}
return TestEmpty;
})((function () {
}(function () {
function _class() {
babelHelpers.classCallCheck(this, _class);
}
return _class;
})());
}());
var TestConstructorOnly = (function (_ref2) {
var TestConstructorOnly = function (_ref2) {
babelHelpers.inherits(TestConstructorOnly, _ref2);
function TestConstructorOnly() {
@ -24,15 +24,15 @@ var TestConstructorOnly = (function (_ref2) {
}
return TestConstructorOnly;
})((function () {
}(function () {
function _class2() {
babelHelpers.classCallCheck(this, _class2);
}
return _class2;
})());
}());
var TestMethodOnly = (function (_ref3) {
var TestMethodOnly = function (_ref3) {
babelHelpers.inherits(TestMethodOnly, _ref3);
function TestMethodOnly() {
@ -41,7 +41,7 @@ var TestMethodOnly = (function (_ref3) {
}
return TestMethodOnly;
})((function () {
}(function () {
function _class3() {
babelHelpers.classCallCheck(this, _class3);
}
@ -51,9 +51,9 @@ var TestMethodOnly = (function (_ref3) {
value: function method() {}
}]);
return _class3;
})());
}());
var TestConstructorAndMethod = (function (_ref4) {
var TestConstructorAndMethod = function (_ref4) {
babelHelpers.inherits(TestConstructorAndMethod, _ref4);
function TestConstructorAndMethod() {
@ -62,7 +62,7 @@ var TestConstructorAndMethod = (function (_ref4) {
}
return TestConstructorAndMethod;
})((function () {
}(function () {
function _class4() {
babelHelpers.classCallCheck(this, _class4);
}
@ -72,9 +72,9 @@ var TestConstructorAndMethod = (function (_ref4) {
value: function method() {}
}]);
return _class4;
})());
}());
var TestMultipleMethods = (function (_ref5) {
var TestMultipleMethods = function (_ref5) {
babelHelpers.inherits(TestMultipleMethods, _ref5);
function TestMultipleMethods() {
@ -83,7 +83,7 @@ var TestMultipleMethods = (function (_ref5) {
}
return TestMultipleMethods;
})((function () {
}(function () {
function _class5() {
babelHelpers.classCallCheck(this, _class5);
}
@ -96,4 +96,4 @@ var TestMultipleMethods = (function (_ref5) {
value: function m2() {}
}]);
return _class5;
})());
}());

View File

@ -1,4 +1,4 @@
var BaseController = (function (_Chaplin$Controller) {
var BaseController = function (_Chaplin$Controller) {
babelHelpers.inherits(BaseController, _Chaplin$Controller);
function BaseController() {
@ -7,9 +7,9 @@ var BaseController = (function (_Chaplin$Controller) {
}
return BaseController;
})(Chaplin.Controller);
}(Chaplin.Controller);
var BaseController2 = (function (_Chaplin$Controller$A) {
var BaseController2 = function (_Chaplin$Controller$A) {
babelHelpers.inherits(BaseController2, _Chaplin$Controller$A);
function BaseController2() {
@ -18,4 +18,4 @@ var BaseController2 = (function (_Chaplin$Controller$A) {
}
return BaseController2;
})(Chaplin.Controller.Another);
}(Chaplin.Controller.Another);

View File

@ -1,4 +1,4 @@
var Test = (function (_Foo) {
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
function Test() {
@ -7,4 +7,4 @@ var Test = (function (_Foo) {
}
return Test;
})(Foo);
}(Foo);

View File

@ -1,4 +1,4 @@
let Foo = (function () {
let Foo = function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
@ -10,4 +10,4 @@ let Foo = (function () {
}
}]);
return Foo;
})();
}();

View File

@ -1,5 +1,5 @@
var test = {
setInterval: (function (_setInterval) {
setInterval: function (_setInterval) {
function setInterval(_x, _x2) {
return _setInterval.apply(this, arguments);
}
@ -9,7 +9,7 @@ var test = {
};
return setInterval;
})(function (fn, ms) {
}(function (fn, ms) {
setInterval(fn, ms);
})
};

View File

@ -8,7 +8,7 @@ var _last2 = require("lodash/array/last");
var _last3 = babelHelpers.interopRequireDefault(_last2);
let Container = (function () {
let Container = function () {
function Container() {
babelHelpers.classCallCheck(this, Container);
}
@ -24,6 +24,6 @@ let Container = (function () {
}
}]);
return Container;
})();
}();
exports.default = Container;
exports.default = Container;

View File

@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
var _store = require("./store");
let Login = (function (_React$Component) {
let Login = function (_React$Component) {
babelHelpers.inherits(Login, _React$Component);
function Login() {
@ -21,6 +21,6 @@ let Login = (function (_React$Component) {
}
}]);
return Login;
})(React.Component);
}(React.Component);
exports.default = Login;

View File

@ -4,7 +4,7 @@ var _events2 = require("events");
var _events3 = babelHelpers.interopRequireDefault(_events2);
let Template = (function () {
let Template = function () {
function Template() {
babelHelpers.classCallCheck(this, Template);
}
@ -16,6 +16,6 @@ let Template = (function () {
}
}]);
return Template;
})();
}();
console.log(new Template().events());
console.log(new Template().events());

View File

@ -5,7 +5,7 @@ var obj = {
})();
},
h: (function (_h) {
h: function (_h) {
function h() {
return _h.apply(this, arguments);
}
@ -15,7 +15,7 @@ var obj = {
};
return h;
})(function () {
}(function () {
console.log(h);
}),

View File

@ -21,7 +21,7 @@ define(["exports"], function (exports) {
exports.default = Foo;
exports.default = foo;
exports.default = (function () {
exports.default = function () {
return "foo";
})();
});
}();
});

View File

@ -11,9 +11,9 @@ define(["exports", "./evens"], function (exports, _evens) {
return (0, _evens.isEven)(n) ? n + 1 : n + 2;
}
var isOdd = exports.isOdd = (function (isEven) {
var isOdd = exports.isOdd = function (isEven) {
return function (n) {
return !isEven(n);
};
})(_evens.isEven);
});
}(_evens.isEven);
});

View File

@ -17,6 +17,6 @@ class Foo {}
exports.default = Foo;
exports.default = foo;
exports.default = (function () {
exports.default = function () {
return "foo";
})();
}();

View File

@ -12,8 +12,8 @@ function nextOdd(n) {
return (0, _evens.isEven)(n) ? n + 1 : n + 2;
}
var isOdd = exports.isOdd = (function (isEven) {
var isOdd = exports.isOdd = function (isEven) {
return function (n) {
return !isEven(n);
};
})(_evens.isEven);
}(_evens.isEven);

View File

@ -24,9 +24,9 @@ System.register([], function (_export) {
_export("default", Foo);
_export("default", (function () {
_export("default", function () {
return "foo";
})());
}());
}
};
});
});

View File

@ -21,11 +21,11 @@ System.register(["./evens"], function (_export) {
for (i = 0, j = 0;;);
_export("isOdd", isOdd = (function (isEven) {
_export("isOdd", isOdd = function (isEven) {
return function (n) {
return !isEven(n);
};
})(isEven));
}(isEven));
_export("isOdd", isOdd);
}

View File

@ -33,7 +33,7 @@
exports.default = Foo;
exports.default = foo;
exports.default = (function () {
exports.default = function () {
return "foo";
})();
});
}();
});

View File

@ -23,9 +23,9 @@
return (0, _evens.isEven)(n) ? n + 1 : n + 2;
}
var isOdd = exports.isOdd = (function (isEven) {
var isOdd = exports.isOdd = function (isEven) {
return function (n) {
return !isEven(n);
};
})(_evens.isEven);
});
}(_evens.isEven);
});

View File

@ -3,9 +3,9 @@ function outer() {
var a = arguments.length <= 0 || arguments[0] === undefined ? function () {
return eval("x");
} : arguments[0];
return (function () {
return function () {
var x = "inside";
return a();
})();
}();
}
outer();

View File

@ -1,6 +1,6 @@
function broken(x) {
if (true) {
var Foo = (function (_Bar) {
var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo() {
@ -9,7 +9,7 @@ function broken(x) {
}
return Foo;
})(Bar);
}(Bar);
for (var _len = arguments.length, foo = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
foo[_key - 1] = arguments[_key];

View File

@ -1,7 +1,7 @@
var Test = (function () {
var Test = function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
}
return Test;
})();
}();

View File

@ -1,10 +1,10 @@
var IdenticalName = (function () {
var IdenticalName = function () {
function IdenticalName(x) {
return x;
}
return IdenticalName;
})();
}();
(function () {
function foo() {}

View File

@ -1,4 +1,4 @@
var _jsx = (function () { var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; return function createRawReactElement(type, props, key, children) { var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { props = {}; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null }; }; })();
var _jsx = function () { var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; return function createRawReactElement(type, props, key, children) { var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { props = {}; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null }; }; }();
var _ref = _jsx("foo", {});
@ -14,4 +14,4 @@ function render() {
return function () {
return _ref2;
};
}
}