From 34946adfb81a97fb0de61d9566bc935316bf294a Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sat, 13 Jun 2020 00:37:13 -0700 Subject: [PATCH] refactoring --- src/ast/nodes/MemberExpression.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ast/nodes/MemberExpression.ts b/src/ast/nodes/MemberExpression.ts index 9088848f991..f2a07af0621 100644 --- a/src/ast/nodes/MemberExpression.ts +++ b/src/ast/nodes/MemberExpression.ts @@ -258,18 +258,18 @@ export default class MemberExpression extends NodeBase implements DeoptimizableE } private disallowNamespaceReassignment() { - if ( - this.object instanceof Identifier && - this.scope.findVariable(this.object.name).isNamespace - ) { - this.scope.findVariable(this.object.name).include(); - this.context.warn( - { - code: 'ILLEGAL_NAMESPACE_REASSIGNMENT', - message: `Illegal reassignment to import '${this.object.name}'` - }, - this.start - ); + if (this.object instanceof Identifier) { + const ns = this.scope.findVariable(this.object.name); + if (ns.isNamespace) { + ns.include(); + this.context.warn( + { + code: 'ILLEGAL_NAMESPACE_REASSIGNMENT', + message: `Illegal reassignment to import '${this.object.name}'` + }, + this.start + ); + } } }