Rename DynamicImportExpr::getImport{Attributes => Options}

This commit is contained in:
Arthur Baars 2023-10-11 19:29:33 +02:00
Родитель 1f4fcf1f31
Коммит a9a21aa313
3 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -2828,7 +2828,18 @@ class DynamicImportExpr extends @dynamic_import, Expr, Import {
* import('foo', { with: { type: "json" }})
* ```
*/
Expr getImportAttributes() { result = this.getChildExpr(1) }
Expr getImportOptions() { result = this.getChildExpr(1) }
/**
* DEPRECATED: use `getImportOptions` instead.
* Gets the second "argument" to the import expression, that is, the `Y` in `import(X, Y)`.
*
* For example, gets the `{ with: { type: "json" }}` expression in the following:
* ```js
* import('foo', { with: { type: "json" }})
* ```
*/
deprecated Expr getImportAttributes() { result = this.getImportOptions() }
override Module getEnclosingModule() { result = this.getTopLevel() }

Просмотреть файл

@ -21,7 +21,7 @@ getImportAttributesFromExport
| ts-import-assertions.ts:8:1:8:52 | export ... son" }; | ts-import-assertions.ts:8:36:8:51 | { type: "json" } |
| ts-import-assertions.ts:9:1:9:47 | export ... son" }; | ts-import-assertions.ts:9:31:9:46 | { type: "json" } |
| ts-import-assertions.ts:10:1:10:53 | export ... son" }; | ts-import-assertions.ts:10:37:10:52 | { type: "json" } |
getImportAttributes
getImportOptions
| js-import-assertions.js:10:12:10:55 | import( ... n" } }) | js-import-assertions.js:10:29:10:54 | { with: ... on" } } |
| js-import-assertions.js:24:12:24:57 | import( ... n" } }) | js-import-assertions.js:24:29:24:56 | { asser ... on" } } |
| ts-import-assertions.ts:12:12:12:57 | import( ... n" } }) | ts-import-assertions.ts:12:29:12:56 | { asser ... on" } } |

Просмотреть файл

@ -8,6 +8,6 @@ query Expr getImportAttributesFromExport(ExportDeclaration decl) {
result = decl.getImportAttributes()
}
query Expr getImportAttributes(DynamicImportExpr imprt) { result = imprt.getImportAttributes() }
query Expr getImportOptions(DynamicImportExpr imprt) { result = imprt.getImportOptions() }
query JSParseError errors() { any() }