Skip name inference on hard-to-replace classes - fixes T2494

This commit is contained in:
Logan Smyth
2015-12-05 17:07:10 -08:00
parent 412c65deb3
commit 925804798d
3 changed files with 22 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ let buildPropertyMethodAssignmentWrapper = template(`
})(FUNCTION)
`);
let buldGeneratorPropertyMethodAssignmentWrapper = template(`
let buildGeneratorPropertyMethodAssignmentWrapper = template(`
(function (FUNCTION_KEY) {
function* FUNCTION_ID() {
return yield* FUNCTION_KEY.apply(this, arguments);
@@ -51,9 +51,12 @@ function wrap(state, method, id, scope) {
// we can just munge the local binding
scope.rename(id.name);
} else {
// we don't currently support wrapping class expressions
if (!t.isFunction(method)) return;
// need to add a wrapper since we can't change the references
let build = buildPropertyMethodAssignmentWrapper;
if (method.generator) build = buldGeneratorPropertyMethodAssignmentWrapper;
if (method.generator) build = buildGeneratorPropertyMethodAssignmentWrapper;
let template = build({
FUNCTION: method,
FUNCTION_ID: id,