@@ -437,7 +437,7 @@ impl<'a> ParserImpl<'a> {
437437 pub ( crate ) fn parse_array_expression ( & mut self ) -> Expression < ' a > {
438438 let span = self . start_span ( ) ;
439439 self . expect ( Kind :: LBrack ) ;
440- let ( elements, comma_span) = self . context ( Context :: In , Context :: empty ( ) , |p| {
440+ let ( elements, comma_span) = self . context_add ( Context :: In , |p| {
441441 p. parse_delimited_list ( Kind :: RBrack , Kind :: Comma , Self :: parse_array_expression_element)
442442 } ) ;
443443 if let Some ( comma_span) = comma_span {
@@ -480,7 +480,7 @@ impl<'a> ParserImpl<'a> {
480480
481481 quasis. push ( self . parse_template_element ( tagged) ) ;
482482 // TemplateHead Expression[+In, ?Yield, ?Await]
483- let expr = self . context ( Context :: In , Context :: empty ( ) , Self :: parse_expr) ;
483+ let expr = self . context_add ( Context :: In , Self :: parse_expr) ;
484484 expressions. push ( expr) ;
485485 self . re_lex_template_substitution_tail ( ) ;
486486 while self . fatal_error . is_none ( ) {
@@ -492,8 +492,7 @@ impl<'a> ParserImpl<'a> {
492492 Kind :: TemplateMiddle => {
493493 quasis. push ( self . parse_template_element ( tagged) ) ;
494494 // TemplateMiddle Expression[+In, ?Yield, ?Await]
495- let expr =
496- self . context ( Context :: In , Context :: empty ( ) , Self :: parse_expr) ;
495+ let expr = self . context_add ( Context :: In , Self :: parse_expr) ;
497496 expressions. push ( expr) ;
498497 self . re_lex_template_substitution_tail ( ) ;
499498 }
@@ -840,7 +839,7 @@ impl<'a> ParserImpl<'a> {
840839 optional : bool ,
841840 ) -> Expression < ' a > {
842841 self . bump_any ( ) ; // advance `[`
843- let property = self . context ( Context :: In , Context :: empty ( ) , Self :: parse_expr) ;
842+ let property = self . context_add ( Context :: In , Self :: parse_expr) ;
844843 self . expect ( Kind :: RBrack ) ;
845844 self . ast . member_expression_computed ( self . end_span ( lhs_span) , lhs, property, optional) . into ( )
846845 }
@@ -889,7 +888,7 @@ impl<'a> ParserImpl<'a> {
889888 let arguments = if self . eat ( Kind :: LParen ) {
890889 // ArgumentList[Yield, Await] :
891890 // AssignmentExpression[+In, ?Yield, ?Await]
892- let ( call_arguments, _) = self . context ( Context :: In , Context :: empty ( ) , |p| {
891+ let ( call_arguments, _) = self . context_add ( Context :: In , |p| {
893892 p. parse_delimited_list ( Kind :: RParen , Kind :: Comma , Self :: parse_call_argument)
894893 } ) ;
895894 self . expect ( Kind :: RParen ) ;
@@ -1213,7 +1212,7 @@ impl<'a> ParserImpl<'a> {
12131212 if !self . eat ( Kind :: Question ) {
12141213 return lhs;
12151214 }
1216- let consequent = self . context ( Context :: In , Context :: empty ( ) , |p| {
1215+ let consequent = self . context_add ( Context :: In , |p| {
12171216 p. parse_assignment_expression_or_higher_impl (
12181217 /* allow_return_type_in_arrow_function */ false ,
12191218 )
@@ -1399,9 +1398,8 @@ impl<'a> ParserImpl<'a> {
13991398 self . error ( diagnostics:: await_expression ( self . cur_token ( ) . span ( ) ) ) ;
14001399 }
14011400 self . bump_any ( ) ;
1402- let argument = self . context ( Context :: Await , Context :: empty ( ) , |p| {
1403- p. parse_simple_unary_expression ( lhs_span)
1404- } ) ;
1401+ let argument =
1402+ self . context_add ( Context :: Await , |p| p. parse_simple_unary_expression ( lhs_span) ) ;
14051403 self . ast . expression_await ( self . end_span ( span) , argument)
14061404 }
14071405
@@ -1435,11 +1433,7 @@ impl<'a> ParserImpl<'a> {
14351433 pub ( crate ) fn parse_decorator ( & mut self ) -> Decorator < ' a > {
14361434 let span = self . start_span ( ) ;
14371435 self . bump_any ( ) ; // bump @
1438- let expr = self . context (
1439- Context :: Decorator ,
1440- Context :: empty ( ) ,
1441- Self :: parse_lhs_expression_or_higher,
1442- ) ;
1436+ let expr = self . context_add ( Context :: Decorator , Self :: parse_lhs_expression_or_higher) ;
14431437 self . ast . decorator ( self . end_span ( span) , expr)
14441438 }
14451439
0 commit comments