Skip to content

Commit 423ffc7

Browse files
authored
Merge pull request #19078 from asgerf/js/name-resolution
JS: QL-side type/name resolution for TypeScript and JSDoc
2 parents f038e2f + e848aa7 commit 423ffc7

File tree

79 files changed

+3729
-2180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3729
-2180
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,15 +426,13 @@ public Void visit(Identifier nd, Void v) {
426426
// cases where we turn on the 'declKind' flags
427427
@Override
428428
public Void visit(FunctionDeclaration nd, Void v) {
429-
if (nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile()) return null;
430429
// strict mode functions are block-scoped, non-strict mode ones aren't
431430
if (blockscope == isStrict) visit(nd.getId(), DeclKind.var);
432431
return null;
433432
}
434433

435434
@Override
436435
public Void visit(ClassDeclaration nd, Void c) {
437-
if (nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile()) return null;
438436
if (blockscope) visit(nd.getClassDef().getId(), DeclKind.varAndType);
439437
return null;
440438
}
@@ -483,7 +481,6 @@ public Void visit(EnhancedForStatement nd, Void v) {
483481

484482
@Override
485483
public Void visit(VariableDeclaration nd, Void v) {
486-
if (nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile()) return null;
487484
// in block scoping mode, only process 'let'; in non-block scoping
488485
// mode, only process non-'let'
489486
if (blockscope == nd.isBlockScoped(ecmaVersion)) visit(nd.getDeclarations());
@@ -518,8 +515,7 @@ public Void visit(ClassBody nd, Void c) {
518515
@Override
519516
public Void visit(NamespaceDeclaration nd, Void c) {
520517
if (blockscope) return null;
521-
boolean isAmbientOutsideDtsFile = nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile();
522-
boolean hasVariable = nd.isInstantiated() && !isAmbientOutsideDtsFile;
518+
boolean hasVariable = nd.isInstantiated();
523519
visit(nd.getName(), hasVariable ? DeclKind.varAndNamespace : DeclKind.namespace);
524520
return null;
525521
}

0 commit comments

Comments
 (0)