mirror of
https://github.com/github/codeql.git
synced 2026-05-14 11:19:27 +02:00
unified: Add fields to switch_entry
Of note: this involved un-inlining where_clause.
This commit is contained in:
@@ -1078,20 +1078,18 @@ module.exports = grammar({
|
||||
),
|
||||
switch_entry: ($) =>
|
||||
seq(
|
||||
optional($.modifiers),
|
||||
field("modifiers", optional($.modifiers)),
|
||||
choice(
|
||||
seq(
|
||||
"case",
|
||||
seq(
|
||||
$.switch_pattern,
|
||||
optional(seq($.where_keyword, $.expression))
|
||||
),
|
||||
repeat(seq(",", $.switch_pattern))
|
||||
field("pattern", $.switch_pattern),
|
||||
field("where", optional($.where_clause)),
|
||||
repeat(seq(",", field("pattern", $.switch_pattern)))
|
||||
),
|
||||
$.default_keyword
|
||||
field("default", $.default_keyword)
|
||||
),
|
||||
":",
|
||||
$.statements,
|
||||
field("body", $.statements),
|
||||
optional("fallthrough")
|
||||
),
|
||||
switch_pattern: ($) => field("pattern", alias($._binding_pattern_with_expr, $.pattern)),
|
||||
|
||||
@@ -586,7 +586,11 @@ named:
|
||||
suppressed_constraint:
|
||||
suppressed: type_identifier
|
||||
switch_entry:
|
||||
$children+: [default_keyword, expression, modifiers, statements, switch_pattern, where_keyword]
|
||||
body: statements
|
||||
default?: default_keyword
|
||||
modifiers?: modifiers
|
||||
pattern*: switch_pattern
|
||||
where?: where_clause
|
||||
switch_pattern:
|
||||
pattern: pattern
|
||||
switch_statement:
|
||||
|
||||
Reference in New Issue
Block a user