TS: allow namespace imports as types

This commit is contained in:
Asger F
2019-03-20 10:08:45 +00:00
parent 23d77f3e6a
commit aaa8bfb874
6 changed files with 14 additions and 14 deletions

View File

@@ -42,7 +42,6 @@ import com.semmle.js.ast.IPattern;
import com.semmle.js.ast.Identifier;
import com.semmle.js.ast.IfStatement;
import com.semmle.js.ast.ImportDeclaration;
import com.semmle.js.ast.ImportNamespaceSpecifier;
import com.semmle.js.ast.ImportSpecifier;
import com.semmle.js.ast.InvokeExpression;
import com.semmle.js.ast.JumpStatement;
@@ -1449,13 +1448,7 @@ public class ASTExtractor {
public Label visit(ImportSpecifier nd, Context c) {
Label lbl = super.visit(nd, c);
visit(nd.getImported(), lbl, 0, IdContext.label);
visit(
nd.getLocal(),
lbl,
1,
nd instanceof ImportNamespaceSpecifier
? IdContext.varAndNamespaceDecl
: IdContext.varAndTypeAndNamespaceDecl);
visit(nd.getLocal(), lbl, 1, IdContext.varAndTypeAndNamespaceDecl);
return lbl;
}

View File

@@ -37,7 +37,7 @@ public class Main {
* A version identifier that should be updated every time the extractor changes in such a way that
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
*/
public static final String EXTRACTOR_VERSION = "2019-03-13";
public static final String EXTRACTOR_VERSION = "2019-03-20";
public static final Pattern NEWLINE = Pattern.compile("\n");

View File

@@ -17,7 +17,6 @@ import com.semmle.js.ast.INode;
import com.semmle.js.ast.Identifier;
import com.semmle.js.ast.IfStatement;
import com.semmle.js.ast.ImportDeclaration;
import com.semmle.js.ast.ImportNamespaceSpecifier;
import com.semmle.js.ast.ImportSpecifier;
import com.semmle.js.ast.LabeledStatement;
import com.semmle.js.ast.LetExpression;
@@ -559,9 +558,7 @@ public class ScopeManager {
@Override
public Void visit(ImportSpecifier nd, Void c) {
return visit(
nd.getLocal(),
nd instanceof ImportNamespaceSpecifier ? DeclKind.varAndNamespace : DeclKind.all);
return visit(nd.getLocal(), DeclKind.all);
}
@Override