Skip to content

Commit a848929

Browse files
committed
Regenerate QLL library
1 parent 0d93543 commit a848929

File tree

2 files changed

+93
-52
lines changed

2 files changed

+93
-52
lines changed

ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ module Ruby {
5050

5151
class UnderscoreArg extends @ruby_underscore_arg, AstNode { }
5252

53+
class UnderscoreCallOperator extends @ruby_underscore_call_operator, AstNode { }
54+
5355
class UnderscoreExpression extends @ruby_underscore_expression, AstNode { }
5456

5557
class UnderscoreLhs extends @ruby_underscore_lhs, AstNode { }
@@ -238,7 +240,7 @@ module Ruby {
238240
final override string getAPrimaryQlClass() { result = "Binary" }
239241

240242
/** Gets the node corresponding to the field `left`. */
241-
final UnderscoreExpression getLeft() { ruby_binary_def(this, result, _, _) }
243+
final AstNode getLeft() { ruby_binary_def(this, result, _, _) }
242244

243245
/** Gets the node corresponding to the field `operator`. */
244246
final string getOperator() {
@@ -350,11 +352,16 @@ module Ruby {
350352
/** Gets the name of the primary QL class for this element. */
351353
final override string getAPrimaryQlClass() { result = "BlockParameters" }
352354

355+
/** Gets the node corresponding to the field `locals`. */
356+
final Identifier getLocals(int i) { ruby_block_parameters_locals(this, i, result) }
357+
353358
/** Gets the `i`th child of this node. */
354359
final AstNode getChild(int i) { ruby_block_parameters_child(this, i, result) }
355360

356361
/** Gets a field or child node of this node. */
357-
final override AstNode getAFieldOrChild() { ruby_block_parameters_child(this, _, result) }
362+
final override AstNode getAFieldOrChild() {
363+
ruby_block_parameters_locals(this, _, result) or ruby_block_parameters_child(this, _, result)
364+
}
358365
}
359366

360367
/** A class representing `break` nodes. */
@@ -381,16 +388,20 @@ module Ruby {
381388
final AstNode getBlock() { ruby_call_block(this, result) }
382389

383390
/** Gets the node corresponding to the field `method`. */
384-
final AstNode getMethod() { ruby_call_def(this, result) }
391+
final AstNode getMethod() { ruby_call_method(this, result) }
392+
393+
/** Gets the node corresponding to the field `operator`. */
394+
final UnderscoreCallOperator getOperator() { ruby_call_operator(this, result) }
385395

386396
/** Gets the node corresponding to the field `receiver`. */
387-
final AstNode getReceiver() { ruby_call_receiver(this, result) }
397+
final UnderscorePrimary getReceiver() { ruby_call_receiver(this, result) }
388398

389399
/** Gets a field or child node of this node. */
390400
final override AstNode getAFieldOrChild() {
391401
ruby_call_arguments(this, result) or
392402
ruby_call_block(this, result) or
393-
ruby_call_def(this, result) or
403+
ruby_call_method(this, result) or
404+
ruby_call_operator(this, result) or
394405
ruby_call_receiver(this, result)
395406
}
396407
}
@@ -486,10 +497,16 @@ module Ruby {
486497
final override string getAPrimaryQlClass() { result = "Comment" }
487498
}
488499

489-
/** A class representing `complex` tokens. */
490-
class Complex extends @ruby_token_complex, Token {
500+
/** A class representing `complex` nodes. */
501+
class Complex extends @ruby_complex, AstNode {
491502
/** Gets the name of the primary QL class for this element. */
492503
final override string getAPrimaryQlClass() { result = "Complex" }
504+
505+
/** Gets the child of this node. */
506+
final AstNode getChild() { ruby_complex_def(this, result) }
507+
508+
/** Gets a field or child node of this node. */
509+
final override AstNode getAFieldOrChild() { ruby_complex_def(this, result) }
493510
}
494511

495512
/** A class representing `conditional` nodes. */
@@ -1199,7 +1216,7 @@ module Ruby {
11991216
}
12001217

12011218
/** Gets the node corresponding to the field `right`. */
1202-
final UnderscoreExpression getRight() { ruby_operator_assignment_def(this, _, _, result) }
1219+
final AstNode getRight() { ruby_operator_assignment_def(this, _, _, result) }
12031220

12041221
/** Gets a field or child node of this node. */
12051222
final override AstNode getAFieldOrChild() {
@@ -1447,7 +1464,7 @@ module Ruby {
14471464
final override string getAPrimaryQlClass() { result = "ScopeResolution" }
14481465

14491466
/** Gets the node corresponding to the field `name`. */
1450-
final AstNode getName() { ruby_scope_resolution_def(this, result) }
1467+
final Constant getName() { ruby_scope_resolution_def(this, result) }
14511468

14521469
/** Gets the node corresponding to the field `scope`. */
14531470
final AstNode getScope() { ruby_scope_resolution_scope(this, result) }

ruby/ql/lib/ruby.dbscheme

Lines changed: 67 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ case @diagnostic.severity of
5252

5353
@ruby_underscore_arg = @ruby_assignment | @ruby_binary | @ruby_conditional | @ruby_operator_assignment | @ruby_range | @ruby_unary | @ruby_underscore_primary
5454

55+
@ruby_underscore_call_operator = @ruby_reserved_word
56+
5557
@ruby_underscore_expression = @ruby_assignment | @ruby_binary | @ruby_break | @ruby_call | @ruby_next | @ruby_operator_assignment | @ruby_return | @ruby_unary | @ruby_underscore_arg | @ruby_yield
5658

5759
@ruby_underscore_lhs = @ruby_call | @ruby_element_reference | @ruby_scope_resolution | @ruby_token_false | @ruby_token_nil | @ruby_token_true | @ruby_underscore_variable
@@ -66,13 +68,13 @@ case @diagnostic.severity of
6668

6769
@ruby_underscore_pattern_expr_basic = @ruby_array_pattern | @ruby_expression_reference_pattern | @ruby_find_pattern | @ruby_hash_pattern | @ruby_parenthesized_pattern | @ruby_range | @ruby_token_identifier | @ruby_underscore_pattern_constant | @ruby_underscore_pattern_primitive | @ruby_variable_reference_pattern
6870

69-
@ruby_underscore_pattern_primitive = @ruby_delimited_symbol | @ruby_lambda | @ruby_regex | @ruby_string__ | @ruby_string_array | @ruby_symbol_array | @ruby_token_encoding | @ruby_token_false | @ruby_token_file | @ruby_token_line | @ruby_token_nil | @ruby_token_self | @ruby_token_simple_symbol | @ruby_token_true | @ruby_unary | @ruby_underscore_simple_numeric
71+
@ruby_underscore_pattern_primitive = @ruby_delimited_symbol | @ruby_lambda | @ruby_regex | @ruby_string__ | @ruby_string_array | @ruby_subshell | @ruby_symbol_array | @ruby_token_encoding | @ruby_token_false | @ruby_token_file | @ruby_token_heredoc_beginning | @ruby_token_line | @ruby_token_nil | @ruby_token_self | @ruby_token_simple_symbol | @ruby_token_true | @ruby_unary | @ruby_underscore_simple_numeric
7072

7173
@ruby_underscore_pattern_top_expr_body = @ruby_array_pattern | @ruby_find_pattern | @ruby_hash_pattern | @ruby_underscore_pattern_expr
7274

73-
@ruby_underscore_primary = @ruby_array | @ruby_begin | @ruby_break | @ruby_case__ | @ruby_case_match | @ruby_chained_string | @ruby_class | @ruby_delimited_symbol | @ruby_for | @ruby_hash | @ruby_if | @ruby_lambda | @ruby_method | @ruby_module | @ruby_next | @ruby_parenthesized_statements | @ruby_redo | @ruby_regex | @ruby_retry | @ruby_return | @ruby_singleton_class | @ruby_singleton_method | @ruby_string__ | @ruby_string_array | @ruby_subshell | @ruby_symbol_array | @ruby_token_character | @ruby_token_heredoc_beginning | @ruby_token_simple_symbol | @ruby_unary | @ruby_underscore_lhs | @ruby_underscore_simple_numeric | @ruby_unless | @ruby_until | @ruby_while | @ruby_yield
75+
@ruby_underscore_primary = @ruby_array | @ruby_begin | @ruby_break | @ruby_call | @ruby_case__ | @ruby_case_match | @ruby_chained_string | @ruby_class | @ruby_delimited_symbol | @ruby_for | @ruby_hash | @ruby_if | @ruby_lambda | @ruby_method | @ruby_module | @ruby_next | @ruby_parenthesized_statements | @ruby_redo | @ruby_regex | @ruby_retry | @ruby_return | @ruby_singleton_class | @ruby_singleton_method | @ruby_string__ | @ruby_string_array | @ruby_subshell | @ruby_symbol_array | @ruby_token_character | @ruby_token_heredoc_beginning | @ruby_token_simple_symbol | @ruby_unary | @ruby_underscore_lhs | @ruby_underscore_simple_numeric | @ruby_unless | @ruby_until | @ruby_while | @ruby_yield
7476

75-
@ruby_underscore_simple_numeric = @ruby_rational | @ruby_token_complex | @ruby_token_float | @ruby_token_integer
77+
@ruby_underscore_simple_numeric = @ruby_complex | @ruby_rational | @ruby_token_float | @ruby_token_integer
7678

7779
@ruby_underscore_statement = @ruby_alias | @ruby_begin_block | @ruby_end_block | @ruby_if_modifier | @ruby_rescue_modifier | @ruby_undef | @ruby_underscore_expression | @ruby_unless_modifier | @ruby_until_modifier | @ruby_while_modifier
7880

@@ -147,7 +149,7 @@ ruby_as_pattern_def(
147149

148150
@ruby_assignment_left_type = @ruby_left_assignment_list | @ruby_underscore_lhs
149151

150-
@ruby_assignment_right_type = @ruby_right_assignment_list | @ruby_splat_argument | @ruby_underscore_expression
152+
@ruby_assignment_right_type = @ruby_rescue_modifier | @ruby_right_assignment_list | @ruby_splat_argument | @ruby_underscore_expression
151153

152154
ruby_assignment_def(
153155
unique int id: @ruby_assignment,
@@ -207,6 +209,8 @@ ruby_begin_block_def(
207209
unique int id: @ruby_begin_block
208210
);
209211

212+
@ruby_binary_left_type = @ruby_underscore_expression | @ruby_underscore_simple_numeric
213+
210214
case @ruby_binary.operator of
211215
0 = @ruby_binary_bangequal
212216
| 1 = @ruby_binary_bangtilde
@@ -238,7 +242,7 @@ case @ruby_binary.operator of
238242

239243
ruby_binary_def(
240244
unique int id: @ruby_binary,
241-
int left: @ruby_underscore_expression ref,
245+
int left: @ruby_binary_left_type ref,
242246
int operator: int ref,
243247
int right: @ruby_underscore_expression ref
244248
);
@@ -279,6 +283,13 @@ ruby_block_parameter_def(
279283
unique int id: @ruby_block_parameter
280284
);
281285

286+
#keyset[ruby_block_parameters, index]
287+
ruby_block_parameters_locals(
288+
int ruby_block_parameters: @ruby_block_parameters ref,
289+
int index: int ref,
290+
unique int locals: @ruby_token_identifier ref
291+
);
292+
282293
@ruby_block_parameters_child_type = @ruby_block_parameter | @ruby_destructured_parameter | @ruby_hash_splat_parameter | @ruby_keyword_parameter | @ruby_optional_parameter | @ruby_splat_parameter | @ruby_token_forward_parameter | @ruby_token_hash_splat_nil | @ruby_token_identifier
283294

284295
#keyset[ruby_block_parameters, index]
@@ -313,18 +324,25 @@ ruby_call_block(
313324
unique int block: @ruby_call_block_type ref
314325
);
315326

316-
@ruby_call_method_type = @ruby_argument_list | @ruby_scope_resolution | @ruby_token_operator | @ruby_underscore_variable
327+
@ruby_call_method_type = @ruby_token_operator | @ruby_underscore_variable
328+
329+
ruby_call_method(
330+
unique int ruby_call: @ruby_call ref,
331+
unique int method: @ruby_call_method_type ref
332+
);
317333

318-
@ruby_call_receiver_type = @ruby_call | @ruby_underscore_primary
334+
ruby_call_operator(
335+
unique int ruby_call: @ruby_call ref,
336+
unique int operator: @ruby_underscore_call_operator ref
337+
);
319338

320339
ruby_call_receiver(
321340
unique int ruby_call: @ruby_call ref,
322-
unique int receiver: @ruby_call_receiver_type ref
341+
unique int receiver: @ruby_underscore_primary ref
323342
);
324343

325344
ruby_call_def(
326-
unique int id: @ruby_call,
327-
int method: @ruby_call_method_type ref
345+
unique int id: @ruby_call
328346
);
329347

330348
ruby_case_value(
@@ -394,6 +412,13 @@ ruby_class_def(
394412
int name: @ruby_class_name_type ref
395413
);
396414

415+
@ruby_complex_child_type = @ruby_rational | @ruby_token_float | @ruby_token_integer
416+
417+
ruby_complex_def(
418+
unique int id: @ruby_complex,
419+
int child: @ruby_complex_child_type ref
420+
);
421+
397422
ruby_conditional_def(
398423
unique int id: @ruby_conditional,
399424
int alternative: @ruby_underscore_arg ref,
@@ -846,11 +871,13 @@ case @ruby_operator_assignment.operator of
846871
;
847872

848873

874+
@ruby_operator_assignment_right_type = @ruby_rescue_modifier | @ruby_underscore_expression
875+
849876
ruby_operator_assignment_def(
850877
unique int id: @ruby_operator_assignment,
851878
int left: @ruby_underscore_lhs ref,
852879
int operator: int ref,
853-
int right: @ruby_underscore_expression ref
880+
int right: @ruby_operator_assignment_right_type ref
854881
);
855882

856883
ruby_optional_parameter_def(
@@ -1030,8 +1057,6 @@ ruby_right_assignment_list_def(
10301057
unique int id: @ruby_right_assignment_list
10311058
);
10321059

1033-
@ruby_scope_resolution_name_type = @ruby_token_constant | @ruby_token_identifier
1034-
10351060
@ruby_scope_resolution_scope_type = @ruby_underscore_pattern_constant | @ruby_underscore_primary
10361061

10371062
ruby_scope_resolution_scope(
@@ -1041,7 +1066,7 @@ ruby_scope_resolution_scope(
10411066

10421067
ruby_scope_resolution_def(
10431068
unique int id: @ruby_scope_resolution,
1044-
int name: @ruby_scope_resolution_name_type ref
1069+
int name: @ruby_token_constant ref
10451070
);
10461071

10471072
ruby_setter_def(
@@ -1289,38 +1314,37 @@ case @ruby_token.kind of
12891314
| 1 = @ruby_token_character
12901315
| 2 = @ruby_token_class_variable
12911316
| 3 = @ruby_token_comment
1292-
| 4 = @ruby_token_complex
1293-
| 5 = @ruby_token_constant
1294-
| 6 = @ruby_token_empty_statement
1295-
| 7 = @ruby_token_encoding
1296-
| 8 = @ruby_token_escape_sequence
1297-
| 9 = @ruby_token_false
1298-
| 10 = @ruby_token_file
1299-
| 11 = @ruby_token_float
1300-
| 12 = @ruby_token_forward_argument
1301-
| 13 = @ruby_token_forward_parameter
1302-
| 14 = @ruby_token_global_variable
1303-
| 15 = @ruby_token_hash_key_symbol
1304-
| 16 = @ruby_token_hash_splat_nil
1305-
| 17 = @ruby_token_heredoc_beginning
1306-
| 18 = @ruby_token_heredoc_content
1307-
| 19 = @ruby_token_heredoc_end
1308-
| 20 = @ruby_token_identifier
1309-
| 21 = @ruby_token_instance_variable
1310-
| 22 = @ruby_token_integer
1311-
| 23 = @ruby_token_line
1312-
| 24 = @ruby_token_nil
1313-
| 25 = @ruby_token_operator
1314-
| 26 = @ruby_token_self
1315-
| 27 = @ruby_token_simple_symbol
1316-
| 28 = @ruby_token_string_content
1317-
| 29 = @ruby_token_super
1318-
| 30 = @ruby_token_true
1319-
| 31 = @ruby_token_uninterpreted
1317+
| 4 = @ruby_token_constant
1318+
| 5 = @ruby_token_empty_statement
1319+
| 6 = @ruby_token_encoding
1320+
| 7 = @ruby_token_escape_sequence
1321+
| 8 = @ruby_token_false
1322+
| 9 = @ruby_token_file
1323+
| 10 = @ruby_token_float
1324+
| 11 = @ruby_token_forward_argument
1325+
| 12 = @ruby_token_forward_parameter
1326+
| 13 = @ruby_token_global_variable
1327+
| 14 = @ruby_token_hash_key_symbol
1328+
| 15 = @ruby_token_hash_splat_nil
1329+
| 16 = @ruby_token_heredoc_beginning
1330+
| 17 = @ruby_token_heredoc_content
1331+
| 18 = @ruby_token_heredoc_end
1332+
| 19 = @ruby_token_identifier
1333+
| 20 = @ruby_token_instance_variable
1334+
| 21 = @ruby_token_integer
1335+
| 22 = @ruby_token_line
1336+
| 23 = @ruby_token_nil
1337+
| 24 = @ruby_token_operator
1338+
| 25 = @ruby_token_self
1339+
| 26 = @ruby_token_simple_symbol
1340+
| 27 = @ruby_token_string_content
1341+
| 28 = @ruby_token_super
1342+
| 29 = @ruby_token_true
1343+
| 30 = @ruby_token_uninterpreted
13201344
;
13211345

13221346

1323-
@ruby_ast_node = @ruby_alias | @ruby_alternative_pattern | @ruby_argument_list | @ruby_array | @ruby_array_pattern | @ruby_as_pattern | @ruby_assignment | @ruby_bare_string | @ruby_bare_symbol | @ruby_begin | @ruby_begin_block | @ruby_binary | @ruby_block | @ruby_block_argument | @ruby_block_parameter | @ruby_block_parameters | @ruby_break | @ruby_call | @ruby_case__ | @ruby_case_match | @ruby_chained_string | @ruby_class | @ruby_conditional | @ruby_delimited_symbol | @ruby_destructured_left_assignment | @ruby_destructured_parameter | @ruby_do | @ruby_do_block | @ruby_element_reference | @ruby_else | @ruby_elsif | @ruby_end_block | @ruby_ensure | @ruby_exception_variable | @ruby_exceptions | @ruby_expression_reference_pattern | @ruby_find_pattern | @ruby_for | @ruby_hash | @ruby_hash_pattern | @ruby_hash_splat_argument | @ruby_hash_splat_parameter | @ruby_heredoc_body | @ruby_if | @ruby_if_guard | @ruby_if_modifier | @ruby_in | @ruby_in_clause | @ruby_interpolation | @ruby_keyword_parameter | @ruby_keyword_pattern | @ruby_lambda | @ruby_lambda_parameters | @ruby_left_assignment_list | @ruby_method | @ruby_method_parameters | @ruby_module | @ruby_next | @ruby_operator_assignment | @ruby_optional_parameter | @ruby_pair | @ruby_parenthesized_pattern | @ruby_parenthesized_statements | @ruby_pattern | @ruby_program | @ruby_range | @ruby_rational | @ruby_redo | @ruby_regex | @ruby_rescue | @ruby_rescue_modifier | @ruby_rest_assignment | @ruby_retry | @ruby_return | @ruby_right_assignment_list | @ruby_scope_resolution | @ruby_setter | @ruby_singleton_class | @ruby_singleton_method | @ruby_splat_argument | @ruby_splat_parameter | @ruby_string__ | @ruby_string_array | @ruby_subshell | @ruby_superclass | @ruby_symbol_array | @ruby_then | @ruby_token | @ruby_unary | @ruby_undef | @ruby_unless | @ruby_unless_guard | @ruby_unless_modifier | @ruby_until | @ruby_until_modifier | @ruby_variable_reference_pattern | @ruby_when | @ruby_while | @ruby_while_modifier | @ruby_yield
1347+
@ruby_ast_node = @ruby_alias | @ruby_alternative_pattern | @ruby_argument_list | @ruby_array | @ruby_array_pattern | @ruby_as_pattern | @ruby_assignment | @ruby_bare_string | @ruby_bare_symbol | @ruby_begin | @ruby_begin_block | @ruby_binary | @ruby_block | @ruby_block_argument | @ruby_block_parameter | @ruby_block_parameters | @ruby_break | @ruby_call | @ruby_case__ | @ruby_case_match | @ruby_chained_string | @ruby_class | @ruby_complex | @ruby_conditional | @ruby_delimited_symbol | @ruby_destructured_left_assignment | @ruby_destructured_parameter | @ruby_do | @ruby_do_block | @ruby_element_reference | @ruby_else | @ruby_elsif | @ruby_end_block | @ruby_ensure | @ruby_exception_variable | @ruby_exceptions | @ruby_expression_reference_pattern | @ruby_find_pattern | @ruby_for | @ruby_hash | @ruby_hash_pattern | @ruby_hash_splat_argument | @ruby_hash_splat_parameter | @ruby_heredoc_body | @ruby_if | @ruby_if_guard | @ruby_if_modifier | @ruby_in | @ruby_in_clause | @ruby_interpolation | @ruby_keyword_parameter | @ruby_keyword_pattern | @ruby_lambda | @ruby_lambda_parameters | @ruby_left_assignment_list | @ruby_method | @ruby_method_parameters | @ruby_module | @ruby_next | @ruby_operator_assignment | @ruby_optional_parameter | @ruby_pair | @ruby_parenthesized_pattern | @ruby_parenthesized_statements | @ruby_pattern | @ruby_program | @ruby_range | @ruby_rational | @ruby_redo | @ruby_regex | @ruby_rescue | @ruby_rescue_modifier | @ruby_rest_assignment | @ruby_retry | @ruby_return | @ruby_right_assignment_list | @ruby_scope_resolution | @ruby_setter | @ruby_singleton_class | @ruby_singleton_method | @ruby_splat_argument | @ruby_splat_parameter | @ruby_string__ | @ruby_string_array | @ruby_subshell | @ruby_superclass | @ruby_symbol_array | @ruby_then | @ruby_token | @ruby_unary | @ruby_undef | @ruby_unless | @ruby_unless_guard | @ruby_unless_modifier | @ruby_until | @ruby_until_modifier | @ruby_variable_reference_pattern | @ruby_when | @ruby_while | @ruby_while_modifier | @ruby_yield
13241348

13251349
@ruby_ast_node_parent = @file | @ruby_ast_node
13261350

0 commit comments

Comments
 (0)