Merge pull request #3832 from asger-semmle/js/typescript-in-html-files3

Approved by erik-krogh
This commit is contained in:
semmle-qlci
2020-07-02 08:30:45 +01:00
committed by GitHub
25 changed files with 595 additions and 157 deletions

View File

@@ -0,0 +1,26 @@
classDeclaration
| test.vue:3:18:5:3 | class M ... er;\\n } |
exprType
| htmlfile.html:4:22:4:24 | foo | () => void |
| htmlfile.html:4:22:4:24 | foo | () => void |
| htmlfile.html:4:33:4:41 | "./other" | any |
| htmlfile.html:5:17:5:22 | result | number[] |
| htmlfile.html:5:26:5:28 | foo | () => void |
| htmlfile.html:5:26:5:30 | foo() | void |
| htmlfile.html:5:26:5:42 | foo() as number[] | number[] |
| other.ts:1:8:1:16 | Component | typeof default in library-tests/TypeScript/EmbeddedInScript/test.vue |
| other.ts:1:23:1:34 | "./test.vue" | any |
| other.ts:3:1:3:15 | new Component() | MyComponent |
| other.ts:3:5:3:13 | Component | typeof default in library-tests/TypeScript/EmbeddedInScript/test.vue |
| other.ts:5:17:5:19 | foo | () => void |
| test.vue:2:15:2:19 | other | typeof library-tests/TypeScript/EmbeddedInScript/other.ts |
| test.vue:2:26:2:34 | "./other" | any |
| test.vue:3:24:3:34 | MyComponent | MyComponent |
| test.vue:4:7:4:7 | x | number |
symbols
| other.ts:1:1:6:0 | <toplevel> | library-tests/TypeScript/EmbeddedInScript/other.ts |
| test.vue:2:3:6:0 | <toplevel> | library-tests/TypeScript/EmbeddedInScript/test.vue |
importTarget
| htmlfile.html:4:13:4:42 | import ... other"; | other.ts:1:1:6:0 | <toplevel> |
| other.ts:1:1:1:35 | import ... t.vue"; | test.vue:2:3:6:0 | <toplevel> |
| test.vue:2:3:2:35 | import ... other"; | other.ts:1:1:6:0 | <toplevel> |

View File

@@ -0,0 +1,9 @@
import javascript
query ClassDefinition classDeclaration() { any() }
query Type exprType(Expr e) { result = e.getType() }
query predicate symbols(Module mod, CanonicalName name) { ast_node_symbol(mod, name) }
query predicate importTarget(Import imprt, Module mod) { imprt.getImportedModule() = mod }

View File

@@ -0,0 +1,8 @@
<html>
<body>
<script type="module" language="typescript">
import { foo } from "./other";
let result = foo() as number[];
</script>
</body>
</html>

View File

@@ -0,0 +1,5 @@
import Component from "./test.vue";
new Component();
export function foo() {};

View File

@@ -0,0 +1,6 @@
<script lang='ts'>
import * as other from "./other";
export default class MyComponent {
x!: number;
}
</script>

View File

@@ -0,0 +1,3 @@
{
"include": ["."]
}