mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
add JS support the using keyword
This commit is contained in:
@@ -246,13 +246,15 @@ private module PrintJavaScript {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets "var" or "const" or "let" depending on what type of declaration `decl` is.
|
||||
* Gets "var" or "const" or "let" or "using" depending on what type of declaration `decl` is.
|
||||
*/
|
||||
private string getDeclarationKeyword(DeclStmt decl) {
|
||||
decl instanceof VarDeclStmt and result = "var"
|
||||
or
|
||||
decl instanceof ConstDeclStmt and result = "const"
|
||||
or
|
||||
decl instanceof UsingDeclStmt and result = "using"
|
||||
or
|
||||
decl instanceof LetStmt and result = "let"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1041,6 +1041,17 @@ class VarDeclStmt extends @var_decl_stmt, DeclStmt { }
|
||||
*/
|
||||
class ConstDeclStmt extends @const_decl_stmt, DeclStmt { }
|
||||
|
||||
/**
|
||||
* A `using` declaration statement.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* using file = new TextFile("file.txt");
|
||||
* ```
|
||||
*/
|
||||
class UsingDeclStmt extends @using_decl_stmt, DeclStmt { }
|
||||
|
||||
/**
|
||||
* A `let` declaration statement.
|
||||
*
|
||||
|
||||
@@ -162,9 +162,10 @@ case @stmt.kind of
|
||||
| 37 = @external_module_declaration
|
||||
| 38 = @export_as_namespace_declaration
|
||||
| 39 = @global_augmentation_declaration
|
||||
| 40 = @using_decl_stmt
|
||||
;
|
||||
|
||||
@decl_stmt = @var_decl_stmt | @const_decl_stmt | @let_stmt | @legacy_let_stmt;
|
||||
@decl_stmt = @var_decl_stmt | @const_decl_stmt | @let_stmt | @legacy_let_stmt | @using_decl_stmt;
|
||||
|
||||
@export_declaration = @export_all_declaration | @export_default_declaration | @export_named_declaration;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user