You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MERGE #5568@kfukuda2] Fixing test 262 regression for labels followed by let.
Merge pull request #5568 from kfukuda2:label262FixRS5
Initial labels change is #5482, which caused a test262 regression around labels followed by let and a new line.
assert.throws(()=>eval(strictMode+invalidLabelInStrict+testIfLabelIsValid),SyntaxError,"Expected syntax error in strict mode for future reserved keyword '"+invalidLabelInStrict+"'",strictModeOnlyInvalidLabels[invalidLabelInStrict])
335
-
assert.doesNotThrow(()=>eval(invalidLabelInStrict+testIfLabelIsValid),"Expected no syntax error for future reserved keyword '"+invalidLabelInStrict+" in non-strict mode")
432
+
assert.throws(()=>eval(strictMode+invalidLabelInStrict+testIfLabelIsValid),SyntaxError,"Expected syntax error in strict mode for future reserved keyword '"+invalidLabelInStrict+"'",strictModeOnlyInvalidLabels[invalidLabelInStrict])
433
+
assert.doesNotThrow(()=>eval(invalidLabelInStrict+testIfLabelIsValid),"Expected no syntax error for future reserved keyword '"+invalidLabelInStrict+" in non-strict mode")
336
434
}
337
435
}
338
436
},
@@ -347,6 +445,29 @@ var tests = [
347
445
assert.throws(()=>eval(testInvalidLabelSyntaxArrayAccess),SyntaxError,"Expected syntax error from using malformed label","Expected ';'")
348
446
assert.throws(()=>eval(testInvalidLabelSyntaxFunctionCall),SyntaxError,"Expected syntax error from using malformed label","Expected ';'")
349
447
}
448
+
},
449
+
{
450
+
name : "Label tests, edge cases",
451
+
body : function()
452
+
{
453
+
assert.throws(()=>eval(testRuntimeErrorWithDanglingLetAfterLabel),ReferenceError,"Expected runtime error from using let as identifier","'let' is not defined")
454
+
assert.doesNotThrow(()=>eval(testNoSyntaxErrorWithDanglingLetAfterLabel),"Expected no syntax error from using let as identifier after label")
455
+
assert.throws(()=>eval(testRuntimeErrorWithDanglingLetAfterLabel2),ReferenceError,"Expected runtime error from using let as identifier","'let' is not defined")
456
+
assert.doesNotThrow(()=>eval(testNoSyntaxErrorWithDanglingLetAfterLabel2),"Expected no syntax error from using let as identifier after label")
457
+
assert.throws(()=>eval(testRuntimeErrorWithDanglingLetAfterLabel3),ReferenceError,"Expected runtime error from using let as identifier","'let' is not defined")
458
+
assert.doesNotThrow(()=>eval(testNoSyntaxErrorWithDanglingLetAfterLabel3),"Expected no syntax error from using let as identifier after label")
459
+
assert.throws(()=>eval(testRuntimeErrorWithDanglingLetAfterLabel4),ReferenceError,"Expected runtime error from using let as identifier","'let' is not defined")
460
+
assert.doesNotThrow(()=>eval(testNoSyntaxErrorWithDanglingLetAfterLabel4),"Expected no syntax error from using let as identifier after label")
461
+
assert.doesNotThrow(()=>eval(testNoRuntimeErrorWithDanglingVarAfterLabel),"Expected no syntax error from using var after label")
462
+
assert.throws(()=>eval(testSyntaxErrorWithDanglingConstAfterLabel),SyntaxError,"Expected syntax error from using const after label","Labels not allowed before lexical declaration")
463
+
assert.doesNotThrow(()=>eval(testNoSyntaxErrorWithDanglingYieldAfterLabel),"Expected no syntax error from using yield after label")
464
+
assert.throws(()=>eval(testRuntimeErrorWithDanglingYieldAfterLabel),ReferenceError,"Expected runtime error for undefined reference to yield","'yield' is not defined")
465
+
assert.doesNotThrow(()=>eval(testGeneratorWithDanglingYieldAfterLabel),"Expected no error from using yield after label. Also expect the yield to not be bound to the expression.")
466
+
assert.doesNotThrow(()=>eval(testNoSyntaxErrorWithDanglingAwaitAfterLabel),"Expected no error from using await after label. Also expect the yield to not be bound to the expression.")
467
+
assert.throws(()=>eval(testRuntimeErrorWithDanglingAwaitAfterLabel),ReferenceError,"Expected reference error from stranded await being used after label","'await' is not defined")
468
+
assert.throws(()=>eval(testRuntimeErrorWithDanglingStaticAfterLabel),ReferenceError,"Expected reference error from stranded static being used after label","'static' is not defined")
469
+
assert.doesNotThrow(()=>eval(testNoSyntaxErrorWithDanglingStaticAfterLabel),"Expected no issue parsing since static is viewed as an identifier")
0 commit comments