File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15929,12 +15929,16 @@ namespace ts {
1592915929 checkAssignmentOperator(rightType);
1593015930 return getRegularTypeOfObjectLiteral(rightType);
1593115931 case SyntaxKind.CommaToken:
15932- if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && right.text!=="eval" ) {
15932+ if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right) ) {
1593315933 error(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
1593415934 }
1593515935 return rightType;
1593615936 }
1593715937
15938+ function isEvalNode(node: Expression) {
15939+ return node.kind === SyntaxKind.Identifier && (node as Identifier).text === "eval";
15940+ }
15941+
1593815942 // Return true if there was no error, false if there was an error.
1593915943 function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean {
1594015944 const offendingSymbolOperand =
Original file line number Diff line number Diff line change 1- ( 0 , eval ) ( "10" ) ;
1+ ( 0 , eval ) ( "10" ) ; // fine: special case for eval
22
3- ( 0 , alert ) ( "10" ) ;
3+ ( 0 , alert ) ( "10" ) ; // error: no side effect left of comma (suspect of missing method name or something)
You can’t perform that action at this time.
0 commit comments