From 8c46846b82d0a27f9c33973c78116d510d0fb7e2 Mon Sep 17 00:00:00 2001 From: Taus Date: Mon, 13 Jun 2022 14:27:03 +0000 Subject: [PATCH] Add fields to `ModuleParam` children --- ql/Cargo.lock | 2 +- ql/extractor/Cargo.toml | 2 +- ql/generator/Cargo.toml | 2 +- ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll | 11 ++++++++--- ql/ql/src/ql.dbscheme | 13 +++---------- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/ql/Cargo.lock b/ql/Cargo.lock index b62dec0d390..284806a2576 100644 --- a/ql/Cargo.lock +++ b/ql/Cargo.lock @@ -514,7 +514,7 @@ dependencies = [ [[package]] name = "tree-sitter-ql" version = "0.19.0" -source = "git+https://github.com/tausbn/tree-sitter-ql.git?rev=7928a971a9a408f7ad59876c2ecda4a5329a6795#7928a971a9a408f7ad59876c2ecda4a5329a6795" +source = "git+https://github.com/tausbn/tree-sitter-ql.git?rev=a8e519e676ff6e7aa9c1d0a8a329edefcaac69ae#a8e519e676ff6e7aa9c1d0a8a329edefcaac69ae" dependencies = [ "cc", "tree-sitter", diff --git a/ql/extractor/Cargo.toml b/ql/extractor/Cargo.toml index e403a7d2a2e..8bba4a91aa8 100644 --- a/ql/extractor/Cargo.toml +++ b/ql/extractor/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" flate2 = "1.0" node-types = { path = "../node-types" } tree-sitter = "0.19" -tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "7928a971a9a408f7ad59876c2ecda4a5329a6795" } +tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "a8e519e676ff6e7aa9c1d0a8a329edefcaac69ae" } clap = "2.33" tracing = "0.1" tracing-subscriber = { version = "0.3.3", features = ["env-filter"] } diff --git a/ql/generator/Cargo.toml b/ql/generator/Cargo.toml index f8b1037a78a..b46b6570b5f 100644 --- a/ql/generator/Cargo.toml +++ b/ql/generator/Cargo.toml @@ -11,4 +11,4 @@ clap = "2.33" node-types = { path = "../node-types" } tracing = "0.1" tracing-subscriber = { version = "0.3.3", features = ["env-filter"] } -tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "7928a971a9a408f7ad59876c2ecda4a5329a6795" } +tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "a8e519e676ff6e7aa9c1d0a8a329edefcaac69ae" } diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index a58c45ede07..d90c8110561 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -1035,11 +1035,16 @@ module QL { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ModuleParam" } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_module_param_child(this, i, result) } + /** Gets the node corresponding to the field `parameter`. */ + final SimpleId getParameter() { ql_module_param_def(this, result, _) } + + /** Gets the node corresponding to the field `signature`. */ + final SignatureExpr getSignature() { ql_module_param_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_module_param_child(this, _, result) } + final override AstNode getAFieldOrChild() { + ql_module_param_def(this, result, _) or ql_module_param_def(this, _, result) + } } /** A class representing `mul_expr` nodes. */ diff --git a/ql/ql/src/ql.dbscheme b/ql/ql/src/ql.dbscheme index e6db990a16d..2c80bb99720 100644 --- a/ql/ql/src/ql.dbscheme +++ b/ql/ql/src/ql.dbscheme @@ -679,17 +679,10 @@ ql_module_name_def( int child: @ql_token_simple_id ref ); -@ql_moduleParam_child_type = @ql_signature_expr | @ql_token_simple_id - -#keyset[ql_module_param, index] -ql_module_param_child( - int ql_module_param: @ql_module_param ref, - int index: int ref, - unique int child: @ql_moduleParam_child_type ref -); - ql_module_param_def( - unique int id: @ql_module_param + unique int id: @ql_module_param, + int parameter: @ql_token_simple_id ref, + int signature: @ql_signature_expr ref ); @ql_mul_expr_left_type = @ql_add_expr | @ql_aggregate | @ql_call_or_unqual_agg_expr | @ql_comp_term | @ql_conjunction | @ql_disjunction | @ql_expr_annotation | @ql_if_term | @ql_implication | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_mul_expr | @ql_negation | @ql_par_expr | @ql_prefix_cast | @ql_qualified_expr | @ql_quantified | @ql_range | @ql_set_literal | @ql_special_call | @ql_super_ref | @ql_unary_expr | @ql_variable