refactor: remove interface_type_name and constraint_elem in favor of _simple_type

The _simple_type covers both constraint_term and interface_type_name, no point having both when we can just alias _simple_type to constraint_elem
syntax_id
Amaan Qureshi 2023-05-21 22:54:16 +07:00
parent 4baade3c69
commit 78aa09efac
No known key found for this signature in database
GPG Key ID: E67890ADC4227273
1 changed files with 4 additions and 14 deletions

@ -386,27 +386,17 @@ module.exports = grammar({
),
_interface_body: $ => choice(
$.method_spec, $.interface_type_name, $.constraint_elem, $.struct_elem
$.method_spec,
$.struct_elem,
alias($._simple_type, $.constraint_elem),
),
interface_type_name: $ => choice($._type_identifier, $.qualified_type),
constraint_elem: $ => seq(
$.constraint_term,
repeat(seq('|', $.constraint_term))
),
constraint_term: $ => prec(-1, seq(
optional('~'),
$._type_identifier,
)),
struct_elem: $ => seq(
$.struct_term,
repeat(seq('|', $.struct_term))
),
struct_term: $ => prec(-1, seq(
struct_term: $ => prec(1, seq(
optional(choice('~', '*')),
$.struct_type
)),