mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
TS: Disable export analysis for type-only exports
This commit is contained in:
@@ -405,10 +405,16 @@ private class AnalyzedClosureGlobalAccessPath extends AnalyzedNode, AnalyzedProp
|
||||
*/
|
||||
private class AnalyzedExportNamespaceSpecifier extends AnalyzedPropertyWrite, DataFlow::ValueNode {
|
||||
override ExportNamespaceSpecifier astNode;
|
||||
ReExportDeclaration decl;
|
||||
|
||||
AnalyzedExportNamespaceSpecifier() {
|
||||
decl = astNode.getExportDeclaration() and
|
||||
not decl.isTypeOnly()
|
||||
}
|
||||
|
||||
override predicate writesValue(AbstractValue baseVal, string propName, AbstractValue value) {
|
||||
baseVal = TAbstractExportsObject(getTopLevel()) and
|
||||
propName = astNode.getExportedName() and
|
||||
value = TAbstractExportsObject(astNode.getExportDeclaration().(ReExportDeclaration).getReExportedModule())
|
||||
value = TAbstractExportsObject(decl.getReExportedModule())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export function f() {}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { ns } from "./importType";
|
||||
|
||||
ns.f(); // Calls local method in 'importType'
|
||||
@@ -0,0 +1,3 @@
|
||||
export type * as ns from "./exportFunction";
|
||||
|
||||
export var ns = { f() {} };
|
||||
@@ -1,7 +1,14 @@
|
||||
getAVarReference
|
||||
| Foo | tst.ts:5:5:5:7 | Foo |
|
||||
| f | exportFunction.ts:1:17:1:17 | f |
|
||||
| ns | importFunction.ts:1:10:1:11 | ns |
|
||||
| ns | importFunction.ts:3:1:3:2 | ns |
|
||||
| ns | importType.ts:3:12:3:13 | ns |
|
||||
getAnExportAccess
|
||||
| Foo | tst.ts:3:15:3:17 | Foo |
|
||||
getATypeDecl
|
||||
| Foo | tst.ts:1:15:1:17 | Foo |
|
||||
| ns | importFunction.ts:1:10:1:11 | ns |
|
||||
| types | tst.ts:7:18:7:22 | types |
|
||||
calls
|
||||
| importFunction.ts:3:1:3:6 | ns.f() | importType.ts:3:19:3:24 | f() {} |
|
||||
|
||||
@@ -11,3 +11,7 @@ query VarRef getAnExportAccess(LocalTypeName t) {
|
||||
query TypeDecl getATypeDecl(LocalTypeName t) {
|
||||
result = t.getADeclaration()
|
||||
}
|
||||
|
||||
query Function calls(DataFlow::InvokeNode invoke) {
|
||||
result = invoke.getACallee()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user