move jscript transformer to the builtin-trailing group and perform transform on exit - closes #1652, fixes #1651
This commit is contained in:
@@ -51,7 +51,6 @@ export default {
|
||||
"es6.spec.symbols": require("./es6/spec.symbols"),
|
||||
"es7.functionBind": require("./es7/function-bind"),
|
||||
"spec.undefinedToVoid": require("./spec/undefined-to-void"),
|
||||
jscript: require("./other/jscript"),
|
||||
flow: require("./other/flow"),
|
||||
|
||||
//- builtin-advanced
|
||||
@@ -83,4 +82,5 @@ export default {
|
||||
"minification.memberExpressionLiterals": require("./minification/member-expression-literals"),
|
||||
"minification.propertyLiterals": require("./minification/property-literals"),
|
||||
_blockHoist: require("./internal/block-hoist"),
|
||||
jscript: require("./other/jscript"),
|
||||
};
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
group: "builtin-trailing",
|
||||
optional: true
|
||||
};
|
||||
|
||||
export function FunctionExpression(node, print) {
|
||||
if (!node.id) return;
|
||||
node._ignoreUserWhitespace = true;
|
||||
export var FunctionExpression = {
|
||||
exit(node, print) {
|
||||
if (!node.id) return;
|
||||
node._ignoreUserWhitespace = true;
|
||||
|
||||
return t.callExpression(
|
||||
t.functionExpression(null, [], t.blockStatement([
|
||||
t.toStatement(node),
|
||||
t.returnStatement(node.id)
|
||||
])),
|
||||
[]
|
||||
);
|
||||
}
|
||||
return t.callExpression(
|
||||
t.functionExpression(null, [], t.blockStatement([
|
||||
t.toStatement(node),
|
||||
t.returnStatement(node.id)
|
||||
])),
|
||||
[]
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class MyClass {
|
||||
test() {
|
||||
const that = this;
|
||||
const func = () => this === that;
|
||||
return func();
|
||||
}
|
||||
}
|
||||
|
||||
assert(new MyClass().test());
|
||||
Reference in New Issue
Block a user