make class container shadowed

This commit is contained in:
Sebastian McKenzie 2015-07-24 22:34:14 +01:00
parent 0531b61d59
commit 9cc0442db9
3 changed files with 14 additions and 5 deletions

View File

@ -216,10 +216,9 @@ export default class ClassTransformer {
//
body.push(t.returnStatement(this.classRef));
return t.callExpression(
t.functionExpression(null, closureParams, t.blockStatement(body)),
closureArgs
);
var container = t.functionExpression(null, closureParams, t.blockStatement(body));
container.shadow = true;
return t.callExpression(container, closureArgs);
}
/**

View File

@ -4,7 +4,7 @@ export var metadata = {
group: "builtin-pre"
};
const THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassExpression", "ClassDeclaration"];
const THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty"];
function isUseStrict(node) {
if (!t.isLiteral(node)) return false;

View File

@ -0,0 +1,10 @@
function build(val) {
return class {
[this.key]() {
return val;
}
};
}
var Class = build.call({ key: "foo" }, "bar");
assert.equal(new Class().foo(), "bar");