Skip to content

Commit d7e3e9e

Browse files
committed
JS: Fix extraction of identifiers in EXPORT_BASE context
This is needed to ensure that the base of the RHS of an ImportEqualsDeclaration is bound to a namespace. That is, B below should be bound to a namespace: import A = B.C.D;
1 parent 665fa2a commit d7e3e9e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ public Label visit(MemberExpression nd, Context c) {
747747
visit(nd.getProperty(), key, 1, IdContext.TYPE_LABEL);
748748
} else {
749749
IdContext baseIdContext =
750-
c.idcontext == IdContext.EXPORT ? IdContext.EXPORT_BASE : IdContext.VAR_BIND;
750+
(c.idcontext == IdContext.EXPORT || c.idcontext == IdContext.EXPORT_BASE) ? IdContext.EXPORT_BASE : IdContext.VAR_BIND;
751751
visit(nd.getObject(), key, 0, baseIdContext);
752752
visit(nd.getProperty(), key, 1, nd.isComputed() ? IdContext.VAR_BIND : IdContext.LABEL);
753753
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
| A | namespace | test.d.ts:1:19:1:19 | A | test.d.ts:10:14:10:14 | A |
12
| A | variable | test.d.ts:1:19:1:19 | A | test.d.ts:10:14:10:14 | A |

0 commit comments

Comments
 (0)