Skip to content
Snippets Groups Projects
Commit 815913a9 authored by Ross Kirsling's avatar Ross Kirsling Committed by Rick Waldron
Browse files

Test update for proposed Annex B.3.5 simplification

parent 9345023d
No related branches found
No related tags found
No related merge requests found
...@@ -9,16 +9,12 @@ info: | ...@@ -9,16 +9,12 @@ info: |
This modified behaviour also applies to var and function declarations This modified behaviour also applies to var and function declarations
introduced by direct evals contained within the Block of a Catch clause. introduced by direct evals contained within the Block of a Catch clause.
This change is accomplished by modify the algorithm of 18.2.1.2 as follows: This change is accomplished by modifying the algorithm of 18.2.1.3 as follows:
Step 5.d.ii.2.a.i is replaced by: Step 5.d.ii.2.a.i is replaced by:
i. If thisEnvRec is not the Environment Record for a Catch clause, throw a i. If thisEnvRec is not the Environment Record for a Catch clause, throw a
SyntaxError exception. SyntaxError exception.
ii. If name is bound by any syntactic form other than a
FunctionDeclaration, a VariableStatement, the VariableDeclarationList
of a for statement, or the ForBinding of a for-in statement, throw a
SyntaxError exception.
flags: [noStrict] flags: [noStrict]
---*/ ---*/
...@@ -26,7 +22,12 @@ try { ...@@ -26,7 +22,12 @@ try {
throw null; throw null;
} catch (err) { } catch (err) {
eval('function err() {}'); eval('function err() {}');
eval('function* err() {}');
eval('async function err() {}');
eval('async function* err() {}');
eval('var err;'); eval('var err;');
eval('for (var err; false; ) {}'); eval('for (var err; false; ) {}');
eval('for (var err in []) {}'); eval('for (var err in []) {}');
eval('for (var err of []) {}');
} }
...@@ -6,9 +6,8 @@ es6id: B.3.5 ...@@ -6,9 +6,8 @@ es6id: B.3.5
description: Re-declaration of catch parameter (for-in statement) description: Re-declaration of catch parameter (for-in statement)
info: | info: |
It is a Syntax Error if any element of the BoundNames of CatchParameter It is a Syntax Error if any element of the BoundNames of CatchParameter
also occurs in the VarDeclaredNames of Block, unless that element is only also occurs in the VarDeclaredNames of Block, unless CatchParameter is
bound by a VariableStatement or the VariableDeclarationList of a for CatchParameter : BindingIdentifier.
statement, or the ForBinding of a for-in statement.
---*/ ---*/
var before, during, after; var before, during, after;
......
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variablestatements-in-catch-blocks
es6id: B.3.5
description: Re-declaration of catch parameter (for-of statement)
info: |
It is a Syntax Error if any element of the BoundNames of CatchParameter
also occurs in the VarDeclaredNames of Block, unless CatchParameter is
CatchParameter : BindingIdentifier.
---*/
var before, during, after;
try {
throw 'exception';
} catch (err) {
before = err;
for (var err of [2]) {
during = err;
}
after = err;
}
assert.sameValue(before, 'exception');
assert.sameValue(during, 2, 'during loop body evaluation');
assert.sameValue(after, 2, 'after loop body evaluation');
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
/*--- /*---
esid: sec-variablestatements-in-catch-blocks esid: sec-variablestatements-in-catch-blocks
es6id: B.3.5 es6id: B.3.5
description: Re-declaration of catch parameter (for-in statement) description: Re-declaration of catch parameter (for statement)
info: | info: |
It is a Syntax Error if any element of the BoundNames of CatchParameter It is a Syntax Error if any element of the BoundNames of CatchParameter
also occurs in the VarDeclaredNames of Block, unless that element is only also occurs in the VarDeclaredNames of Block, unless CatchParameter is
bound by a VariableStatement or the VariableDeclarationList of a for CatchParameter : BindingIdentifier.
statement, or the ForBinding of a for-in statement.
---*/ ---*/
var before, during, after; var before, during, after;
......
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-evaldeclarationinstantiation
es6id: 18.2.1.2
description: Variable collision with lexical binding in lower scope
info: |
Annex B extensions permit re-declarations from FunctionDeclaration,
VariableStatement, the VariableDeclarationList of a for statement, and the
ForBinding of a for-in statement. Bindings from the ForBinding of a for-of
statement are restricted regardless of the application of Annex B.
flags: [noStrict]
---*/
assert.throws(SyntaxError, function() {
try {
throw null;
} catch (err) {
eval('for (var err of []) {}');
}
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment