@@ -39,34 +39,32 @@ impl<I: Tokens> Parser<I> {
39
39
pub ( super ) fn parse_assignment_expr ( & mut self ) -> PResult < Box < Expr > > {
40
40
trace_cur ! ( self , parse_assignment_expr) ;
41
41
42
- if self . input . syntax ( ) . typescript ( ) && self . input . syntax ( ) . jsx ( ) {
42
+ if self . input . syntax ( ) . typescript ( ) && is ! ( self , JSXTagStart ) {
43
43
// Note: When the JSX plugin is on, type assertions (`<T> x`) aren't valid
44
44
// syntax.
45
45
46
- if is ! ( self , JSXTagStart ) {
47
- let cur_context = self . input . token_context ( ) . current ( ) ;
48
- debug_assert_eq ! ( cur_context, Some ( TokenContext :: JSXOpeningTag ) ) ;
49
- // Only time j_oTag is pushed is right after j_expr.
46
+ let cur_context = self . input . token_context ( ) . current ( ) ;
47
+ debug_assert_eq ! ( cur_context, Some ( TokenContext :: JSXOpeningTag ) ) ;
48
+ // Only time j_oTag is pushed is right after j_expr.
49
+ debug_assert_eq ! (
50
+ self . input. token_context( ) . 0 [ self . input. token_context( ) . len( ) - 2 ] ,
51
+ TokenContext :: JSXExpr
52
+ ) ;
53
+
54
+ let res = self . try_parse_ts ( |p| p. parse_assignment_expr_base ( ) . map ( Some ) ) ;
55
+ if let Some ( res) = res {
56
+ return Ok ( res) ;
57
+ } else {
50
58
debug_assert_eq ! (
51
- self . input. token_context( ) . 0 [ self . input . token_context ( ) . len ( ) - 2 ] ,
52
- TokenContext :: JSXExpr
59
+ self . input. token_context( ) . current ( ) ,
60
+ Some ( TokenContext :: JSXOpeningTag )
53
61
) ;
54
-
55
- let res = self . try_parse_ts ( |p| p. parse_assignment_expr_base ( ) . map ( Some ) ) ;
56
- if let Some ( res) = res {
57
- return Ok ( res) ;
58
- } else {
59
- debug_assert_eq ! (
60
- self . input. token_context( ) . current( ) ,
61
- Some ( TokenContext :: JSXOpeningTag )
62
- ) ;
63
- self . input . token_context_mut ( ) . pop ( ) ;
64
- debug_assert_eq ! (
65
- self . input. token_context( ) . current( ) ,
66
- Some ( TokenContext :: JSXExpr )
67
- ) ;
68
- self . input . token_context_mut ( ) . pop ( ) ;
69
- }
62
+ self . input . token_context_mut ( ) . pop ( ) ;
63
+ debug_assert_eq ! (
64
+ self . input. token_context( ) . current( ) ,
65
+ Some ( TokenContext :: JSXExpr )
66
+ ) ;
67
+ self . input . token_context_mut ( ) . pop ( ) ;
70
68
}
71
69
}
72
70
@@ -2004,7 +2002,8 @@ impl<I: Tokens> Parser<I> {
2004
2002
}
2005
2003
2006
2004
if is ! ( self , ';' )
2007
- || ( !is ! ( self , '*' )
2005
+ || ( !is ! ( self , '<' )
2006
+ && !is ! ( self , '*' )
2008
2007
&& !is ! ( self , '/' )
2009
2008
&& !is ! ( self , "/=" )
2010
2009
&& !cur ! ( self , false )
0 commit comments