Create a variable for class properties in scope instead of deleting the key (babel/babel-eslint#336)
This commit is contained in:
parent
66a4cf578f
commit
9ee5e6e59c
@ -206,11 +206,6 @@ var astTransformVisitor = {
|
||||
}
|
||||
}
|
||||
|
||||
// remove class property keys (or patch in escope)
|
||||
if (path.isClassProperty()) {
|
||||
delete node.key;
|
||||
}
|
||||
|
||||
// async function as generator
|
||||
if (path.isFunction()) {
|
||||
if (node.async) node.generator = true;
|
||||
|
||||
@ -229,6 +229,13 @@ function monkeypatch() {
|
||||
// visit decorators that are in: ClassDeclaration / ClassExpression
|
||||
var visitClass = referencer.prototype.visitClass;
|
||||
referencer.prototype.visitClass = function(node) {
|
||||
var classBody = node.body.body;
|
||||
for (var a = 0; a < classBody.length; a++) {
|
||||
if (classBody[a].type === "ClassProperty") {
|
||||
createScopeVariable.call(this, classBody[a], classBody[a].key);
|
||||
}
|
||||
}
|
||||
|
||||
visitDecorators.call(this, node);
|
||||
var typeParamScope;
|
||||
if (node.typeParameters) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user