File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -15929,12 +15929,16 @@ namespace ts {
15929
15929
checkAssignmentOperator(rightType);
15930
15930
return getRegularTypeOfObjectLiteral(rightType);
15931
15931
case SyntaxKind.CommaToken:
15932
- if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && right.text!=="eval" ) {
15932
+ if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right) ) {
15933
15933
error(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
15934
15934
}
15935
15935
return rightType;
15936
15936
}
15937
15937
15938
+ function isEvalNode(node: Expression) {
15939
+ return node.kind === SyntaxKind.Identifier && (node as Identifier).text === "eval";
15940
+ }
15941
+
15938
15942
// Return true if there was no error, false if there was an error.
15939
15943
function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean {
15940
15944
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
2
2
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