diff --git a/common/define-grammar.js b/common/define-grammar.js index 5c6b30bb..63ebda40 100644 --- a/common/define-grammar.js +++ b/common/define-grammar.js @@ -942,7 +942,11 @@ module.exports = function defineGrammar(dialect) { class_constant_access_expression: $ => seq( $._scope_resolution_qualifier, '::', - choice($.name, alias($._reserved_identifier, $.name)), + choice( + $.name, + alias($._reserved_identifier, $.name), + seq('{', alias($._expression, $.name), '}'), + ), ), print_intrinsic: $ => seq( diff --git a/common/test/corpus/expressions.txt b/common/test/corpus/expressions.txt index 274ad1d1..0edf53fc 100644 --- a/common/test/corpus/expressions.txt +++ b/common/test/corpus/expressions.txt @@ -1543,3 +1543,18 @@ $statement = match ($a) { ) ) +=============================================== +Dynamic class constant access +=============================================== + +