mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #32 from asger-semmle/export-import-flow
TypeScript: bugfixes for import-assign statement
This commit is contained in:
@@ -43,8 +43,8 @@ private predicate defn(ControlFlowNode def, Expr lhs, AST::ValueNode rhs) {
|
||||
exists (EnumDeclaration ed | def = ed.getIdentifier() |
|
||||
lhs = def and rhs = ed
|
||||
) or
|
||||
exists (ImportEqualsDeclaration i | def = i.getId() |
|
||||
lhs = def and rhs = i.getImportedEntity()
|
||||
exists (ImportEqualsDeclaration i | def = i |
|
||||
lhs = i.getId() and rhs = i.getImportedEntity()
|
||||
) or
|
||||
exists (EnumMember member | def = member.getIdentifier() |
|
||||
lhs = def and rhs = member.getInitializer()
|
||||
|
||||
@@ -308,7 +308,8 @@ class ExportNamedDeclaration extends ExportDeclaration, @exportnameddeclaration
|
||||
result = op.(NamespaceDeclaration).getId() or
|
||||
result = op.(EnumDeclaration).getIdentifier() or
|
||||
result = op.(InterfaceDeclaration).getIdentifier() or
|
||||
result = op.(TypeAliasDeclaration).getIdentifier()
|
||||
result = op.(TypeAliasDeclaration).getIdentifier() or
|
||||
result = op.(ImportEqualsDeclaration).getId()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -224,6 +224,10 @@ class ImportEqualsDeclaration extends Stmt, @importequalsdeclaration {
|
||||
Expr getImportedEntity() {
|
||||
result = getChildExpr(1)
|
||||
}
|
||||
|
||||
override ControlFlowNode getFirstControlFlowNode() {
|
||||
result = getId()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import * as Something from 'somewhere';
|
||||
|
||||
export import importExport = Something.thingy;
|
||||
@@ -0,0 +1,5 @@
|
||||
import { importExport } from "./export_import";
|
||||
|
||||
function test() {
|
||||
let f = importExport.prop; // OK
|
||||
}
|
||||
Reference in New Issue
Block a user