@@ -712,11 +712,9 @@ where
712
712
fn parse_import_default_specifier ( & mut self ) -> Res < DefaultImportSpec < Cow < ' b , str > > > {
713
713
let start = self . look_ahead_position ;
714
714
let id = self . parse_ident_name ( ) ?;
715
- self . context . lexical_names . declare (
716
- id. slice . source . clone ( ) ,
717
- DeclKind :: Lex ( true ) ,
718
- start,
719
- ) ?;
715
+ self . context
716
+ . lexical_names
717
+ . declare ( id. slice . source . clone ( ) , DeclKind :: Lex ( true ) , start) ?;
720
718
Ok ( DefaultImportSpec { id } )
721
719
}
722
720
@@ -4795,7 +4793,6 @@ where
4795
4793
} ;
4796
4794
elements. push ( ele) ;
4797
4795
}
4798
-
4799
4796
}
4800
4797
}
4801
4798
let close_bracket = self . expect_punct ( Punct :: CloseBracket ) ?;
@@ -5070,7 +5067,7 @@ where
5070
5067
& item,
5071
5068
& [
5072
5069
"=" , "+=" , "-=" , "/=" , "*=" , "**=" , "|=" , "&=" , "~=" , "%=" , "<<=" ,
5073
- ">>=" , ">>>=" ,
5070
+ ">>=" , ">>>=" , "&&=" , "||=" , "??=" ,
5074
5071
] ,
5075
5072
) ;
5076
5073
}
@@ -5080,7 +5077,7 @@ where
5080
5077
& item,
5081
5078
& [
5082
5079
"=" , "+=" , "-=" , "/=" , "*=" , "**=" , "|=" , "&=" , "~=" , "%=" , "<<=" , ">>=" ,
5083
- ">>>=" ,
5080
+ ">>>=" , "&&=" , "||=" , "??=" ,
5084
5081
] ,
5085
5082
) ;
5086
5083
}
@@ -5120,6 +5117,9 @@ where
5120
5117
Punct :: CaretEqual => Some ( AssignOp :: XOrEqual ( slice. into ( ) ) ) ,
5121
5118
Punct :: AmpersandEqual => Some ( AssignOp :: AndEqual ( slice. into ( ) ) ) ,
5122
5119
Punct :: DoubleAsteriskEqual => Some ( AssignOp :: PowerOfEqual ( slice. into ( ) ) ) ,
5120
+ Punct :: DoubleAmpersandEqual => Some ( AssignOp :: DoubleAmpersandEqual ( slice. into ( ) ) ) ,
5121
+ Punct :: DoublePipeEqual => Some ( AssignOp :: DoublePipeEqual ( slice. into ( ) ) ) ,
5122
+ Punct :: DoubleQuestionMarkEqual => Some ( AssignOp :: DoubleQuestionmarkEqual ( slice. into ( ) ) ) ,
5123
5123
_ => None ,
5124
5124
}
5125
5125
}
@@ -5658,6 +5658,7 @@ where
5658
5658
log:: debug!( "left: {:#?} {}" , left, self . context. allow_yield) ;
5659
5659
if op. token . matches_punct ( Punct :: DoubleAmpersand )
5660
5660
|| op. token . matches_punct ( Punct :: DoublePipe )
5661
+ || op. token . matches_punct ( Punct :: DoubleQuestionMark )
5661
5662
{
5662
5663
stack. push ( Expr :: Logical ( LogicalExpr {
5663
5664
operator : self . logical_operator ( & op) . ok_or_else ( || {
@@ -5692,6 +5693,7 @@ where
5692
5693
. ok_or_else ( || self . op_error ( "invalid binary operation, too few operators" ) ) ?;
5693
5694
if op. token . matches_punct ( Punct :: DoubleAmpersand )
5694
5695
|| op. token . matches_punct ( Punct :: DoublePipe )
5696
+ || op. token . matches_punct ( Punct :: DoubleQuestionMark )
5695
5697
{
5696
5698
let operator = self
5697
5699
. logical_operator ( & op)
@@ -5855,6 +5857,7 @@ where
5855
5857
Token :: Punct ( ref p) => match p {
5856
5858
Punct :: DoubleAmpersand => Some ( LogicalOp :: And ( slice. into ( ) ) ) ,
5857
5859
Punct :: DoublePipe => Some ( LogicalOp :: Or ( slice. into ( ) ) ) ,
5860
+ Punct :: DoubleQuestionMark => Some ( LogicalOp :: NullishCoalescing ( slice. into ( ) ) ) ,
5858
5861
_ => None ,
5859
5862
} ,
5860
5863
_ => None ,
@@ -6372,7 +6375,7 @@ where
6372
6375
| Punct :: Comma
6373
6376
| Punct :: Equal
6374
6377
| Punct :: CloseBracket => 0 ,
6375
- Punct :: DoublePipe => 1 ,
6378
+ Punct :: DoublePipe | Punct :: DoubleQuestionMark => 1 ,
6376
6379
Punct :: DoubleAmpersand => 2 ,
6377
6380
Punct :: Pipe => 3 ,
6378
6381
Punct :: Caret => 4 ,
@@ -6668,6 +6671,15 @@ where
6668
6671
|| self . look_ahead . token . matches_punct ( Punct :: PipeEqual )
6669
6672
|| self . look_ahead . token . matches_punct ( Punct :: CaretEqual )
6670
6673
|| self . look_ahead . token . matches_punct ( Punct :: AmpersandEqual )
6674
+ || self
6675
+ . look_ahead
6676
+ . token
6677
+ . matches_punct ( Punct :: DoubleAmpersandEqual )
6678
+ || self . look_ahead . token . matches_punct ( Punct :: DoublePipeEqual )
6679
+ || self
6680
+ . look_ahead
6681
+ . token
6682
+ . matches_punct ( Punct :: DoubleQuestionMarkEqual )
6671
6683
}
6672
6684
/// The keyword `async` is conditional, that means to decided
6673
6685
/// if we are actually at an async function we need to check the
@@ -6763,8 +6775,8 @@ where
6763
6775
let slice = self . scanner . str_for ( & item. span ) . unwrap ( ) ;
6764
6776
let contents = match & item. token {
6765
6777
Token :: String ( lit) => match lit {
6766
- ress:: tokens:: StringLit :: Double ( inner) => inner. content . clone ( ) ,
6767
- ress:: tokens:: StringLit :: Single ( inner) => inner. content . clone ( ) ,
6778
+ ress:: tokens:: StringLit :: Double ( inner) => inner. content ,
6779
+ ress:: tokens:: StringLit :: Single ( inner) => inner. content ,
6768
6780
} ,
6769
6781
_ => {
6770
6782
return Err ( Error :: UnexpectedToken (
@@ -6821,7 +6833,7 @@ where
6821
6833
// regex will be on 1 line if `validate` is successful
6822
6834
let line = item. location . start . line ;
6823
6835
let Token :: RegEx ( token) = & item. token else {
6824
- return self . expected_token_error ( item, & [ "<regex literal>" ] )
6836
+ return self . expected_token_error ( item, & [ "<regex literal>" ] ) ;
6825
6837
} ;
6826
6838
let open_slash_pos = Position {
6827
6839
line : line as u32 ,
0 commit comments