Fix block-scoped var/function redeclarations (#4080)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
function check_syntax_error (script)
|
||||
{
|
||||
try
|
||||
{
|
||||
eval (script);
|
||||
assert (false);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
assert (e instanceof SyntaxError);
|
||||
}
|
||||
}
|
||||
|
||||
eval("function f(){}; var f;");
|
||||
eval("var f; function f(){};");
|
||||
|
||||
eval("function f(){}; { var f; }")
|
||||
eval("{ var f; } function f(){};")
|
||||
|
||||
eval("{ function f(){}; } var f;")
|
||||
eval("var f; { function f(){}; }")
|
||||
|
||||
check_syntax_error ("{ function f(){}; var f; }");
|
||||
check_syntax_error ("{ var f; function f(){}; }");
|
||||
|
||||
eval("{ { function f(){}; } var f; }")
|
||||
eval("{ var f; { function f(){}; } }")
|
||||
|
||||
check_syntax_error ("{ function f(){}; { var f; } }")
|
||||
check_syntax_error ("{ { var f; } function f(){}; }")
|
||||
|
||||
eval("{ { function f(){}; } { var f; } }")
|
||||
eval("{ { var f; } { function f(){}; } }")
|
||||
|
||||
eval("function g(){ function f(){}; var f; }")
|
||||
eval("function g(){ var f; function f(){}; }")
|
||||
|
||||
eval("function g(){ function f(){}; { var f; } }")
|
||||
eval("function g(){ { var f; } function f(){}; }")
|
||||
|
||||
eval("function g(){ { function f(){}; } var f; }")
|
||||
eval("function g(){ var f; { function f(){}; } }")
|
||||
@@ -253,9 +253,7 @@
|
||||
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js"><reason></reason></test>
|
||||
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js"><reason></reason></test>
|
||||
<test id="language/asi/S7.9_A5.7_T1.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js"><reason>No longer a SyntaxError in ES11</reason></test>
|
||||
<test id="language/default-parameters/function-length.js"><reason></reason></test>
|
||||
<test id="language/expressions/arrow-function/lexical-super-call-from-within-constructor.js"><reason></reason></test>
|
||||
<test id="language/expressions/assignment/destructuring/array-rest-init.js"><reason></reason></test>
|
||||
|
||||
@@ -4099,38 +4099,18 @@
|
||||
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-generator.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-generator.js"><reason></reason></test>
|
||||
<test id="language/comments/hashbang/eval-indirect.js"><reason></reason></test>
|
||||
<test id="language/comments/hashbang/eval.js"><reason></reason></test>
|
||||
<test id="language/comments/hashbang/line-terminator-carriage-return.js"><reason></reason></test>
|
||||
@@ -10417,26 +10397,18 @@
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/tco-case-body-dflt.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/tco-case-body.js"><reason></reason></test>
|
||||
<test id="language/statements/switch/tco-dftl-body.js"><reason></reason></test>
|
||||
|
||||
Reference in New Issue
Block a user