@@ -78,8 +78,9 @@ module.exports = grammar({
7878 $ . sequence_expression ,
7979 $ . arrow_function ,
8080 ] ,
81+ [ 'new' , $ . primary_expression ] ,
8182 [ 'assign' , $ . primary_expression ] ,
82- [ 'member' , 'template_call' , 'new ' , 'call' , $ . expression ] ,
83+ [ 'member' , 'template_call' , 'new_args ' , 'call' , 'new_no_args ', $ . expression ] ,
8384 [ 'declaration' , 'literal' ] ,
8485 [ $ . primary_expression , $ . statement_block , 'object' ] ,
8586 [ $ . meta_property , $ . import ] ,
@@ -488,12 +489,12 @@ module.exports = grammar({
488489 $ . binary_expression ,
489490 $ . ternary_expression ,
490491 $ . update_expression ,
491- $ . new_expression ,
492492 $ . yield_expression ,
493493 ) ,
494494
495495 primary_expression : $ => choice (
496496 $ . subscript_expression ,
497+ $ . new_expression ,
497498 $ . member_expression ,
498499 $ . parenthesized_expression ,
499500 $ . _identifier ,
@@ -783,11 +784,11 @@ module.exports = grammar({
783784
784785 call_expression : $ => choice (
785786 prec ( 'call' , seq (
786- field ( 'function' , choice ( $ . expression , $ . import ) ) ,
787+ field ( 'function' , choice ( $ . primary_expression , $ . import ) ) ,
787788 field ( 'arguments' , $ . arguments ) ,
788789 ) ) ,
789790 prec ( 'template_call' , seq (
790- field ( 'function' , choice ( $ . primary_expression , $ . new_expression ) ) ,
791+ field ( 'function' , $ . primary_expression ) ,
791792 field ( 'arguments' , $ . template_string ) ,
792793 ) ) ,
793794 prec ( 'member' , seq (
@@ -797,11 +798,17 @@ module.exports = grammar({
797798 ) ) ,
798799 ) ,
799800
800- new_expression : $ => prec . right ( 'new' , seq (
801- 'new' ,
802- field ( 'constructor' , choice ( $ . primary_expression , $ . new_expression ) ) ,
803- field ( 'arguments' , optional ( prec . dynamic ( 1 , $ . arguments ) ) ) ,
804- ) ) ,
801+ new_expression : $ => choice (
802+ prec ( 'new_args' , seq (
803+ 'new' ,
804+ field ( 'constructor' , $ . primary_expression ) ,
805+ field ( 'arguments' , $ . arguments ) ,
806+ ) ) ,
807+ prec ( 'new_no_args' , seq (
808+ 'new' ,
809+ field ( 'constructor' , $ . primary_expression ) ,
810+ ) )
811+ ) ,
805812
806813 await_expression : $ => prec ( 'unary_void' , seq (
807814 'await' ,
0 commit comments