mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 14:43:33 +03:00
fix(es/parser): Handle more TS2406
errors (#5640)
This commit is contained in:
parent
7a8a172479
commit
838438dc9d
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1 >>>= 2;
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -1 +1,12 @@
|
||||
1 >>>= 2;
|
||||
//!
|
||||
//! x The left-hand side of an assignment expression must be a variable or a property access.
|
||||
//! ,----
|
||||
//! 1 | 1
|
||||
//! : ^
|
||||
//! `----
|
||||
//!
|
||||
//!
|
||||
//!Caused by:
|
||||
//! 0: failed to process input file
|
||||
//! 1: error was recoverable, but proceeding would result in wrong codegen
|
||||
//! 2: Syntax Error
|
||||
|
@ -158,12 +158,14 @@ impl<I: Tokens> Parser<I> {
|
||||
.map(Box::new)
|
||||
.map(PatOrExpr::Pat)?
|
||||
} else {
|
||||
//It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||
// It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||
// LeftHandSideExpression is false.
|
||||
if !self.input.syntax().typescript()
|
||||
&& !cond.is_valid_simple_assignment_target(self.ctx().strict)
|
||||
{
|
||||
self.emit_err(cond.span(), SyntaxError::NotSimpleAssign)
|
||||
if !cond.is_valid_simple_assignment_target(self.ctx().strict) {
|
||||
if self.input.syntax().typescript() {
|
||||
self.emit_err(cond.span(), SyntaxError::TS2406);
|
||||
} else {
|
||||
self.emit_err(cond.span(), SyntaxError::NotSimpleAssign)
|
||||
}
|
||||
}
|
||||
if self.input.syntax().typescript()
|
||||
&& cond
|
||||
|
Loading…
Reference in New Issue
Block a user