Merge pull request #891 from leobalter/860-block-dft-params

Test for parameters with default expressions in Annex B FiB tests
This commit is contained in:
Leo Balter 2017-03-10 15:53:01 -05:00 committed by GitHub
commit 4108569dd7
9 changed files with 313 additions and 0 deletions

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Extension not observed when there is a default parameter with the same name
template: func
info: |
B.3.3.1 Changes to FunctionDeclarationInstantiation
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
//- setup
var init, after;
//- params
f = 123
//- before
init = f;
//- after
after = f;
//- teardown
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,31 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/block.template
/*---
description: Extension not observed when there is a default parameter with the same name (Block statement in function scope containing a function declaration)
esid: sec-web-compat-functiondeclarationinstantiation
es6id: B.3.3.1
flags: [generated, noStrict]
info: |
B.3.3.1 Changes to FunctionDeclarationInstantiation
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
{
function f() { }
}
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/if-decl-else-decl-a.template
/*---
description: Extension not observed when there is a default parameter with the same name (IfStatement with a declaration in both statement positions 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
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
if (true) function f() { } else function _f() {}
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/if-decl-else-decl-b.template
/*---
description: Extension not observed when there is a default parameter with the same name (IfStatement with a declaration in both statement positions 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
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
if (false) function _f() {} else function f() { }
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/if-decl-else-stmt.template
/*---
description: Extension not observed when there is a default parameter with the same name (IfStatement with a declaration in the first 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
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
if (true) function f() { } else ;
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/if-decl-no-else.template
/*---
description: Extension not observed when there is a default parameter with the same name (IfStatement without an else clause 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
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
if (true) function f() { }
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/if-stmt-else-decl.template
/*---
description: Extension not observed when there is a default parameter with the same name (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
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
if (false) ; else function f() { }
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/switch-case.template
/*---
description: Extension not observed when there is a default parameter with the same name (Function declaration in the `case` clause of a `switch` statement in function scope)
esid: sec-web-compat-functiondeclarationinstantiation
es6id: B.3.3.1
flags: [generated, noStrict]
info: |
B.3.3.1 Changes to FunctionDeclarationInstantiation
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
switch (1) {
case 1:
function f() { }
}
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/func-skip-dft-param.case
// - src/annex-b-fns/func/switch-dflt.template
/*---
description: Extension not observed when there is a default parameter with the same name (Funtion declaration in the `default` clause of a `switch` statement in function scope)
esid: sec-web-compat-functiondeclarationinstantiation
es6id: B.3.3.1
flags: [generated, noStrict]
info: |
B.3.3.1 Changes to FunctionDeclarationInstantiation
[...]
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of BoundNames of argumentsList, then
[...]
---*/
var init, after;
(function(f = 123) {
init = f;
switch (1) {
default:
function f() { }
}
after = f;
}());
assert.sameValue(init, 123, 'binding is not initialized to `undefined`');
assert.sameValue(after, 123, 'value is not updated following evaluation');