mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
JavaScript: Make AMD dependencies Imports.
This commit is contained in:
@@ -196,6 +196,23 @@ private predicate amdModuleTopLevel(AMDModuleDefinition def, TopLevel tl) {
|
||||
not def.getParent+() instanceof AMDModuleDefinition
|
||||
}
|
||||
|
||||
/**
|
||||
* An AMD dependency, viewed as an import.
|
||||
*/
|
||||
private class AmdDependencyImport extends Import {
|
||||
AmdDependencyImport() {
|
||||
this = any(AMDModuleDefinition def).getADependency()
|
||||
}
|
||||
|
||||
override Module getEnclosingModule() {
|
||||
this = result.(AMDModule).getDefine().getADependency()
|
||||
}
|
||||
|
||||
override PathExpr getImportedPath() {
|
||||
result = this
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An AMD-style module.
|
||||
*/
|
||||
|
||||
@@ -92,8 +92,8 @@ abstract class Module extends TopLevel {
|
||||
}
|
||||
|
||||
/**
|
||||
* An import in a module, which may either be an ECMAScript 2015-style
|
||||
* `import` statement or a CommonJS-style `require` import.
|
||||
* An import in a module, which may be an ECMAScript 2015-style
|
||||
* `import` statement, a CommonJS-style `require` import, or an AMD dependency.
|
||||
*/
|
||||
abstract class Import extends ASTNode {
|
||||
/** Gets the module in which this import appears. */
|
||||
|
||||
Reference in New Issue
Block a user