mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
* Re-generate tests The test generation tool has been modified in the time since these tests were first generated and committed to the project. Re-generate the tests using the latest version of the tool. * Add test cases for Annex B hoisting disqualifiers The "variable-like" function hoisting semantics defined in Annex B extension B.3.3 is only applied if "[...] replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors [...]". Test262 previously included tests for this condition when the disqualifying early error originated from the ScriptBody and FunctionBody productions. Add test cases to assert the behavior when it is disqualified by all other relevant early errors: Block statements, `for` statements, `for-of` statements, `for-in` statements, and Switch statements. * Generate tests * fixup! Add test cases for Annex B hoisting disqualifiers * fixup! Add test cases for Annex B hoisting disqualifiers Correct test case "info" meta-data. * fixup! Add test cases for Annex B hoisting disqualifiers Improve test bodies * fixup! Generate tests
58 lines
2.0 KiB
JavaScript
58 lines
2.0 KiB
JavaScript
// This file was procedurally generated from the following sources:
|
|
// - src/annex-b-fns/func-no-skip-try.case
|
|
// - src/annex-b-fns/func/if-stmt-else-decl.template
|
|
/*---
|
|
description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in the second statement position in function scope)
|
|
esid: sec-functiondeclarations-in-ifstatement-statement-clauses
|
|
es6id: B.3.4
|
|
flags: [generated, noStrict]
|
|
info: |
|
|
The following rules for IfStatement augment those in 13.6:
|
|
|
|
IfStatement[Yield, Return]:
|
|
if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
|
|
if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
|
|
if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
|
|
if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
|
|
|
|
|
|
B.3.3.1 Changes to FunctionDeclarationInstantiation
|
|
|
|
[...]
|
|
2. If instantiatedVarNames does not contain F, then
|
|
a. Perform ! varEnvRec.CreateMutableBinding(F, false).
|
|
b. Perform varEnvRec.InitializeBinding(F, undefined).
|
|
c. Append F to instantiatedVarNames.
|
|
[...]
|
|
|
|
B.3.5 VariableStatements in Catch Blocks
|
|
|
|
[...]
|
|
- 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 and that element is only bound by a
|
|
VariableStatement, the VariableDeclarationList of a for statement, or the
|
|
ForBinding of a for-in statement.
|
|
---*/
|
|
|
|
(function() {
|
|
assert.sameValue(
|
|
f, undefined, 'Initialized binding created prior to evaluation'
|
|
);
|
|
|
|
try {
|
|
throw null;
|
|
} catch (f) {
|
|
|
|
if (false) ; else function f() { return 123; }
|
|
|
|
}
|
|
|
|
assert.sameValue(
|
|
typeof f,
|
|
'function',
|
|
'binding value is updated following evaluation'
|
|
);
|
|
assert.sameValue(f(), 123);
|
|
}());
|