From a41b71115b0ee3101c9e6d13caa25233f6698810 Mon Sep 17 00:00:00 2001 From: jugglinmike <mike@mikepennisi.com> Date: Mon, 11 Jul 2016 19:37:42 -0400 Subject: [PATCH] Annex b skip fib (#704) * 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 --- src/annex-b-fns/eval-func-no-skip-try.case | 45 +++++++++++++ .../eval-func-skip-early-err-block.case | 40 ++++++++++++ .../eval-func-skip-early-err-for-in.case | 39 +++++++++++ .../eval-func-skip-early-err-for-of.case | 39 +++++++++++ .../eval-func-skip-early-err-for.case | 40 ++++++++++++ .../eval-func-skip-early-err-switch.case | 41 ++++++++++++ .../eval-func-skip-early-err-try.case | 50 +++++++++++++++ src/annex-b-fns/eval-global-no-skip-try.case | 45 +++++++++++++ .../eval-global-skip-early-err-block.case | 40 ++++++++++++ .../eval-global-skip-early-err-for-in.case | 39 +++++++++++ .../eval-global-skip-early-err-for-of.case | 39 +++++++++++ .../eval-global-skip-early-err-for.case | 40 ++++++++++++ .../eval-global-skip-early-err-switch.case | 41 ++++++++++++ .../eval-global-skip-early-err-try.case | 50 +++++++++++++++ src/annex-b-fns/func-no-skip-try.case | 46 +++++++++++++ .../func-skip-early-err-block.case | 40 ++++++++++++ .../func-skip-early-err-for-in.case | 39 +++++++++++ .../func-skip-early-err-for-of.case | 39 +++++++++++ src/annex-b-fns/func-skip-early-err-for.case | 40 ++++++++++++ .../func-skip-early-err-switch.case | 41 ++++++++++++ src/annex-b-fns/func-skip-early-err-try.case | 51 +++++++++++++++ src/annex-b-fns/global-no-skip-try.case | 45 +++++++++++++ .../global-skip-early-err-block.case | 40 ++++++++++++ .../global-skip-early-err-for-in.case | 39 +++++++++++ .../global-skip-early-err-for-of.case | 39 +++++++++++ .../global-skip-early-err-for.case | 40 ++++++++++++ .../global-skip-early-err-switch.case | 41 ++++++++++++ .../global-skip-early-err-try.case | 50 +++++++++++++++ ...func-block-decl-eval-func-block-scoping.js | 6 +- ...decl-eval-func-exsting-block-fn-no-init.js | 4 +- ...-decl-eval-func-exsting-block-fn-update.js | 4 +- ...block-decl-eval-func-exsting-fn-no-init.js | 4 +- ...-block-decl-eval-func-exsting-fn-update.js | 4 +- ...lock-decl-eval-func-exsting-var-no-init.js | 4 +- ...block-decl-eval-func-exsting-var-update.js | 4 +- .../direct/func-block-decl-eval-func-init.js | 4 +- ...func-block-decl-eval-func-no-skip-param.js | 4 +- .../func-block-decl-eval-func-no-skip-try.js | 45 +++++++++++++ ...ock-decl-eval-func-skip-early-err-block.js | 42 ++++++++++++ ...ck-decl-eval-func-skip-early-err-for-in.js | 41 ++++++++++++ ...ck-decl-eval-func-skip-early-err-for-of.js | 41 ++++++++++++ ...block-decl-eval-func-skip-early-err-for.js | 42 ++++++++++++ ...ck-decl-eval-func-skip-early-err-switch.js | 43 +++++++++++++ ...block-decl-eval-func-skip-early-err-try.js | 52 +++++++++++++++ ...unc-block-decl-eval-func-skip-early-err.js | 4 +- .../func-block-decl-eval-func-update.js | 4 +- ...ecl-else-decl-a-eval-func-block-scoping.js | 10 +-- ...cl-a-eval-func-exsting-block-fn-no-init.js | 8 +-- ...ecl-a-eval-func-exsting-block-fn-update.js | 8 +-- ...lse-decl-a-eval-func-exsting-fn-no-init.js | 8 +-- ...else-decl-a-eval-func-exsting-fn-update.js | 8 +-- ...se-decl-a-eval-func-exsting-var-no-init.js | 8 +-- ...lse-decl-a-eval-func-exsting-var-update.js | 8 +-- ...func-if-decl-else-decl-a-eval-func-init.js | 8 +-- ...ecl-else-decl-a-eval-func-no-skip-param.js | 8 +-- ...-decl-else-decl-a-eval-func-no-skip-try.js | 54 ++++++++++++++++ ...e-decl-a-eval-func-skip-early-err-block.js | 51 +++++++++++++++ ...-decl-a-eval-func-skip-early-err-for-in.js | 50 +++++++++++++++ ...-decl-a-eval-func-skip-early-err-for-of.js | 50 +++++++++++++++ ...lse-decl-a-eval-func-skip-early-err-for.js | 51 +++++++++++++++ ...-decl-a-eval-func-skip-early-err-switch.js | 52 +++++++++++++++ ...lse-decl-a-eval-func-skip-early-err-try.js | 61 ++++++++++++++++++ ...cl-else-decl-a-eval-func-skip-early-err.js | 8 +-- ...nc-if-decl-else-decl-a-eval-func-update.js | 8 +-- ...ecl-else-decl-b-eval-func-block-scoping.js | 10 +-- ...cl-b-eval-func-exsting-block-fn-no-init.js | 8 +-- ...ecl-b-eval-func-exsting-block-fn-update.js | 8 +-- ...lse-decl-b-eval-func-exsting-fn-no-init.js | 8 +-- ...else-decl-b-eval-func-exsting-fn-update.js | 8 +-- ...se-decl-b-eval-func-exsting-var-no-init.js | 8 +-- ...lse-decl-b-eval-func-exsting-var-update.js | 8 +-- ...func-if-decl-else-decl-b-eval-func-init.js | 8 +-- ...ecl-else-decl-b-eval-func-no-skip-param.js | 8 +-- ...-decl-else-decl-b-eval-func-no-skip-try.js | 54 ++++++++++++++++ ...e-decl-b-eval-func-skip-early-err-block.js | 51 +++++++++++++++ ...-decl-b-eval-func-skip-early-err-for-in.js | 50 +++++++++++++++ ...-decl-b-eval-func-skip-early-err-for-of.js | 50 +++++++++++++++ ...lse-decl-b-eval-func-skip-early-err-for.js | 51 +++++++++++++++ ...-decl-b-eval-func-skip-early-err-switch.js | 52 +++++++++++++++ ...lse-decl-b-eval-func-skip-early-err-try.js | 61 ++++++++++++++++++ ...cl-else-decl-b-eval-func-skip-early-err.js | 8 +-- ...nc-if-decl-else-decl-b-eval-func-update.js | 8 +-- ...-decl-else-stmt-eval-func-block-scoping.js | 10 +-- ...stmt-eval-func-exsting-block-fn-no-init.js | 8 +-- ...-stmt-eval-func-exsting-block-fn-update.js | 8 +-- ...-else-stmt-eval-func-exsting-fn-no-init.js | 8 +-- ...l-else-stmt-eval-func-exsting-fn-update.js | 8 +-- ...else-stmt-eval-func-exsting-var-no-init.js | 8 +-- ...-else-stmt-eval-func-exsting-var-update.js | 8 +-- .../func-if-decl-else-stmt-eval-func-init.js | 8 +-- ...-decl-else-stmt-eval-func-no-skip-param.js | 8 +-- ...if-decl-else-stmt-eval-func-no-skip-try.js | 54 ++++++++++++++++ ...lse-stmt-eval-func-skip-early-err-block.js | 51 +++++++++++++++ ...se-stmt-eval-func-skip-early-err-for-in.js | 50 +++++++++++++++ ...se-stmt-eval-func-skip-early-err-for-of.js | 50 +++++++++++++++ ...-else-stmt-eval-func-skip-early-err-for.js | 51 +++++++++++++++ ...se-stmt-eval-func-skip-early-err-switch.js | 52 +++++++++++++++ ...-else-stmt-eval-func-skip-early-err-try.js | 61 ++++++++++++++++++ ...decl-else-stmt-eval-func-skip-early-err.js | 8 +-- ...func-if-decl-else-stmt-eval-func-update.js | 8 +-- ...if-decl-no-else-eval-func-block-scoping.js | 10 +-- ...else-eval-func-exsting-block-fn-no-init.js | 8 +-- ...-else-eval-func-exsting-block-fn-update.js | 8 +-- ...cl-no-else-eval-func-exsting-fn-no-init.js | 8 +-- ...ecl-no-else-eval-func-exsting-fn-update.js | 8 +-- ...l-no-else-eval-func-exsting-var-no-init.js | 8 +-- ...cl-no-else-eval-func-exsting-var-update.js | 8 +-- .../func-if-decl-no-else-eval-func-init.js | 8 +-- ...if-decl-no-else-eval-func-no-skip-param.js | 8 +-- ...c-if-decl-no-else-eval-func-no-skip-try.js | 54 ++++++++++++++++ ...-no-else-eval-func-skip-early-err-block.js | 51 +++++++++++++++ ...no-else-eval-func-skip-early-err-for-in.js | 50 +++++++++++++++ ...no-else-eval-func-skip-early-err-for-of.js | 50 +++++++++++++++ ...cl-no-else-eval-func-skip-early-err-for.js | 51 +++++++++++++++ ...no-else-eval-func-skip-early-err-switch.js | 52 +++++++++++++++ ...cl-no-else-eval-func-skip-early-err-try.js | 61 ++++++++++++++++++ ...f-decl-no-else-eval-func-skip-early-err.js | 8 +-- .../func-if-decl-no-else-eval-func-update.js | 8 +-- ...-stmt-else-decl-eval-func-block-scoping.js | 10 +-- ...decl-eval-func-exsting-block-fn-no-init.js | 8 +-- ...-decl-eval-func-exsting-block-fn-update.js | 8 +-- ...-else-decl-eval-func-exsting-fn-no-init.js | 8 +-- ...t-else-decl-eval-func-exsting-fn-update.js | 8 +-- ...else-decl-eval-func-exsting-var-no-init.js | 8 +-- ...-else-decl-eval-func-exsting-var-update.js | 8 +-- .../func-if-stmt-else-decl-eval-func-init.js | 8 +-- ...-stmt-else-decl-eval-func-no-skip-param.js | 8 +-- ...if-stmt-else-decl-eval-func-no-skip-try.js | 54 ++++++++++++++++ ...lse-decl-eval-func-skip-early-err-block.js | 51 +++++++++++++++ ...se-decl-eval-func-skip-early-err-for-in.js | 50 +++++++++++++++ ...se-decl-eval-func-skip-early-err-for-of.js | 50 +++++++++++++++ ...-else-decl-eval-func-skip-early-err-for.js | 51 +++++++++++++++ ...se-decl-eval-func-skip-early-err-switch.js | 52 +++++++++++++++ ...-else-decl-eval-func-skip-early-err-try.js | 61 ++++++++++++++++++ ...stmt-else-decl-eval-func-skip-early-err.js | 8 +-- ...func-if-stmt-else-decl-eval-func-update.js | 8 +-- ...unc-switch-case-eval-func-block-scoping.js | 6 +- ...case-eval-func-exsting-block-fn-no-init.js | 4 +- ...-case-eval-func-exsting-block-fn-update.js | 4 +- ...witch-case-eval-func-exsting-fn-no-init.js | 4 +- ...switch-case-eval-func-exsting-fn-update.js | 4 +- ...itch-case-eval-func-exsting-var-no-init.js | 4 +- ...witch-case-eval-func-exsting-var-update.js | 4 +- .../direct/func-switch-case-eval-func-init.js | 4 +- ...unc-switch-case-eval-func-no-skip-param.js | 4 +- .../func-switch-case-eval-func-no-skip-try.js | 49 ++++++++++++++ ...tch-case-eval-func-skip-early-err-block.js | 46 +++++++++++++ ...ch-case-eval-func-skip-early-err-for-in.js | 45 +++++++++++++ ...ch-case-eval-func-skip-early-err-for-of.js | 45 +++++++++++++ ...witch-case-eval-func-skip-early-err-for.js | 46 +++++++++++++ ...ch-case-eval-func-skip-early-err-switch.js | 47 ++++++++++++++ ...witch-case-eval-func-skip-early-err-try.js | 56 ++++++++++++++++ ...nc-switch-case-eval-func-skip-early-err.js | 4 +- .../func-switch-case-eval-func-update.js | 4 +- ...unc-switch-dflt-eval-func-block-scoping.js | 6 +- ...dflt-eval-func-exsting-block-fn-no-init.js | 4 +- ...-dflt-eval-func-exsting-block-fn-update.js | 4 +- ...witch-dflt-eval-func-exsting-fn-no-init.js | 4 +- ...switch-dflt-eval-func-exsting-fn-update.js | 4 +- ...itch-dflt-eval-func-exsting-var-no-init.js | 4 +- ...witch-dflt-eval-func-exsting-var-update.js | 4 +- .../direct/func-switch-dflt-eval-func-init.js | 4 +- ...unc-switch-dflt-eval-func-no-skip-param.js | 4 +- .../func-switch-dflt-eval-func-no-skip-try.js | 49 ++++++++++++++ ...tch-dflt-eval-func-skip-early-err-block.js | 46 +++++++++++++ ...ch-dflt-eval-func-skip-early-err-for-in.js | 45 +++++++++++++ ...ch-dflt-eval-func-skip-early-err-for-of.js | 45 +++++++++++++ ...witch-dflt-eval-func-skip-early-err-for.js | 46 +++++++++++++ ...ch-dflt-eval-func-skip-early-err-switch.js | 47 ++++++++++++++ ...witch-dflt-eval-func-skip-early-err-try.js | 56 ++++++++++++++++ ...nc-switch-dflt-eval-func-skip-early-err.js | 4 +- .../func-switch-dflt-eval-func-update.js | 4 +- ...al-block-decl-eval-global-block-scoping.js | 6 +- ...cl-eval-global-exsting-block-fn-no-init.js | 4 +- ...ecl-eval-global-exsting-block-fn-update.js | 4 +- ...ock-decl-eval-global-exsting-fn-no-init.js | 4 +- ...lock-decl-eval-global-exsting-fn-update.js | 4 +- ...ck-decl-eval-global-exsting-global-init.js | 10 +-- ...-decl-eval-global-exsting-global-update.js | 6 +- ...ck-decl-eval-global-exsting-var-no-init.js | 4 +- ...ock-decl-eval-global-exsting-var-update.js | 4 +- .../global-block-decl-eval-global-init.js | 8 +-- ...obal-block-decl-eval-global-no-skip-try.js | 43 +++++++++++++ ...k-decl-eval-global-skip-early-err-block.js | 39 +++++++++++ ...-decl-eval-global-skip-early-err-for-in.js | 38 +++++++++++ ...-decl-eval-global-skip-early-err-for-of.js | 38 +++++++++++ ...ock-decl-eval-global-skip-early-err-for.js | 39 +++++++++++ ...-decl-eval-global-skip-early-err-switch.js | 40 ++++++++++++ ...ock-decl-eval-global-skip-early-err-try.js | 50 +++++++++++++++ ...l-block-decl-eval-global-skip-early-err.js | 4 +- .../global-block-decl-eval-global-update.js | 4 +- ...l-else-decl-a-eval-global-block-scoping.js | 10 +-- ...-a-eval-global-exsting-block-fn-no-init.js | 8 +-- ...l-a-eval-global-exsting-block-fn-update.js | 8 +-- ...e-decl-a-eval-global-exsting-fn-no-init.js | 8 +-- ...se-decl-a-eval-global-exsting-fn-update.js | 8 +-- ...-decl-a-eval-global-exsting-global-init.js | 14 ++-- ...ecl-a-eval-global-exsting-global-update.js | 10 +-- ...-decl-a-eval-global-exsting-var-no-init.js | 8 +-- ...e-decl-a-eval-global-exsting-var-update.js | 8 +-- ...al-if-decl-else-decl-a-eval-global-init.js | 12 ++-- ...ecl-else-decl-a-eval-global-no-skip-try.js | 52 +++++++++++++++ ...decl-a-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...ecl-a-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...ecl-a-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...e-decl-a-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...ecl-a-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...e-decl-a-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...-else-decl-a-eval-global-skip-early-err.js | 8 +-- ...-if-decl-else-decl-a-eval-global-update.js | 8 +-- ...l-else-decl-b-eval-global-block-scoping.js | 10 +-- ...-b-eval-global-exsting-block-fn-no-init.js | 8 +-- ...l-b-eval-global-exsting-block-fn-update.js | 8 +-- ...e-decl-b-eval-global-exsting-fn-no-init.js | 8 +-- ...se-decl-b-eval-global-exsting-fn-update.js | 8 +-- ...-decl-b-eval-global-exsting-global-init.js | 14 ++-- ...ecl-b-eval-global-exsting-global-update.js | 10 +-- ...-decl-b-eval-global-exsting-var-no-init.js | 8 +-- ...e-decl-b-eval-global-exsting-var-update.js | 8 +-- ...al-if-decl-else-decl-b-eval-global-init.js | 12 ++-- ...ecl-else-decl-b-eval-global-no-skip-try.js | 52 +++++++++++++++ ...decl-b-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...ecl-b-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...ecl-b-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...e-decl-b-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...ecl-b-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...e-decl-b-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...-else-decl-b-eval-global-skip-early-err.js | 8 +-- ...-if-decl-else-decl-b-eval-global-update.js | 8 +-- ...ecl-else-stmt-eval-global-block-scoping.js | 10 +-- ...mt-eval-global-exsting-block-fn-no-init.js | 8 +-- ...tmt-eval-global-exsting-block-fn-update.js | 8 +-- ...lse-stmt-eval-global-exsting-fn-no-init.js | 8 +-- ...else-stmt-eval-global-exsting-fn-update.js | 8 +-- ...se-stmt-eval-global-exsting-global-init.js | 14 ++-- ...-stmt-eval-global-exsting-global-update.js | 10 +-- ...se-stmt-eval-global-exsting-var-no-init.js | 8 +-- ...lse-stmt-eval-global-exsting-var-update.js | 8 +-- ...obal-if-decl-else-stmt-eval-global-init.js | 12 ++-- ...-decl-else-stmt-eval-global-no-skip-try.js | 52 +++++++++++++++ ...e-stmt-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...-stmt-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...-stmt-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...lse-stmt-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...-stmt-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...lse-stmt-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...cl-else-stmt-eval-global-skip-early-err.js | 8 +-- ...al-if-decl-else-stmt-eval-global-update.js | 8 +-- ...-decl-no-else-eval-global-block-scoping.js | 10 +-- ...se-eval-global-exsting-block-fn-no-init.js | 8 +-- ...lse-eval-global-exsting-block-fn-update.js | 8 +-- ...-no-else-eval-global-exsting-fn-no-init.js | 8 +-- ...l-no-else-eval-global-exsting-fn-update.js | 8 +-- ...no-else-eval-global-exsting-global-init.js | 14 ++-- ...-else-eval-global-exsting-global-update.js | 10 +-- ...no-else-eval-global-exsting-var-no-init.js | 8 +-- ...-no-else-eval-global-exsting-var-update.js | 8 +-- ...global-if-decl-no-else-eval-global-init.js | 12 ++-- ...if-decl-no-else-eval-global-no-skip-try.js | 52 +++++++++++++++ ...o-else-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...-else-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...-else-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...-no-else-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...-else-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...-no-else-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...decl-no-else-eval-global-skip-early-err.js | 8 +-- ...obal-if-decl-no-else-eval-global-update.js | 8 +-- ...tmt-else-decl-eval-global-block-scoping.js | 10 +-- ...cl-eval-global-exsting-block-fn-no-init.js | 8 +-- ...ecl-eval-global-exsting-block-fn-update.js | 8 +-- ...lse-decl-eval-global-exsting-fn-no-init.js | 8 +-- ...else-decl-eval-global-exsting-fn-update.js | 8 +-- ...se-decl-eval-global-exsting-global-init.js | 14 ++-- ...-decl-eval-global-exsting-global-update.js | 10 +-- ...se-decl-eval-global-exsting-var-no-init.js | 8 +-- ...lse-decl-eval-global-exsting-var-update.js | 8 +-- ...obal-if-stmt-else-decl-eval-global-init.js | 12 ++-- ...-stmt-else-decl-eval-global-no-skip-try.js | 52 +++++++++++++++ ...e-decl-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...-decl-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...-decl-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...lse-decl-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...-decl-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...lse-decl-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...mt-else-decl-eval-global-skip-early-err.js | 8 +-- ...al-if-stmt-else-decl-eval-global-update.js | 8 +-- ...l-switch-case-eval-global-block-scoping.js | 6 +- ...se-eval-global-exsting-block-fn-no-init.js | 4 +- ...ase-eval-global-exsting-block-fn-update.js | 4 +- ...tch-case-eval-global-exsting-fn-no-init.js | 4 +- ...itch-case-eval-global-exsting-fn-update.js | 4 +- ...ch-case-eval-global-exsting-global-init.js | 10 +-- ...-case-eval-global-exsting-global-update.js | 6 +- ...ch-case-eval-global-exsting-var-no-init.js | 4 +- ...tch-case-eval-global-exsting-var-update.js | 4 +- .../global-switch-case-eval-global-init.js | 8 +-- ...bal-switch-case-eval-global-no-skip-try.js | 47 ++++++++++++++ ...h-case-eval-global-skip-early-err-block.js | 43 +++++++++++++ ...-case-eval-global-skip-early-err-for-in.js | 42 ++++++++++++ ...-case-eval-global-skip-early-err-for-of.js | 42 ++++++++++++ ...tch-case-eval-global-skip-early-err-for.js | 43 +++++++++++++ ...-case-eval-global-skip-early-err-switch.js | 44 +++++++++++++ ...tch-case-eval-global-skip-early-err-try.js | 54 ++++++++++++++++ ...-switch-case-eval-global-skip-early-err.js | 4 +- .../global-switch-case-eval-global-update.js | 4 +- ...l-switch-dflt-eval-global-block-scoping.js | 6 +- ...lt-eval-global-exsting-block-fn-no-init.js | 4 +- ...flt-eval-global-exsting-block-fn-update.js | 4 +- ...tch-dflt-eval-global-exsting-fn-no-init.js | 4 +- ...itch-dflt-eval-global-exsting-fn-update.js | 4 +- ...ch-dflt-eval-global-exsting-global-init.js | 10 +-- ...-dflt-eval-global-exsting-global-update.js | 6 +- ...ch-dflt-eval-global-exsting-var-no-init.js | 4 +- ...tch-dflt-eval-global-exsting-var-update.js | 4 +- .../global-switch-dflt-eval-global-init.js | 8 +-- ...bal-switch-dflt-eval-global-no-skip-try.js | 47 ++++++++++++++ ...h-dflt-eval-global-skip-early-err-block.js | 43 +++++++++++++ ...-dflt-eval-global-skip-early-err-for-in.js | 42 ++++++++++++ ...-dflt-eval-global-skip-early-err-for-of.js | 42 ++++++++++++ ...tch-dflt-eval-global-skip-early-err-for.js | 43 +++++++++++++ ...-dflt-eval-global-skip-early-err-switch.js | 44 +++++++++++++ ...tch-dflt-eval-global-skip-early-err-try.js | 54 ++++++++++++++++ ...-switch-dflt-eval-global-skip-early-err.js | 4 +- .../global-switch-dflt-eval-global-update.js | 4 +- ...al-block-decl-eval-global-block-scoping.js | 6 +- ...cl-eval-global-exsting-block-fn-no-init.js | 4 +- ...ecl-eval-global-exsting-block-fn-update.js | 4 +- ...ock-decl-eval-global-exsting-fn-no-init.js | 4 +- ...lock-decl-eval-global-exsting-fn-update.js | 4 +- ...ck-decl-eval-global-exsting-global-init.js | 10 +-- ...-decl-eval-global-exsting-global-update.js | 6 +- ...ck-decl-eval-global-exsting-var-no-init.js | 4 +- ...ock-decl-eval-global-exsting-var-update.js | 4 +- .../global-block-decl-eval-global-init.js | 8 +-- ...obal-block-decl-eval-global-no-skip-try.js | 43 +++++++++++++ ...k-decl-eval-global-skip-early-err-block.js | 39 +++++++++++ ...-decl-eval-global-skip-early-err-for-in.js | 38 +++++++++++ ...-decl-eval-global-skip-early-err-for-of.js | 38 +++++++++++ ...ock-decl-eval-global-skip-early-err-for.js | 39 +++++++++++ ...-decl-eval-global-skip-early-err-switch.js | 40 ++++++++++++ ...ock-decl-eval-global-skip-early-err-try.js | 50 +++++++++++++++ ...l-block-decl-eval-global-skip-early-err.js | 4 +- .../global-block-decl-eval-global-update.js | 4 +- ...l-else-decl-a-eval-global-block-scoping.js | 10 +-- ...-a-eval-global-exsting-block-fn-no-init.js | 8 +-- ...l-a-eval-global-exsting-block-fn-update.js | 8 +-- ...e-decl-a-eval-global-exsting-fn-no-init.js | 8 +-- ...se-decl-a-eval-global-exsting-fn-update.js | 8 +-- ...-decl-a-eval-global-exsting-global-init.js | 14 ++-- ...ecl-a-eval-global-exsting-global-update.js | 10 +-- ...-decl-a-eval-global-exsting-var-no-init.js | 8 +-- ...e-decl-a-eval-global-exsting-var-update.js | 8 +-- ...al-if-decl-else-decl-a-eval-global-init.js | 12 ++-- ...ecl-else-decl-a-eval-global-no-skip-try.js | 52 +++++++++++++++ ...decl-a-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...ecl-a-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...ecl-a-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...e-decl-a-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...ecl-a-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...e-decl-a-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...-else-decl-a-eval-global-skip-early-err.js | 8 +-- ...-if-decl-else-decl-a-eval-global-update.js | 8 +-- ...l-else-decl-b-eval-global-block-scoping.js | 10 +-- ...-b-eval-global-exsting-block-fn-no-init.js | 8 +-- ...l-b-eval-global-exsting-block-fn-update.js | 8 +-- ...e-decl-b-eval-global-exsting-fn-no-init.js | 8 +-- ...se-decl-b-eval-global-exsting-fn-update.js | 8 +-- ...-decl-b-eval-global-exsting-global-init.js | 14 ++-- ...ecl-b-eval-global-exsting-global-update.js | 10 +-- ...-decl-b-eval-global-exsting-var-no-init.js | 8 +-- ...e-decl-b-eval-global-exsting-var-update.js | 8 +-- ...al-if-decl-else-decl-b-eval-global-init.js | 12 ++-- ...ecl-else-decl-b-eval-global-no-skip-try.js | 52 +++++++++++++++ ...decl-b-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...ecl-b-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...ecl-b-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...e-decl-b-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...ecl-b-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...e-decl-b-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...-else-decl-b-eval-global-skip-early-err.js | 8 +-- ...-if-decl-else-decl-b-eval-global-update.js | 8 +-- ...ecl-else-stmt-eval-global-block-scoping.js | 10 +-- ...mt-eval-global-exsting-block-fn-no-init.js | 8 +-- ...tmt-eval-global-exsting-block-fn-update.js | 8 +-- ...lse-stmt-eval-global-exsting-fn-no-init.js | 8 +-- ...else-stmt-eval-global-exsting-fn-update.js | 8 +-- ...se-stmt-eval-global-exsting-global-init.js | 14 ++-- ...-stmt-eval-global-exsting-global-update.js | 10 +-- ...se-stmt-eval-global-exsting-var-no-init.js | 8 +-- ...lse-stmt-eval-global-exsting-var-update.js | 8 +-- ...obal-if-decl-else-stmt-eval-global-init.js | 12 ++-- ...-decl-else-stmt-eval-global-no-skip-try.js | 52 +++++++++++++++ ...e-stmt-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...-stmt-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...-stmt-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...lse-stmt-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...-stmt-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...lse-stmt-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...cl-else-stmt-eval-global-skip-early-err.js | 8 +-- ...al-if-decl-else-stmt-eval-global-update.js | 8 +-- ...-decl-no-else-eval-global-block-scoping.js | 10 +-- ...se-eval-global-exsting-block-fn-no-init.js | 8 +-- ...lse-eval-global-exsting-block-fn-update.js | 8 +-- ...-no-else-eval-global-exsting-fn-no-init.js | 8 +-- ...l-no-else-eval-global-exsting-fn-update.js | 8 +-- ...no-else-eval-global-exsting-global-init.js | 14 ++-- ...-else-eval-global-exsting-global-update.js | 10 +-- ...no-else-eval-global-exsting-var-no-init.js | 8 +-- ...-no-else-eval-global-exsting-var-update.js | 8 +-- ...global-if-decl-no-else-eval-global-init.js | 12 ++-- ...if-decl-no-else-eval-global-no-skip-try.js | 52 +++++++++++++++ ...o-else-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...-else-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...-else-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...-no-else-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...-else-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...-no-else-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...decl-no-else-eval-global-skip-early-err.js | 8 +-- ...obal-if-decl-no-else-eval-global-update.js | 8 +-- ...tmt-else-decl-eval-global-block-scoping.js | 10 +-- ...cl-eval-global-exsting-block-fn-no-init.js | 8 +-- ...ecl-eval-global-exsting-block-fn-update.js | 8 +-- ...lse-decl-eval-global-exsting-fn-no-init.js | 8 +-- ...else-decl-eval-global-exsting-fn-update.js | 8 +-- ...se-decl-eval-global-exsting-global-init.js | 14 ++-- ...-decl-eval-global-exsting-global-update.js | 10 +-- ...se-decl-eval-global-exsting-var-no-init.js | 8 +-- ...lse-decl-eval-global-exsting-var-update.js | 8 +-- ...obal-if-stmt-else-decl-eval-global-init.js | 12 ++-- ...-stmt-else-decl-eval-global-no-skip-try.js | 52 +++++++++++++++ ...e-decl-eval-global-skip-early-err-block.js | 48 ++++++++++++++ ...-decl-eval-global-skip-early-err-for-in.js | 47 ++++++++++++++ ...-decl-eval-global-skip-early-err-for-of.js | 47 ++++++++++++++ ...lse-decl-eval-global-skip-early-err-for.js | 48 ++++++++++++++ ...-decl-eval-global-skip-early-err-switch.js | 49 ++++++++++++++ ...lse-decl-eval-global-skip-early-err-try.js | 59 +++++++++++++++++ ...mt-else-decl-eval-global-skip-early-err.js | 8 +-- ...al-if-stmt-else-decl-eval-global-update.js | 8 +-- ...l-switch-case-eval-global-block-scoping.js | 6 +- ...se-eval-global-exsting-block-fn-no-init.js | 4 +- ...ase-eval-global-exsting-block-fn-update.js | 4 +- ...tch-case-eval-global-exsting-fn-no-init.js | 4 +- ...itch-case-eval-global-exsting-fn-update.js | 4 +- ...ch-case-eval-global-exsting-global-init.js | 10 +-- ...-case-eval-global-exsting-global-update.js | 6 +- ...ch-case-eval-global-exsting-var-no-init.js | 4 +- ...tch-case-eval-global-exsting-var-update.js | 4 +- .../global-switch-case-eval-global-init.js | 8 +-- ...bal-switch-case-eval-global-no-skip-try.js | 47 ++++++++++++++ ...h-case-eval-global-skip-early-err-block.js | 43 +++++++++++++ ...-case-eval-global-skip-early-err-for-in.js | 42 ++++++++++++ ...-case-eval-global-skip-early-err-for-of.js | 42 ++++++++++++ ...tch-case-eval-global-skip-early-err-for.js | 43 +++++++++++++ ...-case-eval-global-skip-early-err-switch.js | 44 +++++++++++++ ...tch-case-eval-global-skip-early-err-try.js | 54 ++++++++++++++++ ...-switch-case-eval-global-skip-early-err.js | 4 +- .../global-switch-case-eval-global-update.js | 4 +- ...l-switch-dflt-eval-global-block-scoping.js | 6 +- ...lt-eval-global-exsting-block-fn-no-init.js | 4 +- ...flt-eval-global-exsting-block-fn-update.js | 4 +- ...tch-dflt-eval-global-exsting-fn-no-init.js | 4 +- ...itch-dflt-eval-global-exsting-fn-update.js | 4 +- ...ch-dflt-eval-global-exsting-global-init.js | 10 +-- ...-dflt-eval-global-exsting-global-update.js | 6 +- ...ch-dflt-eval-global-exsting-var-no-init.js | 4 +- ...tch-dflt-eval-global-exsting-var-update.js | 4 +- .../global-switch-dflt-eval-global-init.js | 8 +-- ...bal-switch-dflt-eval-global-no-skip-try.js | 47 ++++++++++++++ ...h-dflt-eval-global-skip-early-err-block.js | 43 +++++++++++++ ...-dflt-eval-global-skip-early-err-for-in.js | 42 ++++++++++++ ...-dflt-eval-global-skip-early-err-for-of.js | 42 ++++++++++++ ...tch-dflt-eval-global-skip-early-err-for.js | 43 +++++++++++++ ...-dflt-eval-global-skip-early-err-switch.js | 44 +++++++++++++ ...tch-dflt-eval-global-skip-early-err-try.js | 54 ++++++++++++++++ ...-switch-dflt-eval-global-skip-early-err.js | 4 +- .../global-switch-dflt-eval-global-update.js | 4 +- .../block-decl-func-block-scoping.js | 6 +- ...lock-decl-func-exsting-block-fn-no-init.js | 6 +- ...block-decl-func-exsting-block-fn-update.js | 4 +- .../block-decl-func-exsting-fn-no-init.js | 4 +- .../block-decl-func-exsting-fn-update.js | 6 +- .../block-decl-func-exsting-var-no-init.js | 4 +- .../block-decl-func-exsting-var-update.js | 6 +- .../function-code/block-decl-func-init.js | 4 +- .../block-decl-func-no-skip-try.js | 50 +++++++++++++++ .../block-decl-func-skip-early-err-block.js | 46 +++++++++++++ .../block-decl-func-skip-early-err-for-in.js | 45 +++++++++++++ .../block-decl-func-skip-early-err-for-of.js | 45 +++++++++++++ .../block-decl-func-skip-early-err-for.js | 46 +++++++++++++ .../block-decl-func-skip-early-err-switch.js | 47 ++++++++++++++ .../block-decl-func-skip-early-err-try.js | 57 +++++++++++++++++ .../block-decl-func-skip-early-err.js | 4 +- .../block-decl-func-skip-param.js | 4 +- .../function-code/block-decl-func-update.js | 4 +- .../if-decl-else-decl-a-func-block-scoping.js | 10 +-- ...se-decl-a-func-exsting-block-fn-no-init.js | 10 +-- ...lse-decl-a-func-exsting-block-fn-update.js | 8 +-- ...ecl-else-decl-a-func-exsting-fn-no-init.js | 8 +-- ...decl-else-decl-a-func-exsting-fn-update.js | 10 +-- ...cl-else-decl-a-func-exsting-var-no-init.js | 8 +-- ...ecl-else-decl-a-func-exsting-var-update.js | 10 +-- .../if-decl-else-decl-a-func-init.js | 8 +-- .../if-decl-else-decl-a-func-no-skip-try.js | 57 +++++++++++++++++ ...l-else-decl-a-func-skip-early-err-block.js | 53 +++++++++++++++ ...-else-decl-a-func-skip-early-err-for-in.js | 52 +++++++++++++++ ...-else-decl-a-func-skip-early-err-for-of.js | 52 +++++++++++++++ ...ecl-else-decl-a-func-skip-early-err-for.js | 53 +++++++++++++++ ...-else-decl-a-func-skip-early-err-switch.js | 54 ++++++++++++++++ ...ecl-else-decl-a-func-skip-early-err-try.js | 64 +++++++++++++++++++ ...if-decl-else-decl-a-func-skip-early-err.js | 8 +-- .../if-decl-else-decl-a-func-skip-param.js | 8 +-- .../if-decl-else-decl-a-func-update.js | 8 +-- .../if-decl-else-decl-b-func-block-scoping.js | 10 +-- ...se-decl-b-func-exsting-block-fn-no-init.js | 10 +-- ...lse-decl-b-func-exsting-block-fn-update.js | 8 +-- ...ecl-else-decl-b-func-exsting-fn-no-init.js | 8 +-- ...decl-else-decl-b-func-exsting-fn-update.js | 10 +-- ...cl-else-decl-b-func-exsting-var-no-init.js | 8 +-- ...ecl-else-decl-b-func-exsting-var-update.js | 10 +-- .../if-decl-else-decl-b-func-init.js | 8 +-- .../if-decl-else-decl-b-func-no-skip-try.js | 57 +++++++++++++++++ ...l-else-decl-b-func-skip-early-err-block.js | 53 +++++++++++++++ ...-else-decl-b-func-skip-early-err-for-in.js | 52 +++++++++++++++ ...-else-decl-b-func-skip-early-err-for-of.js | 52 +++++++++++++++ ...ecl-else-decl-b-func-skip-early-err-for.js | 53 +++++++++++++++ ...-else-decl-b-func-skip-early-err-switch.js | 54 ++++++++++++++++ ...ecl-else-decl-b-func-skip-early-err-try.js | 64 +++++++++++++++++++ ...if-decl-else-decl-b-func-skip-early-err.js | 8 +-- .../if-decl-else-decl-b-func-skip-param.js | 8 +-- .../if-decl-else-decl-b-func-update.js | 8 +-- .../if-decl-else-stmt-func-block-scoping.js | 10 +-- ...else-stmt-func-exsting-block-fn-no-init.js | 10 +-- ...-else-stmt-func-exsting-block-fn-update.js | 8 +-- ...-decl-else-stmt-func-exsting-fn-no-init.js | 8 +-- ...f-decl-else-stmt-func-exsting-fn-update.js | 10 +-- ...decl-else-stmt-func-exsting-var-no-init.js | 8 +-- ...-decl-else-stmt-func-exsting-var-update.js | 10 +-- .../if-decl-else-stmt-func-init.js | 8 +-- .../if-decl-else-stmt-func-no-skip-try.js | 57 +++++++++++++++++ ...ecl-else-stmt-func-skip-early-err-block.js | 53 +++++++++++++++ ...cl-else-stmt-func-skip-early-err-for-in.js | 52 +++++++++++++++ ...cl-else-stmt-func-skip-early-err-for-of.js | 52 +++++++++++++++ ...-decl-else-stmt-func-skip-early-err-for.js | 53 +++++++++++++++ ...cl-else-stmt-func-skip-early-err-switch.js | 54 ++++++++++++++++ ...-decl-else-stmt-func-skip-early-err-try.js | 64 +++++++++++++++++++ .../if-decl-else-stmt-func-skip-early-err.js | 8 +-- .../if-decl-else-stmt-func-skip-param.js | 8 +-- .../if-decl-else-stmt-func-update.js | 8 +-- .../if-decl-no-else-func-block-scoping.js | 10 +-- ...l-no-else-func-exsting-block-fn-no-init.js | 10 +-- ...cl-no-else-func-exsting-block-fn-update.js | 8 +-- ...if-decl-no-else-func-exsting-fn-no-init.js | 8 +-- .../if-decl-no-else-func-exsting-fn-update.js | 10 +-- ...f-decl-no-else-func-exsting-var-no-init.js | 8 +-- ...if-decl-no-else-func-exsting-var-update.js | 10 +-- .../if-decl-no-else-func-init.js | 8 +-- .../if-decl-no-else-func-no-skip-try.js | 57 +++++++++++++++++ ...-decl-no-else-func-skip-early-err-block.js | 53 +++++++++++++++ ...decl-no-else-func-skip-early-err-for-in.js | 52 +++++++++++++++ ...decl-no-else-func-skip-early-err-for-of.js | 52 +++++++++++++++ ...if-decl-no-else-func-skip-early-err-for.js | 53 +++++++++++++++ ...decl-no-else-func-skip-early-err-switch.js | 54 ++++++++++++++++ ...if-decl-no-else-func-skip-early-err-try.js | 64 +++++++++++++++++++ .../if-decl-no-else-func-skip-early-err.js | 8 +-- .../if-decl-no-else-func-skip-param.js | 8 +-- .../if-decl-no-else-func-update.js | 8 +-- .../if-stmt-else-decl-func-block-scoping.js | 10 +-- ...else-decl-func-exsting-block-fn-no-init.js | 10 +-- ...-else-decl-func-exsting-block-fn-update.js | 8 +-- ...-stmt-else-decl-func-exsting-fn-no-init.js | 8 +-- ...f-stmt-else-decl-func-exsting-fn-update.js | 10 +-- ...stmt-else-decl-func-exsting-var-no-init.js | 8 +-- ...-stmt-else-decl-func-exsting-var-update.js | 10 +-- .../if-stmt-else-decl-func-init.js | 8 +-- .../if-stmt-else-decl-func-no-skip-try.js | 57 +++++++++++++++++ ...tmt-else-decl-func-skip-early-err-block.js | 53 +++++++++++++++ ...mt-else-decl-func-skip-early-err-for-in.js | 52 +++++++++++++++ ...mt-else-decl-func-skip-early-err-for-of.js | 52 +++++++++++++++ ...-stmt-else-decl-func-skip-early-err-for.js | 53 +++++++++++++++ ...mt-else-decl-func-skip-early-err-switch.js | 54 ++++++++++++++++ ...-stmt-else-decl-func-skip-early-err-try.js | 64 +++++++++++++++++++ .../if-stmt-else-decl-func-skip-early-err.js | 8 +-- .../if-stmt-else-decl-func-skip-param.js | 8 +-- .../if-stmt-else-decl-func-update.js | 8 +-- .../switch-case-func-block-scoping.js | 6 +- ...itch-case-func-exsting-block-fn-no-init.js | 6 +- ...witch-case-func-exsting-block-fn-update.js | 4 +- .../switch-case-func-exsting-fn-no-init.js | 4 +- .../switch-case-func-exsting-fn-update.js | 6 +- .../switch-case-func-exsting-var-no-init.js | 4 +- .../switch-case-func-exsting-var-update.js | 6 +- .../function-code/switch-case-func-init.js | 4 +- .../switch-case-func-no-skip-try.js | 51 +++++++++++++++ .../switch-case-func-skip-early-err-block.js | 47 ++++++++++++++ .../switch-case-func-skip-early-err-for-in.js | 46 +++++++++++++ .../switch-case-func-skip-early-err-for-of.js | 46 +++++++++++++ .../switch-case-func-skip-early-err-for.js | 47 ++++++++++++++ .../switch-case-func-skip-early-err-switch.js | 48 ++++++++++++++ .../switch-case-func-skip-early-err-try.js | 58 +++++++++++++++++ .../switch-case-func-skip-early-err.js | 4 +- .../switch-case-func-skip-param.js | 4 +- .../function-code/switch-case-func-update.js | 4 +- .../switch-dflt-func-block-scoping.js | 6 +- ...itch-dflt-func-exsting-block-fn-no-init.js | 6 +- ...witch-dflt-func-exsting-block-fn-update.js | 4 +- .../switch-dflt-func-exsting-fn-no-init.js | 4 +- .../switch-dflt-func-exsting-fn-update.js | 6 +- .../switch-dflt-func-exsting-var-no-init.js | 4 +- .../switch-dflt-func-exsting-var-update.js | 6 +- .../function-code/switch-dflt-func-init.js | 4 +- .../switch-dflt-func-no-skip-try.js | 51 +++++++++++++++ .../switch-dflt-func-skip-early-err-block.js | 47 ++++++++++++++ .../switch-dflt-func-skip-early-err-for-in.js | 46 +++++++++++++ .../switch-dflt-func-skip-early-err-for-of.js | 46 +++++++++++++ .../switch-dflt-func-skip-early-err-for.js | 47 ++++++++++++++ .../switch-dflt-func-skip-early-err-switch.js | 48 ++++++++++++++ .../switch-dflt-func-skip-early-err-try.js | 58 +++++++++++++++++ .../switch-dflt-func-skip-early-err.js | 4 +- .../switch-dflt-func-skip-param.js | 4 +- .../function-code/switch-dflt-func-update.js | 4 +- .../block-decl-global-block-scoping.js | 6 +- ...ck-decl-global-exsting-block-fn-no-init.js | 4 +- ...ock-decl-global-exsting-block-fn-update.js | 4 +- .../block-decl-global-exsting-fn-no-init.js | 4 +- .../block-decl-global-exsting-fn-update.js | 4 +- .../block-decl-global-exsting-var-no-init.js | 4 +- .../block-decl-global-exsting-var-update.js | 4 +- .../global-code/block-decl-global-init.js | 6 +- .../block-decl-global-no-skip-try.js | 46 +++++++++++++ .../block-decl-global-skip-early-err-block.js | 43 +++++++++++++ ...block-decl-global-skip-early-err-for-in.js | 42 ++++++++++++ ...block-decl-global-skip-early-err-for-of.js | 42 ++++++++++++ .../block-decl-global-skip-early-err-for.js | 43 +++++++++++++ ...block-decl-global-skip-early-err-switch.js | 44 +++++++++++++ .../block-decl-global-skip-early-err-try.js | 53 +++++++++++++++ .../block-decl-global-skip-early-err.js | 4 +- .../global-code/block-decl-global-update.js | 4 +- ...f-decl-else-decl-a-global-block-scoping.js | 10 +-- ...-decl-a-global-exsting-block-fn-no-init.js | 8 +-- ...e-decl-a-global-exsting-block-fn-update.js | 8 +-- ...l-else-decl-a-global-exsting-fn-no-init.js | 8 +-- ...cl-else-decl-a-global-exsting-fn-update.js | 8 +-- ...-else-decl-a-global-exsting-var-no-init.js | 8 +-- ...l-else-decl-a-global-exsting-var-update.js | 8 +-- .../if-decl-else-decl-a-global-init.js | 10 +-- .../if-decl-else-decl-a-global-no-skip-try.js | 53 +++++++++++++++ ...else-decl-a-global-skip-early-err-block.js | 50 +++++++++++++++ ...lse-decl-a-global-skip-early-err-for-in.js | 49 ++++++++++++++ ...lse-decl-a-global-skip-early-err-for-of.js | 49 ++++++++++++++ ...l-else-decl-a-global-skip-early-err-for.js | 50 +++++++++++++++ ...lse-decl-a-global-skip-early-err-switch.js | 51 +++++++++++++++ ...l-else-decl-a-global-skip-early-err-try.js | 60 +++++++++++++++++ ...-decl-else-decl-a-global-skip-early-err.js | 8 +-- .../if-decl-else-decl-a-global-update.js | 8 +-- ...f-decl-else-decl-b-global-block-scoping.js | 10 +-- ...-decl-b-global-exsting-block-fn-no-init.js | 8 +-- ...e-decl-b-global-exsting-block-fn-update.js | 8 +-- ...l-else-decl-b-global-exsting-fn-no-init.js | 8 +-- ...cl-else-decl-b-global-exsting-fn-update.js | 8 +-- ...-else-decl-b-global-exsting-var-no-init.js | 8 +-- ...l-else-decl-b-global-exsting-var-update.js | 8 +-- .../if-decl-else-decl-b-global-init.js | 10 +-- .../if-decl-else-decl-b-global-no-skip-try.js | 53 +++++++++++++++ ...else-decl-b-global-skip-early-err-block.js | 50 +++++++++++++++ ...lse-decl-b-global-skip-early-err-for-in.js | 49 ++++++++++++++ ...lse-decl-b-global-skip-early-err-for-of.js | 49 ++++++++++++++ ...l-else-decl-b-global-skip-early-err-for.js | 50 +++++++++++++++ ...lse-decl-b-global-skip-early-err-switch.js | 51 +++++++++++++++ ...l-else-decl-b-global-skip-early-err-try.js | 60 +++++++++++++++++ ...-decl-else-decl-b-global-skip-early-err.js | 8 +-- .../if-decl-else-decl-b-global-update.js | 8 +-- .../if-decl-else-stmt-global-block-scoping.js | 10 +-- ...se-stmt-global-exsting-block-fn-no-init.js | 8 +-- ...lse-stmt-global-exsting-block-fn-update.js | 8 +-- ...ecl-else-stmt-global-exsting-fn-no-init.js | 8 +-- ...decl-else-stmt-global-exsting-fn-update.js | 8 +-- ...cl-else-stmt-global-exsting-var-no-init.js | 8 +-- ...ecl-else-stmt-global-exsting-var-update.js | 8 +-- .../if-decl-else-stmt-global-init.js | 10 +-- .../if-decl-else-stmt-global-no-skip-try.js | 53 +++++++++++++++ ...l-else-stmt-global-skip-early-err-block.js | 50 +++++++++++++++ ...-else-stmt-global-skip-early-err-for-in.js | 49 ++++++++++++++ ...-else-stmt-global-skip-early-err-for-of.js | 49 ++++++++++++++ ...ecl-else-stmt-global-skip-early-err-for.js | 50 +++++++++++++++ ...-else-stmt-global-skip-early-err-switch.js | 51 +++++++++++++++ ...ecl-else-stmt-global-skip-early-err-try.js | 60 +++++++++++++++++ ...if-decl-else-stmt-global-skip-early-err.js | 8 +-- .../if-decl-else-stmt-global-update.js | 8 +-- .../if-decl-no-else-global-block-scoping.js | 10 +-- ...no-else-global-exsting-block-fn-no-init.js | 8 +-- ...-no-else-global-exsting-block-fn-update.js | 8 +-- ...-decl-no-else-global-exsting-fn-no-init.js | 8 +-- ...f-decl-no-else-global-exsting-fn-update.js | 8 +-- ...decl-no-else-global-exsting-var-no-init.js | 8 +-- ...-decl-no-else-global-exsting-var-update.js | 8 +-- .../if-decl-no-else-global-init.js | 10 +-- .../if-decl-no-else-global-no-skip-try.js | 53 +++++++++++++++ ...ecl-no-else-global-skip-early-err-block.js | 50 +++++++++++++++ ...cl-no-else-global-skip-early-err-for-in.js | 49 ++++++++++++++ ...cl-no-else-global-skip-early-err-for-of.js | 49 ++++++++++++++ ...-decl-no-else-global-skip-early-err-for.js | 50 +++++++++++++++ ...cl-no-else-global-skip-early-err-switch.js | 51 +++++++++++++++ ...-decl-no-else-global-skip-early-err-try.js | 60 +++++++++++++++++ .../if-decl-no-else-global-skip-early-err.js | 8 +-- .../if-decl-no-else-global-update.js | 8 +-- .../if-stmt-else-decl-global-block-scoping.js | 10 +-- ...se-decl-global-exsting-block-fn-no-init.js | 8 +-- ...lse-decl-global-exsting-block-fn-update.js | 8 +-- ...tmt-else-decl-global-exsting-fn-no-init.js | 8 +-- ...stmt-else-decl-global-exsting-fn-update.js | 8 +-- ...mt-else-decl-global-exsting-var-no-init.js | 8 +-- ...tmt-else-decl-global-exsting-var-update.js | 8 +-- .../if-stmt-else-decl-global-init.js | 10 +-- .../if-stmt-else-decl-global-no-skip-try.js | 53 +++++++++++++++ ...t-else-decl-global-skip-early-err-block.js | 50 +++++++++++++++ ...-else-decl-global-skip-early-err-for-in.js | 49 ++++++++++++++ ...-else-decl-global-skip-early-err-for-of.js | 49 ++++++++++++++ ...tmt-else-decl-global-skip-early-err-for.js | 50 +++++++++++++++ ...-else-decl-global-skip-early-err-switch.js | 51 +++++++++++++++ ...tmt-else-decl-global-skip-early-err-try.js | 60 +++++++++++++++++ ...if-stmt-else-decl-global-skip-early-err.js | 8 +-- .../if-stmt-else-decl-global-update.js | 8 +-- .../switch-case-global-block-scoping.js | 6 +- ...ch-case-global-exsting-block-fn-no-init.js | 4 +- ...tch-case-global-exsting-block-fn-update.js | 4 +- .../switch-case-global-exsting-fn-no-init.js | 4 +- .../switch-case-global-exsting-fn-update.js | 4 +- .../switch-case-global-exsting-var-no-init.js | 4 +- .../switch-case-global-exsting-var-update.js | 4 +- .../global-code/switch-case-global-init.js | 6 +- .../switch-case-global-no-skip-try.js | 47 ++++++++++++++ ...switch-case-global-skip-early-err-block.js | 44 +++++++++++++ ...witch-case-global-skip-early-err-for-in.js | 43 +++++++++++++ ...witch-case-global-skip-early-err-for-of.js | 43 +++++++++++++ .../switch-case-global-skip-early-err-for.js | 44 +++++++++++++ ...witch-case-global-skip-early-err-switch.js | 45 +++++++++++++ .../switch-case-global-skip-early-err-try.js | 54 ++++++++++++++++ .../switch-case-global-skip-early-err.js | 4 +- .../global-code/switch-case-global-update.js | 4 +- .../switch-dflt-global-block-scoping.js | 6 +- ...ch-dflt-global-exsting-block-fn-no-init.js | 4 +- ...tch-dflt-global-exsting-block-fn-update.js | 4 +- .../switch-dflt-global-exsting-fn-no-init.js | 4 +- .../switch-dflt-global-exsting-fn-update.js | 4 +- .../switch-dflt-global-exsting-var-no-init.js | 4 +- .../switch-dflt-global-exsting-var-update.js | 4 +- .../global-code/switch-dflt-global-init.js | 6 +- .../switch-dflt-global-no-skip-try.js | 47 ++++++++++++++ ...switch-dflt-global-skip-early-err-block.js | 44 +++++++++++++ ...witch-dflt-global-skip-early-err-for-in.js | 43 +++++++++++++ ...witch-dflt-global-skip-early-err-for-of.js | 43 +++++++++++++ .../switch-dflt-global-skip-early-err-for.js | 44 +++++++++++++ ...witch-dflt-global-skip-early-err-switch.js | 45 +++++++++++++ .../switch-dflt-global-skip-early-err-try.js | 54 ++++++++++++++++ .../switch-dflt-global-skip-early-err.js | 4 +- .../global-code/switch-dflt-global-update.js | 4 +- 756 files changed, 16665 insertions(+), 1624 deletions(-) create mode 100644 src/annex-b-fns/eval-func-no-skip-try.case create mode 100644 src/annex-b-fns/eval-func-skip-early-err-block.case create mode 100644 src/annex-b-fns/eval-func-skip-early-err-for-in.case create mode 100644 src/annex-b-fns/eval-func-skip-early-err-for-of.case create mode 100644 src/annex-b-fns/eval-func-skip-early-err-for.case create mode 100644 src/annex-b-fns/eval-func-skip-early-err-switch.case create mode 100644 src/annex-b-fns/eval-func-skip-early-err-try.case create mode 100644 src/annex-b-fns/eval-global-no-skip-try.case create mode 100644 src/annex-b-fns/eval-global-skip-early-err-block.case create mode 100644 src/annex-b-fns/eval-global-skip-early-err-for-in.case create mode 100644 src/annex-b-fns/eval-global-skip-early-err-for-of.case create mode 100644 src/annex-b-fns/eval-global-skip-early-err-for.case create mode 100644 src/annex-b-fns/eval-global-skip-early-err-switch.case create mode 100644 src/annex-b-fns/eval-global-skip-early-err-try.case create mode 100644 src/annex-b-fns/func-no-skip-try.case create mode 100644 src/annex-b-fns/func-skip-early-err-block.case create mode 100644 src/annex-b-fns/func-skip-early-err-for-in.case create mode 100644 src/annex-b-fns/func-skip-early-err-for-of.case create mode 100644 src/annex-b-fns/func-skip-early-err-for.case create mode 100644 src/annex-b-fns/func-skip-early-err-switch.case create mode 100644 src/annex-b-fns/func-skip-early-err-try.case create mode 100644 src/annex-b-fns/global-no-skip-try.case create mode 100644 src/annex-b-fns/global-skip-early-err-block.case create mode 100644 src/annex-b-fns/global-skip-early-err-for-in.case create mode 100644 src/annex-b-fns/global-skip-early-err-for-of.case create mode 100644 src/annex-b-fns/global-skip-early-err-for.case create mode 100644 src/annex-b-fns/global-skip-early-err-switch.case create mode 100644 src/annex-b-fns/global-skip-early-err-try.case create mode 100644 test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-block-decl-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-case-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-block-decl-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-case-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-no-skip-try.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-block.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-switch.js create mode 100644 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/block-decl-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/block-decl-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/block-decl-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/block-decl-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/block-decl-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/block-decl-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/block-decl-func-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/switch-case-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/switch-case-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/switch-case-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/switch-case-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/switch-case-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/switch-case-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/switch-case-func-skip-early-err-try.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-no-skip-try.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-skip-early-err-block.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-in.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-of.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-skip-early-err-for.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-skip-early-err-switch.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/block-decl-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/block-decl-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/block-decl-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/block-decl-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/block-decl-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/block-decl-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/block-decl-global-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-a-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-b-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/if-decl-else-stmt-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/if-decl-no-else-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/if-stmt-else-decl-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/switch-case-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/switch-case-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/switch-case-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/switch-case-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/switch-case-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/switch-case-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/switch-case-global-skip-early-err-try.js create mode 100644 test/annexB/language/global-code/switch-dflt-global-no-skip-try.js create mode 100644 test/annexB/language/global-code/switch-dflt-global-skip-early-err-block.js create mode 100644 test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-in.js create mode 100644 test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-of.js create mode 100644 test/annexB/language/global-code/switch-dflt-global-skip-early-err-for.js create mode 100644 test/annexB/language/global-code/switch-dflt-global-skip-early-err-switch.js create mode 100644 test/annexB/language/global-code/switch-dflt-global-skip-early-err-try.js diff --git a/src/annex-b-fns/eval-func-no-skip-try.case b/src/annex-b-fns/eval-func-no-skip-try.case new file mode 100644 index 0000000000..b27076a6bb --- /dev/null +++ b/src/annex-b-fns/eval-func-no-skip-try.case @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is observed when creation of variable binding would not produce an + early error (try statement) +template: eval-func +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +//- before +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { +//- body +return 123; +//- after +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/src/annex-b-fns/eval-func-skip-early-err-block.case b/src/annex-b-fns/eval-func-skip-early-err-block.case new file mode 100644 index 0000000000..a44a40e875 --- /dev/null +++ b/src/annex-b-fns/eval-func-skip-early-err-block.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (Block statement) +template: eval-func +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-func-skip-early-err-for-in.case b/src/annex-b-fns/eval-func-skip-early-err-for-in.case new file mode 100644 index 0000000000..42466efd42 --- /dev/null +++ b/src/annex-b-fns/eval-func-skip-early-err-for-in.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +template: eval-func +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-func-skip-early-err-for-of.case b/src/annex-b-fns/eval-func-skip-early-err-for-of.case new file mode 100644 index 0000000000..4d875d57b1 --- /dev/null +++ b/src/annex-b-fns/eval-func-skip-early-err-for-of.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +template: eval-func +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-func-skip-early-err-for.case b/src/annex-b-fns/eval-func-skip-early-err-for.case new file mode 100644 index 0000000000..89c136f155 --- /dev/null +++ b/src/annex-b-fns/eval-func-skip-early-err-for.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for statement) +template: eval-func +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { +//- after + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-func-skip-early-err-switch.case b/src/annex-b-fns/eval-func-skip-early-err-switch.case new file mode 100644 index 0000000000..5054d1455f --- /dev/null +++ b/src/annex-b-fns/eval-func-skip-early-err-switch.case @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (switch statement) +template: eval-func +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-func-skip-early-err-try.case b/src/annex-b-fns/eval-func-skip-early-err-try.case new file mode 100644 index 0000000000..976317bfa3 --- /dev/null +++ b/src/annex-b-fns/eval-func-skip-early-err-try.case @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is not observed when creation of variable binding would produce an + early error (try statement) +template: eval-func +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-global-no-skip-try.case b/src/annex-b-fns/eval-global-no-skip-try.case new file mode 100644 index 0000000000..fe04f27b8e --- /dev/null +++ b/src/annex-b-fns/eval-global-no-skip-try.case @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is observed when creation of variable binding would not produce an + early error (try statement) +template: eval-global +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +//- before +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { +//- body +return 123; +//- after +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/src/annex-b-fns/eval-global-skip-early-err-block.case b/src/annex-b-fns/eval-global-skip-early-err-block.case new file mode 100644 index 0000000000..726c932504 --- /dev/null +++ b/src/annex-b-fns/eval-global-skip-early-err-block.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (Block statement) +template: eval-global +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); +//- before +{ +let f = 123; +//- after +} +//- teardown +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-global-skip-early-err-for-in.case b/src/annex-b-fns/eval-global-skip-early-err-for-in.case new file mode 100644 index 0000000000..1e9a6d5847 --- /dev/null +++ b/src/annex-b-fns/eval-global-skip-early-err-for-in.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +template: eval-global +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); +//- before +for (let f in { key: 0 }) { +//- after +} +//- teardown +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-global-skip-early-err-for-of.case b/src/annex-b-fns/eval-global-skip-early-err-for-of.case new file mode 100644 index 0000000000..fa09372073 --- /dev/null +++ b/src/annex-b-fns/eval-global-skip-early-err-for-of.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +template: eval-global +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); +//- before +for (let f of [0]) { +//- after +} +//- teardown +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-global-skip-early-err-for.case b/src/annex-b-fns/eval-global-skip-early-err-for.case new file mode 100644 index 0000000000..e2fc6fdfa9 --- /dev/null +++ b/src/annex-b-fns/eval-global-skip-early-err-for.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for statement) +template: eval-global +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); +//- before +for (let f; ; ) { +//- after + break; +} +//- teardown +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-global-skip-early-err-switch.case b/src/annex-b-fns/eval-global-skip-early-err-switch.case new file mode 100644 index 0000000000..46b5d1ead9 --- /dev/null +++ b/src/annex-b-fns/eval-global-skip-early-err-switch.case @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (switch statement) +template: eval-global +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); +//- before +switch (0) { + default: + let f; +//- after +} +//- teardown +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/eval-global-skip-early-err-try.case b/src/annex-b-fns/eval-global-skip-early-err-try.case new file mode 100644 index 0000000000..47332bc708 --- /dev/null +++ b/src/annex-b-fns/eval-global-skip-early-err-try.case @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is not observed when creation of variable binding would produce an + early error (try statement) +template: eval-global +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/func-no-skip-try.case b/src/annex-b-fns/func-no-skip-try.case new file mode 100644 index 0000000000..d46944a084 --- /dev/null +++ b/src/annex-b-fns/func-no-skip-try.case @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is observed when creation of variable binding would not produce an + early error (try statement) +template: func +info: | + 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. +---*/ + +//- before +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { +//- body +return 123; +//- after +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/src/annex-b-fns/func-skip-early-err-block.case b/src/annex-b-fns/func-skip-early-err-block.case new file mode 100644 index 0000000000..5dc064e733 --- /dev/null +++ b/src/annex-b-fns/func-skip-early-err-block.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (Block statement) +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 + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/func-skip-early-err-for-in.case b/src/annex-b-fns/func-skip-early-err-for-in.case new file mode 100644 index 0000000000..980339763f --- /dev/null +++ b/src/annex-b-fns/func-skip-early-err-for-in.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +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 + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/func-skip-early-err-for-of.case b/src/annex-b-fns/func-skip-early-err-for-of.case new file mode 100644 index 0000000000..b06e3fce17 --- /dev/null +++ b/src/annex-b-fns/func-skip-early-err-for-of.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +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 + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/func-skip-early-err-for.case b/src/annex-b-fns/func-skip-early-err-for.case new file mode 100644 index 0000000000..6cae068a8b --- /dev/null +++ b/src/annex-b-fns/func-skip-early-err-for.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for statement) +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 + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { +//- after + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/func-skip-early-err-switch.case b/src/annex-b-fns/func-skip-early-err-switch.case new file mode 100644 index 0000000000..3ba69334ce --- /dev/null +++ b/src/annex-b-fns/func-skip-early-err-switch.case @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (switch statement) +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 + [...] +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/func-skip-early-err-try.case b/src/annex-b-fns/func-skip-early-err-try.case new file mode 100644 index 0000000000..9631a45a53 --- /dev/null +++ b/src/annex-b-fns/func-skip-early-err-try.case @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is observed when creation of variable binding would not produce an + early error (try statement) +template: func +info: | + 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. +---*/ + +//- before +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { +//- after +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/global-no-skip-try.case b/src/annex-b-fns/global-no-skip-try.case new file mode 100644 index 0000000000..71c8400aa0 --- /dev/null +++ b/src/annex-b-fns/global-no-skip-try.case @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is observed when creation of variable binding would not produce an + early error (try statement) +template: global +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ + +//- setup +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { +//- body +return 123; +//- teardown +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/src/annex-b-fns/global-skip-early-err-block.case b/src/annex-b-fns/global-skip-early-err-block.case new file mode 100644 index 0000000000..2f7d97b54d --- /dev/null +++ b/src/annex-b-fns/global-skip-early-err-block.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (Block statement) +template: global +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; +//- teardown +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/global-skip-early-err-for-in.case b/src/annex-b-fns/global-skip-early-err-for-in.case new file mode 100644 index 0000000000..0993afb731 --- /dev/null +++ b/src/annex-b-fns/global-skip-early-err-for-in.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +template: global +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { +//- teardown +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/global-skip-early-err-for-of.case b/src/annex-b-fns/global-skip-early-err-for-of.case new file mode 100644 index 0000000000..567644e743 --- /dev/null +++ b/src/annex-b-fns/global-skip-early-err-for-of.case @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for-of statement) +template: global +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { +//- teardown +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/global-skip-early-err-for.case b/src/annex-b-fns/global-skip-early-err-for.case new file mode 100644 index 0000000000..9e1cc44fdf --- /dev/null +++ b/src/annex-b-fns/global-skip-early-err-for.case @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (for statement) +template: global +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { +//- teardown + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/global-skip-early-err-switch.case b/src/annex-b-fns/global-skip-early-err-switch.case new file mode 100644 index 0000000000..c5b430d9e9 --- /dev/null +++ b/src/annex-b-fns/global-skip-early-err-switch.case @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension not observed when creation of variable binding would produce an + early error (switch statement) +template: global +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; +//- teardown +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/src/annex-b-fns/global-skip-early-err-try.case b/src/annex-b-fns/global-skip-early-err-try.case new file mode 100644 index 0000000000..45058461d7 --- /dev/null +++ b/src/annex-b-fns/global-skip-early-err-try.case @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Extension is observed when creation of variable binding would not produce an + early error (try statement) +template: global +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ + +//- setup +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { +//- teardown +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-block-scoping.js index d8533d50fb..4a93e0825b 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Block statement in eval code con esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-no-init.js index 320d44ef4a..6ff8750f30 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-update.js index 650c0ac8cc..4d40ddfd50 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Block statement in eval code co esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-no-init.js index ffc1d300df..c8f3cb4bab 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in eval esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-update.js index ae1798afc6..8bd5b9024c 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-no-init.js index 2a3f6da978..65bf8da2ea 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in eval esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-update.js index 630a1f1d7c..9183b04811 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-init.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-init.js index b3c52cda9d..d14c3b0e39 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-init.js @@ -6,9 +6,9 @@ description: Variable binding is initialized to `undefined` in outer scope (Bloc esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-param.js index 4060724dc5..c633517471 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-param.js @@ -6,9 +6,9 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-try.js new file mode 100644 index 0000000000..b8f2cfe235 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-try.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-block.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {{ function f() { return 123; } }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..9e53d7cd32 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-block.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;{ function f() { } }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..6ac27ca34e --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-in.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {{ function f() { } }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..7d585a7ed8 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for-of.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {{ function f() { } }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..a98762f861 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-for.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {{ function f() { } }break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..d53376e729 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-switch.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;{ function f() { } }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..9788891a0f --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-block.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {{ function f() { } }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err.js index 10ea83f556..aa2bce5c55 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-update.js b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-update.js index ee78459712..aa8216214c 100644 --- a/test/annexB/language/eval-code/direct/func-block-decl-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-block-decl-eval-func-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Block state esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-block-scoping.js index 10b3d18eea..7bb0b5735b 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-no-init.js index 1c4b16339f..e0599921ed 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-update.js index 3420e79c65..1b4b1ee999 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-no-init.js index 35c10ae5b5..a4c58f0cef 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-update.js index 7d60a2c9e5..c9ef386a62 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-no-init.js index 76135262bf..5d145b0619 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-update.js index 4348c6f6f7..b67d7a1394 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-init.js index 7e8f99f3a6..2d3c6068dd 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-param.js index 19c36fb021..d693f0caab 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-param.js @@ -6,18 +6,18 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-try.js new file mode 100644 index 0000000000..5a6029524c --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-a.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; } else function _f() {}}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..b317b8b327 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-block.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;if (true) function f() { } else function _f() {}}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..cf10d13dfc --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-in.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {if (true) function f() { } else function _f() {}}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..f4e063cc0f --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for-of.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {if (true) function f() { } else function _f() {}}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..092b5ef7a1 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-for.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {if (true) function f() { } else function _f() {}break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..61bbf03be1 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-switch.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;if (true) function f() { } else function _f() {}}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..0db003af7c --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err-try.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-a.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { } else function _f() {}}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err.js index a6e83975f9..450797fa9a 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-update.js index fc5e5bb957..9b9d618761 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-block-scoping.js index 72b3847967..5e36e28d11 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-no-init.js index a85a229044..59f20d74d6 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-update.js index 7a97f23e65..a0cc11d0b3 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-no-init.js index 0d285f26d4..1c7ed613e8 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-update.js index 5679c966b3..595c0fe846 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-no-init.js index d5ace96935..cbf8314733 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-update.js index ca15456d4f..6e7b229314 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-init.js index ec92dbc0f8..d6d3895f91 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-param.js index 6f73881e40..efff4672d9 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-param.js @@ -6,18 +6,18 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-try.js new file mode 100644 index 0000000000..1ccab1e3af --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-b.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (false) function _f() {} else function f() { return 123; }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..d68fc9fd60 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-block.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;if (false) function _f() {} else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..9bc2db66d6 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-in.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {if (false) function _f() {} else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..3c70bc2976 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for-of.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {if (false) function _f() {} else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..01e1191252 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-for.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {if (false) function _f() {} else function f() { }break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..2cbb0182e2 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-switch.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;if (false) function _f() {} else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..71816738d9 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err-try.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-decl-b.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (false) function _f() {} else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err.js index 8196747e82..bc8b712d3a 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-update.js index d4de052d62..a337ccc63b 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-block-scoping.js index ece6a2f44a..1651d44a5c 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-no-init.js index fb6fd8fa55..4f6223a009 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-update.js index ec377af61a..f5f75eed91 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-no-init.js index 020c5de1ec..dc3ede644b 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-update.js index ed999ecc42..ea9d1ec4d4 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-no-init.js index 77d5efffa6..fa8f76cba7 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-update.js index 4ad6703fbd..eb922fc71c 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-init.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-init.js index cd73b10322..6df813a3fa 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-param.js index 36d39bc45c..17fe97e411 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-param.js @@ -6,18 +6,18 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-try.js new file mode 100644 index 0000000000..cbd988ce28 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-stmt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; } else ;}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..c25c3ab475 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-block.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;if (true) function f() { } else ;}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..5e98627aa4 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-in.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {if (true) function f() { } else ;}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..f09656effe --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for-of.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {if (true) function f() { } else ;}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..ae1d6f5a36 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-for.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {if (true) function f() { } else ;break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..870d39b0f2 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-switch.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;if (true) function f() { } else ;}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..b6e0886c7d --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err-try.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-else-stmt.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { } else ;}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err.js index c445a5b6ef..dcc3e12509 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-update.js b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-update.js index fc98ed89e5..ef257a963f 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-block-scoping.js index 00a50db1af..36e26b2691 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement without an else clau esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-no-init.js index 1d510f8e20..93a97011ba 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-update.js index 50fdf16f67..2351c4e4c5 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement without an else cla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-no-init.js index 6ce5c0ee2b..738aad4e21 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-update.js index 2a6d761bbc..7372fc1fca 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-no-init.js index 98d7bf6b37..9d0b9ba196 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-update.js index 367d91db54..037aaae6d7 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-init.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-init.js index 9afcd6ceeb..4e390b67ea 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-param.js index d6fbba2bfc..ff27d9c604 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-param.js @@ -6,18 +6,18 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-try.js new file mode 100644 index 0000000000..c43e6e3a03 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-no-else.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..463237d727 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-block.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;if (true) function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..ce0fc0ace0 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-in.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {if (true) function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..9388c3cac9 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for-of.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {if (true) function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..55166eaf46 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-for.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {if (true) function f() { }break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..109ec5441e --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-switch.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;if (true) function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..b3dc095d31 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err-try.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-if-decl-no-else.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err.js index 14fbd527b4..9940f43d43 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-update.js b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-update.js index 34f3a75185..15f3fccd8c 100644 --- a/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-block-scoping.js index 3cd18b4758..a5eac52f8c 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-no-init.js index ffe7aa1763..78b7e72e31 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-update.js index 1ae723dcec..179f1ffed4 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-no-init.js index 8be95240ae..79ccb3c18b 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-update.js index 3e5610c9ec..06513a992b 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-no-init.js index b7bd73a9ba..69f9c2950a 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-update.js index 18467f5031..5b04cc86b1 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-init.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-init.js index c84ffef899..4a732afab6 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-param.js index 90e4b58075..612de182cf 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-param.js @@ -6,18 +6,18 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-try.js new file mode 100644 index 0000000000..22842e7781 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-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 eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + '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);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..34583bd0c2 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-block.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;if (false) ; else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..3eafd8d750 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-in.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {if (false) ; else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..f27e9ccf81 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for-of.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {if (false) ; else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..67cc2ff176 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-for.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {if (false) ; else function f() { }break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..9c9711a68c --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-switch.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;if (false) ; else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..eee2a2a95f --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err-try.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-if-stmt-else-decl.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (false) ; else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err.js index d83370d0c4..d07bc2987e 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-update.js b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-update.js index 2da5c847ba..db17b925f1 100644 --- a/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-block-scoping.js index 6482c929e5..84c9cddd79 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Function declaration in the `cas esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-no-init.js index a5c18e6fe8..9639be64ab 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-update.js index 4ab041a088..d98e2027b7 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Function declaration in the `ca esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-no-init.js index 34f913d3b0..65738e3f87 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-update.js index 390a660ae5..6e19647bf9 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-no-init.js index 7d36129c1d..a208a4b7e3 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-update.js index 29d021449a..8af5bf4d22 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-init.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-init.js index 428739f2a3..266209819c 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-init.js @@ -6,9 +6,9 @@ description: Variable binding is initialized to `undefined` in outer scope (Func esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-param.js index 2dacd5cf4f..de53f14313 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-param.js @@ -6,9 +6,9 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-try.js new file mode 100644 index 0000000000..bc622ce651 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-try.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-switch-case.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {switch (1) {' + + ' case 1:' + + ' function f() { return 123; }' + + '}\ + }\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..859efa6f83 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-block.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..75bb1540c7 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-in.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..f413496c11 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for-of.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..832104cb79 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-for.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..57112d815e --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-switch.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..356c69ce11 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err-try.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-switch-case.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err.js index cc34436a96..19ec00827a 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-update.js b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-update.js index c7fbf57083..644e26b122 100644 --- a/test/annexB/language/eval-code/direct/func-switch-case-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-case-eval-func-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Function de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-block-scoping.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-block-scoping.js index 0dbb01d748..d27452535e 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-block-scoping.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Funtion declaration in the `defa esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-no-init.js index 5f0640e062..2d7a7c685b 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-update.js index 36b3aff56f..6c5603ddea 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Funtion declaration in the `def esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-no-init.js index f9c2b408d4..6184bdf134 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-update.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-update.js index 048de34495..0818ec467d 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-no-init.js index 121a3372d5..20093edf1a 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-update.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-update.js index 39e9356d92..b996c8a34e 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-init.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-init.js index 689dbeb0a0..57ebb3467f 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-init.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-init.js @@ -6,9 +6,9 @@ description: Variable binding is initialized to `undefined` in outer scope (Funt esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then i. If varEnvRec is a global Environment Record, then diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-param.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-param.js index 3d31b1ccb6..9bf130c941 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-param.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-param.js @@ -6,9 +6,9 @@ description: Extension observed when there is a formal parameter with the same n esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-try.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-try.js new file mode 100644 index 0000000000..15f79c18ac --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-try.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-no-skip-try.case +// - src/annex-b-fns/eval-func/direct-switch-dflt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {switch (1) {' + + ' default:' + + ' function f() { return 123; }' + + '}\ + }\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-block.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-block.js new file mode 100644 index 0000000000..7d5a898190 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-block.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-block.case +// - src/annex-b-fns/eval-func/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + {\ + let f = 123;switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..94205beedf --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-in.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-in.case +// - src/annex-b-fns/eval-func/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f in { key: 0 }) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..a7b4a00cef --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for-of.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for-of.case +// - src/annex-b-fns/eval-func/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f of [0]) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for.js new file mode 100644 index 0000000000..cf01f546a7 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-for.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-for.case +// - src/annex-b-fns/eval-func/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + for (let f; ; ) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + break;\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-switch.js new file mode 100644 index 0000000000..129748fbc8 --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-switch.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-switch.case +// - src/annex-b-fns/eval-func/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ + +(function() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + switch (0) {\ + default:\ + let f;switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-try.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-try.js new file mode 100644 index 0000000000..dde36b56ae --- /dev/null +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err-try.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-func-skip-early-err-try.case +// - src/annex-b-fns/eval-func/direct-switch-dflt.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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() { + eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' + ); +}()); diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err.js index d9f5fdf821..3eb6fa6300 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-update.js b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-update.js index 1538f7f34b..2eac01615f 100644 --- a/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-update.js +++ b/test/annexB/language/eval-code/direct/func-switch-dflt-eval-func-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Funtion dec esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-block-scoping.js index 4974fbc0b8..86d779531a 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Block statement in eval code con esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-no-init.js index 8ced75b9c3..a80c8a0c65 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-update.js index f3f3cb1895..05b2c0f3bd 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Block statement in eval code co esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-no-init.js index d3bcdd0c81..7b2fcf6c1b 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in eval esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-update.js index b0b9854d38..97ecf211eb 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-init.js index e0a8dc661a..752a674b00 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-init.js @@ -7,16 +7,16 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -24,7 +24,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-update.js index 7e4e93239c..840ac88149 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-global-update.js @@ -7,9 +7,9 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -21,7 +21,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-no-init.js index 53e01e1d3d..17779ac298 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in eval esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-update.js index d0859ce95e..5e8a0408ec 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-init.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-init.js index a7c28ba4df..ac9ec0b0b0 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-init.js @@ -7,14 +7,14 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -24,5 +24,5 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - { function f() { } }' +{ function f() { } }' ); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-no-skip-try.js new file mode 100644 index 0000000000..b490a5db5c --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-no-skip-try.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-block.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {{ function f() { return 123; } }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..508ac41b1e --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-block.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..9485525caa --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-in.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..f1da1b56b1 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for-of.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..9113513cfe --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-for.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {{ function f() { } }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..bee092eded --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-switch.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..0d054d3c28 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err-try.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-block.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {{ function f() { } }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err.js index 2c52edb5d5..ce88c0b60a 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-update.js b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-update.js index 70b26bf81c..d9d35f897d 100644 --- a/test/annexB/language/eval-code/direct/global-block-decl-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-block-decl-eval-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Block state esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-block-scoping.js index 4cdec0c853..940921c674 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js index 03dc38036e..9abe873d46 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js index 778a388fd3..5ffc8449e4 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js index 2bcb3db8ea..c9169574dc 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js index 7135f2110c..5246a6ee2b 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-init.js index 901a133c55..bfa9aa4750 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-update.js index 4c674bb35b..df0543d538 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js index c6845e0043..9f2855b5af 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-update.js index 248a676056..a73827418e 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-init.js index 8c890c9913..f3961ddd68 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -33,5 +33,5 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (true) function f() { } else function _f() {}' +if (true) function f() { } else function _f() {}' ); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-no-skip-try.js new file mode 100644 index 0000000000..29a0f11434 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-a.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; } else function _f() {}}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..61a1a3067b --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..d86552ff6f --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..74188feec7 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..b7c48f3f5b --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {if (true) function f() { } else function _f() {}break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..c5724fd3a2 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..5639dbe183 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-a.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { } else function _f() {}}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err.js index 26257a2738..9375a32237 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-update.js index f0dcf5fec8..915229294e 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-a-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-block-scoping.js index 9786d4a61c..696106433b 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js index b08c78febc..ac4cad4d1b 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js index 52481dc1ae..bd8b973d67 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js index d707e97afa..e26106ea67 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js index 25b4bcf428..eeb18ffba4 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-init.js index b4abb69998..1976c69f00 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-update.js index 8264e05c53..f6c6c2b396 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js index 0d43376ae5..2210464e28 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-update.js index a82288f823..5351488b8a 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-init.js index d370cdca50..1663c6b989 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -33,5 +33,5 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (false) function _f() {} else function f() { }' +if (false) function _f() {} else function f() { }' ); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-no-skip-try.js new file mode 100644 index 0000000000..0893c6bf28 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-b.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (false) function _f() {} else function f() { return 123; }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..d592c9a89c --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..a4983128d2 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..21a83f5643 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..44d4ce37c1 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {if (false) function _f() {} else function f() { }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..5d255610c6 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..619d4ef303 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-decl-b.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (false) function _f() {} else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err.js index 22c6835d04..cfc1796383 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-update.js index ea55626498..fe36695ec4 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-decl-b-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-block-scoping.js index 4713298ebe..989c3954a2 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js index cf7e29dd03..8b06ac5f53 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js index 2d0c51b48f..7a564e847b 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js index 16af4eca3b..f9a5d6e4ab 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-update.js index 8b00ba4c87..87b067e30a 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-init.js index b5fe831588..cc99a93d0c 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-update.js index dcf3554d53..9f63f346cc 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js index e7842b2f0f..b65ad017c8 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-update.js index 2b58a82279..749607cdb2 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-init.js index a3851495e9..a9f6001baa 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -33,5 +33,5 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (true) function f() { } else ;' +if (true) function f() { } else ;' ); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-no-skip-try.js new file mode 100644 index 0000000000..9ed5f09d0b --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-stmt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; } else ;}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..b654eabb62 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..c2ea50742e --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..f0e33f36d8 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..49fcec3c00 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {if (true) function f() { } else ;break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..3504c1c3dd --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..ff0a4f9a08 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-else-stmt.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { } else ;}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err.js index 5f9e2b9f6a..183c7011de 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-update.js index 6c931d27de..5462508757 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-else-stmt-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-block-scoping.js index bd6703af95..9744b86684 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement without an else clau esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js index 5968bdbc9e..3e18ec4b1b 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-update.js index 101b6432c6..f65791dc6f 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement without an else cla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-no-init.js index 9aca52bdc9..3c681ec531 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-update.js index 4ecde117e3..76ec5c1560 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-init.js index dc9cf650f3..92c84cf69b 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-update.js index d628d593f1..9f6c90ba1c 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-no-init.js index 8504f3d38e..caf029cb1b 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-update.js index 8fdef47cd3..b4bfb9df9a 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-init.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-init.js index 8e23891f12..f3f99ed9c9 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -33,5 +33,5 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (true) function f() { }' +if (true) function f() { }' ); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-no-skip-try.js new file mode 100644 index 0000000000..587073c05e --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-no-else.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..4439269297 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..f3603f8a6d --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..05a80e43ff --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..b62a236aae --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {if (true) function f() { }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..869e5c9f0c --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..77edf2ce74 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-if-decl-no-else.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err.js index c82083c110..f72f5e9677 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-update.js b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-update.js index daf64def45..d0d77ed6e9 100644 --- a/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-decl-no-else-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-block-scoping.js index 6254f0ec46..fc30a15978 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js index b20febb44e..e9523d0937 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js index 53a09d9732..f02922332a 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js index 70f62635db..ba34bf1975 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-update.js index b1df92b70c..ec78c56a77 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-init.js index b609db7f04..344acbf58d 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-update.js index ec5fcb243d..5eb973c40e 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js index 190dae79e5..4567e70674 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-update.js index 4a25ddc366..5338ac8c8f 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-init.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-init.js index 306e165e1d..f7ac6d81a2 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -33,5 +33,5 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (false) ; else function f() { }' +if (false) ; else function f() { }' ); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-no-skip-try.js new file mode 100644 index 0000000000..7d31108305 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-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 eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + '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);' +); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..d43ad80bce --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..f9781602fe --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..9b9f2ea08d --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..95cbbefc49 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {if (false) ; else function f() { }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..8ee39b4dc0 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..245b23b7ce --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-if-stmt-else-decl.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (false) ; else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err.js index 6447a04eb9..6909220281 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-update.js b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-update.js index f847a4a2e1..39bbc45c80 100644 --- a/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-if-stmt-else-decl-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-block-scoping.js index 4c63c97085..87d2afa0c4 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Function declaration in the `cas esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-no-init.js index f667c5a82a..07cef87a05 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-update.js index f37e200f37..ff760ab87f 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Function declaration in the `ca esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-no-init.js index d4b4828a61..22ce2bcd87 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-update.js index 3977347b47..cf1ccd94c9 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-init.js index 51c9bae0bd..fcef0d95a0 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-init.js @@ -7,16 +7,16 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -24,7 +24,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-update.js index 0718eea90b..2f72b649c4 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-global-update.js @@ -7,9 +7,9 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -21,7 +21,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-no-init.js index 310826029d..4a596ea5ee 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-update.js index 5f16b1ff9a..8c9d72f7cd 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-init.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-init.js index cdc416145b..aaf3b02192 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-init.js @@ -7,14 +7,14 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -24,7 +24,7 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - switch (1) {' + +switch (1) {' + ' case 1:' + ' function f() { }' + '}\ diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-no-skip-try.js new file mode 100644 index 0000000000..88ea95f0d7 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-no-skip-try.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-switch-case.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {switch (1) {' + + ' case 1:' + + ' function f() { return 123; }' + + '}\ + }\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..c95e660156 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-block.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..c23d28919d --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-in.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..3aeeba917f --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for-of.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..212e3fb112 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-for.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..af7caccc1c --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-switch.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..943cf36d18 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-switch-case.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err.js index 7800e5a36d..24e399a440 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-update.js b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-update.js index 6edf149824..5e95cd911f 100644 --- a/test/annexB/language/eval-code/direct/global-switch-case-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-case-eval-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Function de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-block-scoping.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-block-scoping.js index cdd0e8f1f3..dafb4f2a0a 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Funtion declaration in the `defa esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-no-init.js index 2b0b096bd3..5a397dbcd8 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-update.js index 74dc367ee6..4263787f58 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Funtion declaration in the `def esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-no-init.js index f723685d99..e96586a316 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-update.js index 5430a4684d..0be8fb0b6c 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-init.js index 25b038a6b5..510bb4d055 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-init.js @@ -7,16 +7,16 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -24,7 +24,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-update.js index 317df97d47..25590ff106 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-global-update.js @@ -7,9 +7,9 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -21,7 +21,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-no-init.js index e45406c6be..80a285352c 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-update.js index 4d5a248e15..1502e12f88 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-init.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-init.js index 835afc1886..7401507727 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-init.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-init.js @@ -7,14 +7,14 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ eval( @@ -24,7 +24,7 @@ eval( verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - switch (1) {' + +switch (1) {' + ' default:' + ' function f() { }' + '}\ diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-no-skip-try.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-no-skip-try.js new file mode 100644 index 0000000000..93d4afd69e --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-no-skip-try.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/direct-switch-dflt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {switch (1) {' + + ' default:' + + ' function f() { return 123; }' + + '}\ + }\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..9450d935a2 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-block.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + '{\ + let f = 123;switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..90e87beb1d --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-in.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f in { key: 0 }) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..15b81219d8 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for-of.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f of [0]) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..8840bfdf36 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-for.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'for (let f; ; ) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..49d3ea52e2 --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-switch.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/direct-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +eval( + 'switch (0) {\ + default:\ + let f;switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..917c03c18e --- /dev/null +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/direct-switch-dflt.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +eval( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err.js index bb7ebb2dfd..02cfcb0740 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-update.js b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-update.js index 4b7e30b0f9..112b4280d2 100644 --- a/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-update.js +++ b/test/annexB/language/eval-code/direct/global-switch-dflt-eval-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Funtion dec esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-block-scoping.js index fb38b478cb..281aff6b42 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Block statement in eval code con esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-no-init.js index 92927ac11f..101ce7b524 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-update.js index 8b374b4f88..4015d0a19e 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Block statement in eval code co esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-no-init.js index 6580ff6039..85144b8138 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in eval esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-update.js index b31d4909b6..589772c834 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-init.js index 5cc515e2a8..2d819ee16d 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-init.js @@ -7,16 +7,16 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -24,7 +24,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-update.js index efeea1a32c..1e77b0e1e2 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-update.js @@ -7,9 +7,9 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -21,7 +21,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-no-init.js index 38f976d2bd..52722c3c0e 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in eval esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-update.js index 40273b0800..9f6abc2170 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-init.js index fe56d1e397..250df9f718 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-init.js @@ -7,14 +7,14 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -24,5 +24,5 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - { function f() { } }' +{ function f() { } }' ); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-no-skip-try.js new file mode 100644 index 0000000000..8ac84251b3 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-no-skip-try.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-block.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {{ function f() { return 123; } }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..100f1f4a86 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-block.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..ed612d0c16 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-in.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..a22ed2f582 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for-of.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..a74ddb4ae2 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-for.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {{ function f() { } }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..62b12b24ae --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-switch.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;{ function f() { } }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..5e4fc6e6ed --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err-try.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-block.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Block statement in eval code containing a function declaration) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {{ function f() { } }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err.js index e7b1f3e10b..c729084a84 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-update.js index 8019354cb3..79a0c9cf9a 100644 --- a/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-block-decl-eval-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Block state esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-block-scoping.js index df0a4e0367..8c368cd319 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js index 3a4cfcc5b4..eef5e6ae63 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js index 68d679d5f0..41086486ec 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js index c2abf1b3e6..de48fbab70 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js index 9591f59a17..05bbf83bef 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-init.js index 8ff100839a..52655f844b 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-update.js index 8044e4915c..ad7723acc4 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js index 4577d09d27..00adefafdf 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-update.js index d407779f00..d8c87d6346 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-init.js index aba07748b8..a3f9371216 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -33,5 +33,5 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (true) function f() { } else function _f() {}' +if (true) function f() { } else function _f() {}' ); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-no-skip-try.js new file mode 100644 index 0000000000..0701f50f9c --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-a.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; } else function _f() {}}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..e567da4756 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..7f2ea0ef16 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..3d3f0cbd1e --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..60dd5b57a8 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {if (true) function f() { } else function _f() {}break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..a2b8924930 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;if (true) function f() { } else function _f() {}}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..a52c846da2 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-a.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.3 +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { } else function _f() {}}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err.js index ee5dabc162..4d12d4b227 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-update.js index 94e1571bda..ec63ec14fb 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.3 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-block-scoping.js index b9355710f8..75e3ff104c 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js index 03ac26f6e7..acc25ae2c0 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js index 8e07a11285..beb319ef01 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js index b84e00d82b..96067c9804 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js index 6cea720b29..555d969eb5 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-init.js index 93254ec269..f899844a6a 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-update.js index aa1d8b26a6..5cf0cf1b2b 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js index fbad47187a..4576fd8cac 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-update.js index 991044ebfb..aa41be9bba 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-init.js index a817f65bd0..7054756a4c 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -33,5 +33,5 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (false) function _f() {} else function f() { }' +if (false) function _f() {} else function f() { }' ); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-no-skip-try.js new file mode 100644 index 0000000000..e61266ddf0 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-b.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (false) function _f() {} else function f() { return 123; }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..839a640fa1 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..c35901a112 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..25bee4da59 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..8bf570ed93 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {if (false) function _f() {} else function f() { }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..691df1dbbd --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;if (false) function _f() {} else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..8f2c3bf27e --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-decl-b.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in both statement positions in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (false) function _f() {} else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err.js index 03d0d408c0..e0c4ec4c57 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-update.js index 30b32f786b..1290d0831f 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-block-scoping.js index cd558c772b..b26c8833da 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js index c6d352e046..43d4189006 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js index e4c2c902de..c09bde6284 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js index bf6084830a..f88f2122e4 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-update.js index e5326a3722..40d0438c6c 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-init.js index d94fb8d6c5..1190285edb 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-update.js index 7c98c96a45..2d58315dec 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js index da8eb93b30..1e61af9519 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-update.js index 5304fde51c..e42177ef20 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-init.js index bc49b2957f..7208aa7730 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -33,5 +33,5 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (true) function f() { } else ;' +if (true) function f() { } else ;' ); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-no-skip-try.js new file mode 100644 index 0000000000..dc81cc7865 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; } else ;}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..332473d5c9 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..5956c3dff6 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..9c808eb282 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..b9604dbe80 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {if (true) function f() { } else ;break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..615d835343 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;if (true) function f() { } else ;}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..e49acd1a41 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in the first statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { } else ;}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err.js index b4e891edf3..708a92f63f 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-update.js index 313e29c378..9173cc39d4 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-block-scoping.js index ee20009cd6..c5690a30f2 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement without an else clau esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js index 51bd5749cb..f948b208f7 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-update.js index 104442ef2b..3210fba3a5 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement without an else cla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-no-init.js index a3221fff45..e49810917c 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-update.js index 87d38cf413..f0cc6c8273 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-init.js index 4834d37f8a..98ec165ffc 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-update.js index 9f997fefbf..2e617301fe 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-no-init.js index bb8aa83b47..34c9a9c333 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-update.js index b0bc9fce3d..344fb9bf78 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-init.js index f3db0a749f..bb889ccd93 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -33,5 +33,5 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (true) function f() { }' +if (true) function f() { }' ); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-no-skip-try.js new file mode 100644 index 0000000000..bb8710bfd8 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-no-else.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {if (true) function f() { return 123; }}\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..1469c05608 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..b2f31f0765 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..20b50c2c1f --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..2342001e52 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {if (true) function f() { }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..d1ee6539ae --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;if (true) function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..5a4bd7d4f8 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-if-decl-no-else.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement without an else clause in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (true) function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err.js index 97e614cf18..7b26e625ce 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-update.js index f2386f1a38..929678653c 100644 --- a/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-block-scoping.js index 71efc9ef75..7c5aae05e0 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js index cbf132fd17..2c0f2d87fb 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js index 07fdce016d..177f234a26 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js index b25d4cb1ea..498010a114 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-update.js index 6dff085975..496731b390 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-init.js index 1c89e330cd..88f5a81a6f 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-init.js @@ -7,25 +7,25 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -33,7 +33,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-update.js index bb1f60520a..1a2c91b145 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-global-update.js @@ -7,18 +7,18 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -30,7 +30,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js index 2ccbe3994d..49b5bc6398 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-update.js index 124f502d03..0f2e559c93 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-init.js index 774168f103..a223be102e 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-init.js @@ -7,23 +7,23 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -33,5 +33,5 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - if (false) ; else function f() { }' +if (false) ; else function f() { }' ); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-no-skip-try.js new file mode 100644 index 0000000000..3addf9af6a --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-no-skip-try.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-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 eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + '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);' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..617d6e0bc4 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-block.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..fc569622bd --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-in.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..f53d893c4f --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for-of.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..1fad833946 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-for.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {if (false) ; else function f() { }break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..d4ea74dccc --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-switch.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;if (false) ; else function f() { }}' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..f5ef79b77b --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err-try.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-if-stmt-else-decl.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (IfStatement with a declaration in the second statement position in eval code) +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.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {if (false) ; else function f() { }}\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err.js index 3b7e38c39d..2ecf0c87fc 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-update.js index 20f7f4060f..a5c6f3638a 100644 --- a/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-block-scoping.js index 5583ab9bf4..8e064e3693 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Function declaration in the `cas esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-no-init.js index c5f87145ed..7215acf018 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-update.js index 7ea3150d44..476bf9f9ff 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Function declaration in the `ca esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-no-init.js index 833bfe5243..3d769c29a9 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-update.js index 6ac05bc441..47e337b278 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-init.js index 8dacef7ebd..a5ba9deb16 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-init.js @@ -7,16 +7,16 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -24,7 +24,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-update.js index 27611165a7..607fb06172 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-update.js @@ -7,9 +7,9 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -21,7 +21,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-no-init.js index 925019d540..ebdb9588bf 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-update.js index b2b0a808f5..69d6a6e1d6 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-init.js index 47578f960c..9e05d398f8 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-init.js @@ -7,14 +7,14 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -24,7 +24,7 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - switch (1) {' + +switch (1) {' + ' case 1:' + ' function f() { }' + '}\ diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-no-skip-try.js new file mode 100644 index 0000000000..74f4158117 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-no-skip-try.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-switch-case.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {switch (1) {' + + ' case 1:' + + ' function f() { return 123; }' + + '}\ + }\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..0004c08b15 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-block.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..82bb484253 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-in.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..5ebb2c54d1 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for-of.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..06850b06b6 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-for.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..fafaa05701 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-switch.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..9503b016db --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-switch-case.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in eval code) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {switch (1) {' + + ' case 1:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err.js index edeef7fc01..c6b601b280 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-update.js index 85a67db684..eee6b62f80 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-case-eval-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Function de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-block-scoping.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-block-scoping.js index b73df235ff..3c3b791a9b 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-block-scoping.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Funtion declaration in the `defa esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-no-init.js index 723b7331b7..59d7cd0616 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-update.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-update.js index 32391f34a7..f91889a743 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Funtion declaration in the `def esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-no-init.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-no-init.js index e244e5629d..20e4b80c09 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-update.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-update.js index 9c56ac916e..831f1fccbc 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-init.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-init.js index 3f0264645f..826f6a8491 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-init.js @@ -7,16 +7,16 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + 8.1.1.4.18 CreateGlobalFunctionBinding - + [...] 5. If existingProp is undefined or existingProp.[[Configurable]] is true, then @@ -24,7 +24,7 @@ info: > 6. Else, a. Let desc be the PropertyDescriptor{[[Value]]: V }. [...] - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: 'x', diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-update.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-update.js index 3fa35bf0e7..b3bad895f1 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-global-update.js @@ -7,9 +7,9 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -21,7 +21,7 @@ info: > v. Let fobj be ! benvRec.GetBindingValue(F, false). vi. Perform ? genvRec.SetMutableBinding(F, fobj, false). vii. Return NormalCompletion(empty). - + ---*/ Object.defineProperty(fnGlobalObject(), 'f', { value: function() { return 'Another function'; }, diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-no-init.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-no-init.js index cc1ad62763..2f900f6992 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-no-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] a. If declaredFunctionOrVarNames does not contain F, then [...] diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-update.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-update.js index 705118ec59..85fdd83f77 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-init.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-init.js index 74d444688c..c9eb03bc77 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-init.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-init.js @@ -7,14 +7,14 @@ esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] i. If varEnvRec is a global Environment Record, then i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true). [...] - + ---*/ (0,eval)( @@ -24,7 +24,7 @@ info: > verifyEnumerable(global, "f");\ verifyWritable(global, "f");\ verifyConfigurable(global, "f");\ - switch (1) {' + +switch (1) {' + ' default:' + ' function f() { }' + '}\ diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-no-skip-try.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-no-skip-try.js new file mode 100644 index 0000000000..95308f71d9 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-no-skip-try.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-no-skip-try.case +// - src/annex-b-fns/eval-global/indirect-switch-dflt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.sameValue(\ + f, undefined, "Initialized binding created prior to evaluation"\ + );\ + \ + try {\ + throw null;\ + } catch (f) {switch (1) {' + + ' default:' + + ' function f() { return 123; }' + + '}\ + }\ + \ + assert.sameValue(\ + typeof f,\ + "function",\ + "binding value is updated following evaluation"\ + );\ + assert.sameValue(f(), 123);' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-block.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-block.js new file mode 100644 index 0000000000..5c12cdaa0f --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-block.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-block.case +// - src/annex-b-fns/eval-global/indirect-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + '{\ + let f = 123;switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-in.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..9b819ebd73 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-in.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-in.case +// - src/annex-b-fns/eval-global/indirect-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f in { key: 0 }) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-of.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..4a12e736bf --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for-of.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for-of.case +// - src/annex-b-fns/eval-global/indirect-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f of [0]) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for.js new file mode 100644 index 0000000000..cff1e2c77a --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-for.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-for.case +// - src/annex-b-fns/eval-global/indirect-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'for (let f; ; ) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + break;\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-switch.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-switch.js new file mode 100644 index 0000000000..b385ef5c27 --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-switch.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-switch.case +// - src/annex-b-fns/eval-global/indirect-switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +(0,eval)( + 'switch (0) {\ + default:\ + let f;switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }' +); + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-try.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-try.js new file mode 100644 index 0000000000..468c49d21f --- /dev/null +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/eval-global-skip-early-err-try.case +// - src/annex-b-fns/eval-global/indirect-switch-dflt.template +/*--- +description: Extension is not observed when creation of variable binding would produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in eval code in the global scope) +esid: sec-web-compat-evaldeclarationinstantiation +es6id: B.3.3.3 +flags: [generated, noStrict] +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + body, then + [...] + + 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. +---*/ + +(0,eval)( + 'assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created prior to evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created prior to evaluation"\ + );\ + \ + try {\ + throw {};\ + } catch ({ f }) {switch (1) {' + + ' default:' + + ' function f() { }' + + '}\ + }\ + \ + assert.throws(ReferenceError, function() {\ + f;\ + }, "An initialized binding is not created following evaluation");\ + assert.sameValue(\ + typeof f,\ + "undefined",\ + "An uninitialized binding is not created following evaluation"\ + );' +); diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err.js index 164efbd0be..a347e35825 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] ii. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for diff --git a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-update.js b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-update.js index 0b2927ad0e..d737002a56 100644 --- a/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-update.js +++ b/test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Funtion dec esid: sec-web-compat-evaldeclarationinstantiation es6id: B.3.3.3 flags: [generated, noStrict] -info: > +info: | B.3.3.3 Changes to EvalDeclarationInstantiation - + [...] b. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/block-decl-func-block-scoping.js b/test/annexB/language/function-code/block-decl-func-block-scoping.js index 8027175fbb..fdd0726eba 100644 --- a/test/annexB/language/function-code/block-decl-func-block-scoping.js +++ b/test/annexB/language/function-code/block-decl-func-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Block statement in function scop esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/block-decl-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/block-decl-func-exsting-block-fn-no-init.js index 775799c606..95002d0836 100644 --- a/test/annexB/language/function-code/block-decl-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/block-decl-func-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Block stat esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] @@ -17,7 +17,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/block-decl-func-exsting-block-fn-update.js b/test/annexB/language/function-code/block-decl-func-exsting-block-fn-update.js index b566359f9c..79a84a0a00 100644 --- a/test/annexB/language/function-code/block-decl-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/block-decl-func-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Block statement in function sco esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/block-decl-func-exsting-fn-no-init.js b/test/annexB/language/function-code/block-decl-func-exsting-fn-no-init.js index eb98135ff7..22dee65ccf 100644 --- a/test/annexB/language/function-code/block-decl-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/block-decl-func-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in funct esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] diff --git a/test/annexB/language/function-code/block-decl-func-exsting-fn-update.js b/test/annexB/language/function-code/block-decl-func-exsting-fn-update.js index c4e5ec6c98..61b188b42a 100644 --- a/test/annexB/language/function-code/block-decl-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/block-decl-func-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -31,7 +31,7 @@ var after; } after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/block-decl-func-exsting-var-no-init.js b/test/annexB/language/function-code/block-decl-func-exsting-var-no-init.js index cdcc4afad0..2db6319209 100644 --- a/test/annexB/language/function-code/block-decl-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/block-decl-func-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in funct esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] diff --git a/test/annexB/language/function-code/block-decl-func-exsting-var-update.js b/test/annexB/language/function-code/block-decl-func-exsting-var-update.js index d95b7ae2ba..fa1865a6ef 100644 --- a/test/annexB/language/function-code/block-decl-func-exsting-var-update.js +++ b/test/annexB/language/function-code/block-decl-func-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -31,7 +31,7 @@ var after; } after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/block-decl-func-init.js b/test/annexB/language/function-code/block-decl-func-init.js index d3d2fe205f..c50a913c5b 100644 --- a/test/annexB/language/function-code/block-decl-func-init.js +++ b/test/annexB/language/function-code/block-decl-func-init.js @@ -6,9 +6,9 @@ description: Variable binding is initialized to `undefined` in outer scope (Bloc esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then a. Perform ! varEnvRec.CreateMutableBinding(F, false). diff --git a/test/annexB/language/function-code/block-decl-func-no-skip-try.js b/test/annexB/language/function-code/block-decl-func-no-skip-try.js new file mode 100644 index 0000000000..86b9c8c2d4 --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-no-skip-try.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-no-skip-try.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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) { + + { + function f() { return 123; } + } + + } + + assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' + ); + assert.sameValue(f(), 123); +}()); diff --git a/test/annexB/language/function-code/block-decl-func-skip-early-err-block.js b/test/annexB/language/function-code/block-decl-func-skip-early-err-block.js new file mode 100644 index 0000000000..e73e4f0d4d --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-skip-early-err-block.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + { + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/block-decl-func-skip-early-err-for-in.js b/test/annexB/language/function-code/block-decl-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..cd3835e254 --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-skip-early-err-for-in.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + { + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/block-decl-func-skip-early-err-for-of.js b/test/annexB/language/function-code/block-decl-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..42bdb58fea --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-skip-early-err-for-of.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + { + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/block-decl-func-skip-early-err-for.js b/test/annexB/language/function-code/block-decl-func-skip-early-err-for.js new file mode 100644 index 0000000000..569b97d8a2 --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-skip-early-err-for.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + { + function f() { } + } + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/block-decl-func-skip-early-err-switch.js b/test/annexB/language/function-code/block-decl-func-skip-early-err-switch.js new file mode 100644 index 0000000000..6d56fc2110 --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-skip-early-err-switch.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + { + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/block-decl-func-skip-early-err-try.js b/test/annexB/language/function-code/block-decl-func-skip-early-err-try.js new file mode 100644 index 0000000000..378c0bc44b --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-skip-early-err-try.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-try.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + { + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/block-decl-func-skip-early-err.js b/test/annexB/language/function-code/block-decl-func-skip-early-err.js index d2a82ae8f7..461221ec77 100644 --- a/test/annexB/language/function-code/block-decl-func-skip-early-err.js +++ b/test/annexB/language/function-code/block-decl-func-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/block-decl-func-skip-param.js b/test/annexB/language/function-code/block-decl-func-skip-param.js index 291bca792e..29490bd4f9 100644 --- a/test/annexB/language/function-code/block-decl-func-skip-param.js +++ b/test/annexB/language/function-code/block-decl-func-skip-param.js @@ -6,9 +6,9 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/block-decl-func-update.js b/test/annexB/language/function-code/block-decl-func-update.js index b4b52c24b9..3c858d6d7a 100644 --- a/test/annexB/language/function-code/block-decl-func-update.js +++ b/test/annexB/language/function-code/block-decl-func-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Block state esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-block-scoping.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-block-scoping.js index b10ab8a666..a9a2a831aa 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-block-scoping.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-no-init.js index 30b36aba57..fb4437724a 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] @@ -26,7 +26,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-update.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-update.js index e49148fa2a..07b1d4661f 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-no-init.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-no-init.js index e1f36fcc95..e429450259 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-update.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-update.js index 9a00764b1f..12a44f977a 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (true) function f() { return 'inner declaration'; } else function _f() {} after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-no-init.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-no-init.js index d885a042c7..c33e999742 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-update.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-update.js index e9808222a2..8b3d66a3f1 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (true) function f() { return 'function declaration'; } else function _f() {} after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-init.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-init.js index 6399f2fd1d..9baf3f2751 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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). diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-no-skip-try.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-no-skip-try.js new file mode 100644 index 0000000000..a42812585b --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-no-skip-try.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-no-skip-try.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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 (true) function f() { return 123; } else function _f() {} + + } + + assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' + ); + assert.sameValue(f(), 123); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-block.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-block.js new file mode 100644 index 0000000000..7db55629a7 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-block.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + if (true) function f() { } else function _f() {} + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-in.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..c619fc6870 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-in.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + if (true) function f() { } else function _f() {} + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-of.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..1d745b6a50 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-of.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + if (true) function f() { } else function _f() {} + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for.js new file mode 100644 index 0000000000..9b65881669 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + if (true) function f() { } else function _f() {} + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-switch.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-switch.js new file mode 100644 index 0000000000..95e35df906 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-switch.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + if (true) function f() { } else function _f() {} + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-try.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-try.js new file mode 100644 index 0000000000..08139b1d2d --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-try.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-try.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + if (true) function f() { } else function _f() {} + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err.js index 809a5b33be..b3f9a20a1f 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-param.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-param.js index 1ff4227bc6..430927eb63 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-param.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-param.js @@ -6,18 +6,18 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-update.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-update.js index 4a54419e10..8c9fbc3e51 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-a-func-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-block-scoping.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-block-scoping.js index 3b34452c78..330e936665 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-block-scoping.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-no-init.js index fb30755673..be7d4e1f0e 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] @@ -26,7 +26,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-update.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-update.js index b602cc8f73..0de41bfc76 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-no-init.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-no-init.js index 2777bc5e0e..361628ab91 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-update.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-update.js index f1808d08d0..e8c7a6a59c 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (false) function _f() {} else function f() { return 'inner declaration'; } after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-no-init.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-no-init.js index b60ba50eb0..c4e97e929d 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-update.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-update.js index dd98fa4f30..b2695d8eb4 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (false) function _f() {} else function f() { return 'function declaration'; } after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-init.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-init.js index cc36c1b86b..2192abacf2 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-init.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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). diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-no-skip-try.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-no-skip-try.js new file mode 100644 index 0000000000..e06a593e8b --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-no-skip-try.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-no-skip-try.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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) function _f() {} else function f() { return 123; } + + } + + assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' + ); + assert.sameValue(f(), 123); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-block.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-block.js new file mode 100644 index 0000000000..432946beab --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-block.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + if (false) function _f() {} else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-in.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..414f8254fb --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-in.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + if (false) function _f() {} else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-of.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..555e87531b --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-of.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + if (false) function _f() {} else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for.js new file mode 100644 index 0000000000..fe41660e4d --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + if (false) function _f() {} else function f() { } + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-switch.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-switch.js new file mode 100644 index 0000000000..51e66f0741 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-switch.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + if (false) function _f() {} else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-try.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-try.js new file mode 100644 index 0000000000..86114b14b0 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-try.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-try.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + if (false) function _f() {} else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err.js index e09174b2ab..8747ce60d1 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-param.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-param.js index 12668cd951..ebadc1d059 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-param.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-param.js @@ -6,18 +6,18 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-update.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-update.js index 363996a92b..0220cfcd23 100644 --- a/test/annexB/language/function-code/if-decl-else-decl-b-func-update.js +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-block-scoping.js b/test/annexB/language/function-code/if-decl-else-stmt-func-block-scoping.js index 2ca3560f09..959087683b 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-block-scoping.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-no-init.js index e1759e0c40..f4eb572093 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] @@ -26,7 +26,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-update.js b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-update.js index a4a5c9017c..387562821d 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-no-init.js b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-no-init.js index 19854c8385..0f2291bbf7 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-update.js b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-update.js index 9d4c2402b8..6fb6b4e4d8 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (true) function f() { return 'inner declaration'; } else ; after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-no-init.js b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-no-init.js index 263ccf71b3..733434feba 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-update.js b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-update.js index 45f78d63a9..5164fbd08f 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-update.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (true) function f() { return 'function declaration'; } else ; after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-init.js b/test/annexB/language/function-code/if-decl-else-stmt-func-init.js index df2810ad1c..87489fc569 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-init.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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). diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-no-skip-try.js b/test/annexB/language/function-code/if-decl-else-stmt-func-no-skip-try.js new file mode 100644 index 0000000000..98efe5c2bd --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-no-skip-try.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-no-skip-try.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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 (true) function f() { return 123; } else ; + + } + + assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' + ); + assert.sameValue(f(), 123); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-block.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-block.js new file mode 100644 index 0000000000..f224770b29 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-block.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + if (true) function f() { } else ; + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-in.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..85412ae278 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-in.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + if (true) function f() { } else ; + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-of.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..067af6ba9c --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-of.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + if (true) function f() { } else ; + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for.js new file mode 100644 index 0000000000..293b33ab63 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + if (true) function f() { } else ; + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-switch.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-switch.js new file mode 100644 index 0000000000..27a231f47d --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-switch.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + if (true) function f() { } else ; + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-try.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-try.js new file mode 100644 index 0000000000..10b78c6b39 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-try.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-try.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + if (true) function f() { } else ; + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err.js index 70a4460857..a056e2a4e7 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-param.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-param.js index 7bb9920ac3..4ec14a0c99 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-param.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-param.js @@ -6,18 +6,18 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-update.js b/test/annexB/language/function-code/if-decl-else-stmt-func-update.js index ce503d4bf2..77e26a3e88 100644 --- a/test/annexB/language/function-code/if-decl-else-stmt-func-update.js +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-no-else-func-block-scoping.js b/test/annexB/language/function-code/if-decl-no-else-func-block-scoping.js index eb427c1444..a5c576a7f7 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-block-scoping.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement without an else clau esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-no-init.js index 78af90219f..929125e9da 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] @@ -26,7 +26,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-update.js b/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-update.js index 216da722ec..cb154a814e 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement without an else cla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-no-init.js b/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-no-init.js index 2b8caf34e3..46290da328 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-update.js b/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-update.js index d4540ea796..677916d064 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (true) function f() { return 'inner declaration'; } after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-no-init.js b/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-no-init.js index ab93a31ca5..f4261a330c 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-update.js b/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-update.js index 2ffe6a2f88..67e6af6543 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-update.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (true) function f() { return 'function declaration'; } after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-init.js b/test/annexB/language/function-code/if-decl-no-else-func-init.js index 5e44f92ef4..ad141fb186 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-init.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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). diff --git a/test/annexB/language/function-code/if-decl-no-else-func-no-skip-try.js b/test/annexB/language/function-code/if-decl-no-else-func-no-skip-try.js new file mode 100644 index 0000000000..0a3b2d1daf --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-no-skip-try.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-no-skip-try.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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 (true) function f() { return 123; } + + } + + assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' + ); + assert.sameValue(f(), 123); +}()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-block.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-block.js new file mode 100644 index 0000000000..0ec0334d66 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-block.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + if (true) function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-in.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..0e44127e6b --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-in.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + if (true) function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-of.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..62966083c3 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-of.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + if (true) function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for.js new file mode 100644 index 0000000000..ad23792493 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + if (true) function f() { } + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-switch.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-switch.js new file mode 100644 index 0000000000..8c85708fe8 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-switch.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + if (true) function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-try.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-try.js new file mode 100644 index 0000000000..bcc320805e --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-try.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-try.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + if (true) function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err.js index b0c122b1eb..d9bee435bc 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-param.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-param.js index 3afe5d9045..22a3037aba 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-skip-param.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-param.js @@ -6,18 +6,18 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-decl-no-else-func-update.js b/test/annexB/language/function-code/if-decl-no-else-func-update.js index 3c4dd89173..b509d4b222 100644 --- a/test/annexB/language/function-code/if-decl-no-else-func-update.js +++ b/test/annexB/language/function-code/if-decl-no-else-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-block-scoping.js b/test/annexB/language/function-code/if-stmt-else-decl-func-block-scoping.js index 7eb97f3fe2..49d992e6c4 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-block-scoping.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-no-init.js index 8bbece4187..d2d4dda89b 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] @@ -26,7 +26,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-update.js b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-update.js index 5b55034ea8..10ee54183a 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-block-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-no-init.js b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-no-init.js index 7cd43d46aa..51bb9cc632 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-update.js b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-update.js index 50281dbf23..43592e97b8 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-fn-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (false) ; else function f() { return 'inner declaration'; } after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-no-init.js b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-no-init.js index fe17be151f..acee159a64 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 [...] diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-update.js b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-update.js index c3bdc273d1..c3c544b6e0 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-update.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-exsting-var-update.js @@ -6,18 +6,18 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -38,7 +38,7 @@ var after; if (false) ; else function f() { return 'function declaration'; } after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-init.js b/test/annexB/language/function-code/if-stmt-else-decl-func-init.js index 29530261a2..54899d952d 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-init.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-init.js @@ -6,18 +6,18 @@ description: Variable binding is initialized to `undefined` in outer scope (IfSt esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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). diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-no-skip-try.js b/test/annexB/language/function-code/if-stmt-else-decl-func-no-skip-try.js new file mode 100644 index 0000000000..e60cd6c012 --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-no-skip-try.js @@ -0,0 +1,57 @@ +// 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); +}()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-block.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-block.js new file mode 100644 index 0000000000..1ab39012a9 --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-block.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block 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 + + [...] + 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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + if (false) ; else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-in.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..cb32a7911d --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-in.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of 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 + + [...] + 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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + if (false) ; else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-of.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..7c569d66b8 --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-of.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of 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 + + [...] + 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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + if (false) ; else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for.js new file mode 100644 index 0000000000..3c228755cb --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for 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 + + [...] + 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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + if (false) ; else function f() { } + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-switch.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-switch.js new file mode 100644 index 0000000000..aaa3de9a60 --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-switch.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch 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 + + [...] + 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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + if (false) ; else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-try.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-try.js new file mode 100644 index 0000000000..ec03e33785 --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-try.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + if (false) ; else function f() { } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err.js index 602173926d..415f55df8c 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-param.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-param.js index 7c46806352..561a6f9729 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-param.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-param.js @@ -6,18 +6,18 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-update.js b/test/annexB/language/function-code/if-stmt-else-decl-func-update.js index 249e1dab37..2f860bcd48 100644 --- a/test/annexB/language/function-code/if-stmt-else-decl-func-update.js +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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 - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/switch-case-func-block-scoping.js b/test/annexB/language/function-code/switch-case-func-block-scoping.js index 8531e36f9e..3ef3c6b995 100644 --- a/test/annexB/language/function-code/switch-case-func-block-scoping.js +++ b/test/annexB/language/function-code/switch-case-func-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Function declaration in the `cas esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/switch-case-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/switch-case-func-exsting-block-fn-no-init.js index 0a9abd835a..b6dce70b67 100644 --- a/test/annexB/language/function-code/switch-case-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/switch-case-func-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Function d esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] @@ -17,7 +17,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/switch-case-func-exsting-block-fn-update.js b/test/annexB/language/function-code/switch-case-func-exsting-block-fn-update.js index fd243e3040..32c2afffc7 100644 --- a/test/annexB/language/function-code/switch-case-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/switch-case-func-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Function declaration in the `ca esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/switch-case-func-exsting-fn-no-init.js b/test/annexB/language/function-code/switch-case-func-exsting-fn-no-init.js index a6e61c52d3..c97bd86cb7 100644 --- a/test/annexB/language/function-code/switch-case-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/switch-case-func-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] diff --git a/test/annexB/language/function-code/switch-case-func-exsting-fn-update.js b/test/annexB/language/function-code/switch-case-func-exsting-fn-update.js index 98babd38da..c613709a0c 100644 --- a/test/annexB/language/function-code/switch-case-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/switch-case-func-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -32,7 +32,7 @@ var after; } after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/switch-case-func-exsting-var-no-init.js b/test/annexB/language/function-code/switch-case-func-exsting-var-no-init.js index 4dcf01ea87..e875973f87 100644 --- a/test/annexB/language/function-code/switch-case-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/switch-case-func-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] diff --git a/test/annexB/language/function-code/switch-case-func-exsting-var-update.js b/test/annexB/language/function-code/switch-case-func-exsting-var-update.js index 67e0b9858f..77a459b6ab 100644 --- a/test/annexB/language/function-code/switch-case-func-exsting-var-update.js +++ b/test/annexB/language/function-code/switch-case-func-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -32,7 +32,7 @@ var after; } after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/switch-case-func-init.js b/test/annexB/language/function-code/switch-case-func-init.js index 7f277a4802..8db0353444 100644 --- a/test/annexB/language/function-code/switch-case-func-init.js +++ b/test/annexB/language/function-code/switch-case-func-init.js @@ -6,9 +6,9 @@ description: Variable binding is initialized to `undefined` in outer scope (Func esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then a. Perform ! varEnvRec.CreateMutableBinding(F, false). diff --git a/test/annexB/language/function-code/switch-case-func-no-skip-try.js b/test/annexB/language/function-code/switch-case-func-no-skip-try.js new file mode 100644 index 0000000000..72cc559ba0 --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-no-skip-try.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-no-skip-try.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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) { + + switch (1) { + case 1: + function f() { return 123; } + } + + } + + assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' + ); + assert.sameValue(f(), 123); +}()); diff --git a/test/annexB/language/function-code/switch-case-func-skip-early-err-block.js b/test/annexB/language/function-code/switch-case-func-skip-early-err-block.js new file mode 100644 index 0000000000..1e14e1bcfc --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-skip-early-err-block.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + switch (1) { + case 1: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-case-func-skip-early-err-for-in.js b/test/annexB/language/function-code/switch-case-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..fade510ff9 --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-skip-early-err-for-in.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + switch (1) { + case 1: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-case-func-skip-early-err-for-of.js b/test/annexB/language/function-code/switch-case-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..f2c15af9aa --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-skip-early-err-for-of.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + switch (1) { + case 1: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-case-func-skip-early-err-for.js b/test/annexB/language/function-code/switch-case-func-skip-early-err-for.js new file mode 100644 index 0000000000..7952a91549 --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-skip-early-err-for.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + switch (1) { + case 1: + function f() { } + } + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-case-func-skip-early-err-switch.js b/test/annexB/language/function-code/switch-case-func-skip-early-err-switch.js new file mode 100644 index 0000000000..3b5e9a81e8 --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-skip-early-err-switch.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + switch (1) { + case 1: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-case-func-skip-early-err-try.js b/test/annexB/language/function-code/switch-case-func-skip-early-err-try.js new file mode 100644 index 0000000000..e4be091f82 --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-skip-early-err-try.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-try.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + switch (1) { + case 1: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-case-func-skip-early-err.js b/test/annexB/language/function-code/switch-case-func-skip-early-err.js index 851601c7ed..e74ee0b39d 100644 --- a/test/annexB/language/function-code/switch-case-func-skip-early-err.js +++ b/test/annexB/language/function-code/switch-case-func-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/switch-case-func-skip-param.js b/test/annexB/language/function-code/switch-case-func-skip-param.js index 9d55de4cdf..9fada066dc 100644 --- a/test/annexB/language/function-code/switch-case-func-skip-param.js +++ b/test/annexB/language/function-code/switch-case-func-skip-param.js @@ -6,9 +6,9 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/switch-case-func-update.js b/test/annexB/language/function-code/switch-case-func-update.js index 123a76be51..cf4ece074c 100644 --- a/test/annexB/language/function-code/switch-case-func-update.js +++ b/test/annexB/language/function-code/switch-case-func-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Function de esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/switch-dflt-func-block-scoping.js b/test/annexB/language/function-code/switch-dflt-func-block-scoping.js index bd11fd6458..af2ce68612 100644 --- a/test/annexB/language/function-code/switch-dflt-func-block-scoping.js +++ b/test/annexB/language/function-code/switch-dflt-func-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Funtion declaration in the `defa esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-no-init.js b/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-no-init.js index 578b91adfd..e08bb54701 100644 --- a/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-no-init.js +++ b/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Funtion de esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] @@ -17,7 +17,7 @@ var init; (function() { init = f; - + { function f() {} } diff --git a/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-update.js b/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-update.js index 068e067129..6fe324509d 100644 --- a/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-update.js +++ b/test/annexB/language/function-code/switch-dflt-func-exsting-block-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated (Funtion declaration in the `def esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/function-code/switch-dflt-func-exsting-fn-no-init.js b/test/annexB/language/function-code/switch-dflt-func-exsting-fn-no-init.js index af4f080d20..495e43c3a2 100644 --- a/test/annexB/language/function-code/switch-dflt-func-exsting-fn-no-init.js +++ b/test/annexB/language/function-code/switch-dflt-func-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] diff --git a/test/annexB/language/function-code/switch-dflt-func-exsting-fn-update.js b/test/annexB/language/function-code/switch-dflt-func-exsting-fn-update.js index 7ed94848a0..bfe9f7f2ae 100644 --- a/test/annexB/language/function-code/switch-dflt-func-exsting-fn-update.js +++ b/test/annexB/language/function-code/switch-dflt-func-exsting-fn-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -32,7 +32,7 @@ var after; } after = f; - + function f() { return 'outer declaration'; } diff --git a/test/annexB/language/function-code/switch-dflt-func-exsting-var-no-init.js b/test/annexB/language/function-code/switch-dflt-func-exsting-var-no-init.js index 66df544bf1..ec3037b4d4 100644 --- a/test/annexB/language/function-code/switch-dflt-func-exsting-var-no-init.js +++ b/test/annexB/language/function-code/switch-dflt-func-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then [...] diff --git a/test/annexB/language/function-code/switch-dflt-func-exsting-var-update.js b/test/annexB/language/function-code/switch-dflt-func-exsting-var-update.js index 641b8ea0de..2398ae9414 100644 --- a/test/annexB/language/function-code/switch-dflt-func-exsting-var-update.js +++ b/test/annexB/language/function-code/switch-dflt-func-exsting-var-update.js @@ -6,9 +6,9 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in @@ -32,7 +32,7 @@ var after; } after = f; - + var f = 123; }()); diff --git a/test/annexB/language/function-code/switch-dflt-func-init.js b/test/annexB/language/function-code/switch-dflt-func-init.js index ddd4d5c5c2..3884b9619c 100644 --- a/test/annexB/language/function-code/switch-dflt-func-init.js +++ b/test/annexB/language/function-code/switch-dflt-func-init.js @@ -6,9 +6,9 @@ description: Variable binding is initialized to `undefined` in outer scope (Funt esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 2. If instantiatedVarNames does not contain F, then a. Perform ! varEnvRec.CreateMutableBinding(F, false). diff --git a/test/annexB/language/function-code/switch-dflt-func-no-skip-try.js b/test/annexB/language/function-code/switch-dflt-func-no-skip-try.js new file mode 100644 index 0000000000..def3d3b83c --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-no-skip-try.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-no-skip-try.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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) { + + switch (1) { + default: + function f() { return 123; } + } + + } + + assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' + ); + assert.sameValue(f(), 123); +}()); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-early-err-block.js b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-block.js new file mode 100644 index 0000000000..22a6686f28 --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-block.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-block.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + { + let f = 123; + + switch (1) { + default: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-in.js b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-in.js new file mode 100644 index 0000000000..7e40ba396d --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-in.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-in.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f in { key: 0 }) { + + switch (1) { + default: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-of.js b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-of.js new file mode 100644 index 0000000000..43079639a4 --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-of.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for-of.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f of [0]) { + + switch (1) { + default: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for.js b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for.js new file mode 100644 index 0000000000..d091870bf5 --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-for.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-for.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + for (let f; ; ) { + + switch (1) { + default: + function f() { } + } + + break; + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-early-err-switch.js b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-switch.js new file mode 100644 index 0000000000..c8e0e1eeea --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-switch.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-switch.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (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 + [...] +---*/ + +(function() { + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + switch (0) { + default: + let f; + + switch (1) { + default: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-early-err-try.js b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-try.js new file mode 100644 index 0000000000..d393cf4317 --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-skip-early-err-try.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-early-err-try.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 + + [...] + 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.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created prior to evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' + ); + + try { + throw {}; + } catch ({ f }) { + + switch (1) { + default: + function f() { } + } + + } + + assert.throws(ReferenceError, function() { + f; + }, 'An initialized binding is not created following evaluation'); + assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' + ); +}()); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-early-err.js b/test/annexB/language/function-code/switch-dflt-func-skip-early-err.js index e308c8347f..daeaae661d 100644 --- a/test/annexB/language/function-code/switch-dflt-func-skip-early-err.js +++ b/test/annexB/language/function-code/switch-dflt-func-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-param.js b/test/annexB/language/function-code/switch-dflt-func-skip-param.js index b6ade21098..81acc0e190 100644 --- a/test/annexB/language/function-code/switch-dflt-func-skip-param.js +++ b/test/annexB/language/function-code/switch-dflt-func-skip-param.js @@ -6,9 +6,9 @@ description: Extension not observed when there is a formal parameter with the sa esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +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 diff --git a/test/annexB/language/function-code/switch-dflt-func-update.js b/test/annexB/language/function-code/switch-dflt-func-update.js index cc7ed23078..49bcbcdb0e 100644 --- a/test/annexB/language/function-code/switch-dflt-func-update.js +++ b/test/annexB/language/function-code/switch-dflt-func-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Funtion dec esid: sec-web-compat-functiondeclarationinstantiation es6id: B.3.3.1 flags: [generated, noStrict] -info: > +info: | B.3.3.1 Changes to FunctionDeclarationInstantiation - + [...] 3. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/block-decl-global-block-scoping.js b/test/annexB/language/global-code/block-decl-global-block-scoping.js index 9d6da0ed9d..ad02c4f151 100644 --- a/test/annexB/language/global-code/block-decl-global-block-scoping.js +++ b/test/annexB/language/global-code/block-decl-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Block statement in the global sc esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/block-decl-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/block-decl-global-exsting-block-fn-no-init.js index c04974a4fa..fdf140ab32 100644 --- a/test/annexB/language/global-code/block-decl-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/block-decl-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Block stat esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/block-decl-global-exsting-block-fn-update.js b/test/annexB/language/global-code/block-decl-global-exsting-block-fn-update.js index b8f9ac9044..a3d5165302 100644 --- a/test/annexB/language/global-code/block-decl-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/block-decl-global-exsting-block-fn-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated (Block statement in the global s esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/block-decl-global-exsting-fn-no-init.js b/test/annexB/language/global-code/block-decl-global-exsting-fn-no-init.js index b97a637fb7..e72291ec1a 100644 --- a/test/annexB/language/global-code/block-decl-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/block-decl-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in the g esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/block-decl-global-exsting-fn-update.js b/test/annexB/language/global-code/block-decl-global-exsting-fn-update.js index c6ffe4683f..9e40ee579d 100644 --- a/test/annexB/language/global-code/block-decl-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/block-decl-global-exsting-fn-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/block-decl-global-exsting-var-no-init.js b/test/annexB/language/global-code/block-decl-global-exsting-var-no-init.js index 701409039d..4e8b7fe685 100644 --- a/test/annexB/language/global-code/block-decl-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/block-decl-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Block statement in the g esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/block-decl-global-exsting-var-update.js b/test/annexB/language/global-code/block-decl-global-exsting-var-update.js index c8a26d879b..de08e28031 100644 --- a/test/annexB/language/global-code/block-decl-global-exsting-var-update.js +++ b/test/annexB/language/global-code/block-decl-global-exsting-var-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated following evaluation (Block stat esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/block-decl-global-init.js b/test/annexB/language/global-code/block-decl-global-init.js index 6b19758486..e0563878ce 100644 --- a/test/annexB/language/global-code/block-decl-global-init.js +++ b/test/annexB/language/global-code/block-decl-global-init.js @@ -7,15 +7,15 @@ esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/block-decl-global-no-skip-try.js b/test/annexB/language/global-code/block-decl-global-no-skip-try.js new file mode 100644 index 0000000000..b0803e9184 --- /dev/null +++ b/test/annexB/language/global-code/block-decl-global-no-skip-try.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/block.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Block statement in the global scope containing a function declaration) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { + +{ + function f() { return 123; } +} + +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/test/annexB/language/global-code/block-decl-global-skip-early-err-block.js b/test/annexB/language/global-code/block-decl-global-skip-early-err-block.js new file mode 100644 index 0000000000..fc8be9749c --- /dev/null +++ b/test/annexB/language/global-code/block-decl-global-skip-early-err-block.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Block statement in the global scope containing a function declaration) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +{ + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/block-decl-global-skip-early-err-for-in.js b/test/annexB/language/global-code/block-decl-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..b9f7cae410 --- /dev/null +++ b/test/annexB/language/global-code/block-decl-global-skip-early-err-for-in.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in the global scope containing a function declaration) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +{ + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/block-decl-global-skip-early-err-for-of.js b/test/annexB/language/global-code/block-decl-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..168f20d888 --- /dev/null +++ b/test/annexB/language/global-code/block-decl-global-skip-early-err-for-of.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Block statement in the global scope containing a function declaration) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +{ + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/block-decl-global-skip-early-err-for.js b/test/annexB/language/global-code/block-decl-global-skip-early-err-for.js new file mode 100644 index 0000000000..edaf893b43 --- /dev/null +++ b/test/annexB/language/global-code/block-decl-global-skip-early-err-for.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Block statement in the global scope containing a function declaration) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +{ + function f() { } +} + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/block-decl-global-skip-early-err-switch.js b/test/annexB/language/global-code/block-decl-global-skip-early-err-switch.js new file mode 100644 index 0000000000..c2796bfcea --- /dev/null +++ b/test/annexB/language/global-code/block-decl-global-skip-early-err-switch.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/block.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Block statement in the global scope containing a function declaration) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +{ + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/block-decl-global-skip-early-err-try.js b/test/annexB/language/global-code/block-decl-global-skip-early-err-try.js new file mode 100644 index 0000000000..464f23bd5d --- /dev/null +++ b/test/annexB/language/global-code/block-decl-global-skip-early-err-try.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/block.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Block statement in the global scope containing a function declaration) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +{ + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/block-decl-global-skip-early-err.js b/test/annexB/language/global-code/block-decl-global-skip-early-err.js index bc17896ad6..876dedcafc 100644 --- a/test/annexB/language/global-code/block-decl-global-skip-early-err.js +++ b/test/annexB/language/global-code/block-decl-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/block-decl-global-update.js b/test/annexB/language/global-code/block-decl-global-update.js index 39a96bb28e..f8897d046d 100644 --- a/test/annexB/language/global-code/block-decl-global-update.js +++ b/test/annexB/language/global-code/block-decl-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Block state esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-block-scoping.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-block-scoping.js index ad48231f47..b4378f0e31 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-block-scoping.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-no-init.js index c741c75ff0..8e6483f2bf 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-update.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-update.js index 9244ec9205..035c47d0ab 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-block-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-no-init.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-no-init.js index 9de2fcb7e5..981eaf5458 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-update.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-update.js index 7926b9a600..a0c947e855 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-no-init.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-no-init.js index 7f3c8a4c33..354f1d8c01 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-update.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-update.js index 1f0a475a09..b6a6e8355c 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-exsting-var-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-init.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-init.js index 3c699a1bb7..496b989e24 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-init.js @@ -7,24 +7,24 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-no-skip-try.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-no-skip-try.js new file mode 100644 index 0000000000..1e48f34147 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-no-skip-try.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/if-decl-else-decl-a.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { + +if (true) function f() { return 123; } else function _f() {} + +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-block.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-block.js new file mode 100644 index 0000000000..9ad0b5024c --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-block.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +if (true) function f() { } else function _f() {} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-in.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..fdfc018f2f --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-in.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +if (true) function f() { } else function _f() {} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-of.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..7d79e43a8f --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for-of.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +if (true) function f() { } else function _f() {} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for.js new file mode 100644 index 0000000000..21478ed89c --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-for.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +if (true) function f() { } else function _f() {} + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-switch.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-switch.js new file mode 100644 index 0000000000..90fbd0743b --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-switch.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/if-decl-else-decl-a.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +if (true) function f() { } else function _f() {} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-try.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-try.js new file mode 100644 index 0000000000..39cd68b0d2 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-try.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/if-decl-else-decl-a.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +if (true) function f() { } else function _f() {} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err.js index 4aa07ae495..18dbd5d1fa 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/if-decl-else-decl-a-global-update.js b/test/annexB/language/global-code/if-decl-else-decl-a-global-update.js index 75fba6b808..7d1b533ed2 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-a-global-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-a-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-block-scoping.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-block-scoping.js index 9bfc089f00..05fdc435ea 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-block-scoping.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-no-init.js index dcb62e438f..101b1a3348 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-update.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-update.js index 50ccbc815d..5cfb462038 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-block-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-no-init.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-no-init.js index 45c6e7da58..61253c7279 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-update.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-update.js index 7feba43d56..6fc29662ca 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-no-init.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-no-init.js index 94c406ba91..d9e07d1199 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-update.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-update.js index 1717136882..b9bd101a61 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-exsting-var-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-init.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-init.js index 4be847d386..0bb7e9b49b 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-init.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-init.js @@ -7,24 +7,24 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-no-skip-try.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-no-skip-try.js new file mode 100644 index 0000000000..aafb04ea20 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-no-skip-try.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/if-decl-else-decl-b.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { + +if (false) function _f() {} else function f() { return 123; } + +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-block.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-block.js new file mode 100644 index 0000000000..35366c4e5e --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-block.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +if (false) function _f() {} else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-in.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..2d383d2aa2 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-in.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +if (false) function _f() {} else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-of.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..1fc3b6551b --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for-of.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +if (false) function _f() {} else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for.js new file mode 100644 index 0000000000..1392138f26 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-for.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +if (false) function _f() {} else function f() { } + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-switch.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-switch.js new file mode 100644 index 0000000000..2e304324f6 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-switch.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/if-decl-else-decl-b.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +if (false) function _f() {} else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-try.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-try.js new file mode 100644 index 0000000000..061a0b33da --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-try.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/if-decl-else-decl-b.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in both statement positions in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +if (false) function _f() {} else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err.js index bb2cbc80cf..310271675e 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/if-decl-else-decl-b-global-update.js b/test/annexB/language/global-code/if-decl-else-decl-b-global-update.js index b47bf10818..7b00ccb7e2 100644 --- a/test/annexB/language/global-code/if-decl-else-decl-b-global-update.js +++ b/test/annexB/language/global-code/if-decl-else-decl-b-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-block-scoping.js b/test/annexB/language/global-code/if-decl-else-stmt-global-block-scoping.js index 4df9e34aab..323e83cf39 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-block-scoping.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-no-init.js index fb9bc6a8b0..5af53e99ad 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-update.js b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-update.js index beb43958b2..80479e8c12 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-block-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-no-init.js b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-no-init.js index 058c1a6eeb..4574a8be28 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-update.js b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-update.js index dcd777e241..4971e6247d 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-no-init.js b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-no-init.js index 4d9c35e522..45d7d6be9e 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-update.js b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-update.js index c59d61630a..e1e5d8303d 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-update.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-exsting-var-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-init.js b/test/annexB/language/global-code/if-decl-else-stmt-global-init.js index d45d6a5741..ed41226240 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-init.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-init.js @@ -7,24 +7,24 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-no-skip-try.js b/test/annexB/language/global-code/if-decl-else-stmt-global-no-skip-try.js new file mode 100644 index 0000000000..3cd30e4beb --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-no-skip-try.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/if-decl-else-stmt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in the first statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { + +if (true) function f() { return 123; } else ; + +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-block.js b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-block.js new file mode 100644 index 0000000000..cd1b644cc6 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-block.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the first statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +if (true) function f() { } else ; + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-in.js b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..f8bc7f4e12 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-in.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +if (true) function f() { } else ; + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-of.js b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..be5688a0fa --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for-of.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the first statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +if (true) function f() { } else ; + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for.js b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for.js new file mode 100644 index 0000000000..660b172c49 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-for.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the first statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +if (true) function f() { } else ; + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-switch.js b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-switch.js new file mode 100644 index 0000000000..359b3dda70 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-switch.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/if-decl-else-stmt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the first statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +if (true) function f() { } else ; + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-try.js b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-try.js new file mode 100644 index 0000000000..317d97f69a --- /dev/null +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-try.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/if-decl-else-stmt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement with a declaration in the first statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +if (true) function f() { } else ; + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err.js b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err.js index d31ad7929b..e57fff13fd 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/if-decl-else-stmt-global-update.js b/test/annexB/language/global-code/if-decl-else-stmt-global-update.js index 1d22485201..a973da9efe 100644 --- a/test/annexB/language/global-code/if-decl-else-stmt-global-update.js +++ b/test/annexB/language/global-code/if-decl-else-stmt-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/if-decl-no-else-global-block-scoping.js b/test/annexB/language/global-code/if-decl-no-else-global-block-scoping.js index 230d2ff715..2291a7ba6b 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-block-scoping.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement without an else clau esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-no-init.js index 047739d15c..f1557a7042 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-update.js b/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-update.js index dea0feace0..4030c79b24 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-exsting-block-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated (IfStatement without an else cla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-no-init.js b/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-no-init.js index b491d2f15d..7f301eb6ce 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-update.js b/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-update.js index a5e2bd9e81..9db864ecd5 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-exsting-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-no-init.js b/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-no-init.js index b52cdb3251..b7380a411a 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement without an e esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-update.js b/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-update.js index cebaba33c2..0e61b8a0ba 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-update.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-exsting-var-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-decl-no-else-global-init.js b/test/annexB/language/global-code/if-decl-no-else-global-init.js index cdfc1f2525..85748a57c9 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-init.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-init.js @@ -7,24 +7,24 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-no-skip-try.js b/test/annexB/language/global-code/if-decl-no-else-global-no-skip-try.js new file mode 100644 index 0000000000..20a157b8ff --- /dev/null +++ b/test/annexB/language/global-code/if-decl-no-else-global-no-skip-try.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/if-decl-no-else.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement without an else clause in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { + +if (true) function f() { return 123; } + +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-block.js b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-block.js new file mode 100644 index 0000000000..dded5878b1 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-block.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement without an else clause in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +if (true) function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-in.js b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..45fa758214 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-in.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +if (true) function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-of.js b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..592d4c059c --- /dev/null +++ b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for-of.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement without an else clause in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +if (true) function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for.js b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for.js new file mode 100644 index 0000000000..2be206cc7f --- /dev/null +++ b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-for.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement without an else clause in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +if (true) function f() { } + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-switch.js b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-switch.js new file mode 100644 index 0000000000..f7b6785468 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-switch.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/if-decl-no-else.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement without an else clause in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +if (true) function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-try.js b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-try.js new file mode 100644 index 0000000000..d27824bdd2 --- /dev/null +++ b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err-try.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/if-decl-no-else.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (IfStatement without an else clause in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +if (true) function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err.js b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err.js index 4c6d54bf14..76f0c07bc4 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/if-decl-no-else-global-update.js b/test/annexB/language/global-code/if-decl-no-else-global-update.js index b1944aa4ac..f036b62721 100644 --- a/test/annexB/language/global-code/if-decl-no-else-global-update.js +++ b/test/annexB/language/global-code/if-decl-no-else-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-block-scoping.js b/test/annexB/language/global-code/if-stmt-else-decl-global-block-scoping.js index 410048451c..7e94de84a0 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-block-scoping.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-block-scoping.js @@ -6,18 +6,18 @@ description: A block-scoped binding is created (IfStatement with a declaration i esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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] - + 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -25,7 +25,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-no-init.js index 02a2dbfe77..b6b68c32ee 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-no-init.js @@ -6,18 +6,18 @@ description: Does not re-initialize binding created by similar forms (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-update.js b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-update.js index 58826a4a90..463f1c8483 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-block-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated (IfStatement with a declaration esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-no-init.js b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-no-init.js index a7e51e7e41..9f8764eeb7 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-update.js b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-update.js index 19ab633e80..f365f9bd0d 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-fn-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-no-init.js b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-no-init.js index ac3ba87c36..a2196d23b3 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-no-init.js @@ -6,18 +6,18 @@ description: Existing variable binding is not modified (IfStatement with a decla esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-update.js b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-update.js index d6e3960d10..7e5dca1d47 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-update.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-exsting-var-update.js @@ -6,22 +6,22 @@ description: Variable-scoped binding is updated following evaluation (IfStatemen esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-init.js b/test/annexB/language/global-code/if-stmt-else-decl-global-init.js index 95d8f20d73..c4b27987c1 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-init.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-init.js @@ -7,24 +7,24 @@ esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-no-skip-try.js b/test/annexB/language/global-code/if-stmt-else-decl-global-no-skip-try.js new file mode 100644 index 0000000000..8d785de1b6 --- /dev/null +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-no-skip-try.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/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 the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +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); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-block.js b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-block.js new file mode 100644 index 0000000000..22f52e1610 --- /dev/null +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-block.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (IfStatement with a declaration in the second statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +if (false) ; else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-in.js b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..722aaf4b06 --- /dev/null +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-in.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +if (false) ; else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-of.js b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..7bc26e68f2 --- /dev/null +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for-of.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (IfStatement with a declaration in the second statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +if (false) ; else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for.js b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for.js new file mode 100644 index 0000000000..6fd97554a1 --- /dev/null +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-for.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (IfStatement with a declaration in the second statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +if (false) ; else function f() { } + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-switch.js b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-switch.js new file mode 100644 index 0000000000..0b4797146c --- /dev/null +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-switch.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/if-stmt-else-decl.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (IfStatement with a declaration in the second statement position in the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +if (false) ; else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-try.js b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-try.js new file mode 100644 index 0000000000..f3e9744105 --- /dev/null +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-try.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/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 the global 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.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +if (false) ; else function f() { } + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err.js b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err.js index d255ea2388..1e3600ad46 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-skip-early-err.js @@ -6,18 +6,18 @@ description: Extension not observed when creation of variable binding would prod esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/if-stmt-else-decl-global-update.js b/test/annexB/language/global-code/if-stmt-else-decl-global-update.js index 4f1cefd9be..298a7ab014 100644 --- a/test/annexB/language/global-code/if-stmt-else-decl-global-update.js +++ b/test/annexB/language/global-code/if-stmt-else-decl-global-update.js @@ -6,18 +6,18 @@ description: Variable binding value is updated following evaluation (IfStatement esid: sec-functiondeclarations-in-ifstatement-statement-clauses es6id: B.3.4 flags: [generated, noStrict] -info: > +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.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/switch-case-global-block-scoping.js b/test/annexB/language/global-code/switch-case-global-block-scoping.js index 46da5ea412..19dc84507a 100644 --- a/test/annexB/language/global-code/switch-case-global-block-scoping.js +++ b/test/annexB/language/global-code/switch-case-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Function declaration in the `cas esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/switch-case-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/switch-case-global-exsting-block-fn-no-init.js index 37c65a208a..c2371e00c2 100644 --- a/test/annexB/language/global-code/switch-case-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/switch-case-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Function d esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/switch-case-global-exsting-block-fn-update.js b/test/annexB/language/global-code/switch-case-global-exsting-block-fn-update.js index 1c08e16206..59bd335326 100644 --- a/test/annexB/language/global-code/switch-case-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/switch-case-global-exsting-block-fn-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated (Function declaration in the `ca esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/switch-case-global-exsting-fn-no-init.js b/test/annexB/language/global-code/switch-case-global-exsting-fn-no-init.js index 24e3901bb6..1af1798de5 100644 --- a/test/annexB/language/global-code/switch-case-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/switch-case-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/switch-case-global-exsting-fn-update.js b/test/annexB/language/global-code/switch-case-global-exsting-fn-update.js index aa1442adf0..07d516d6c8 100644 --- a/test/annexB/language/global-code/switch-case-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/switch-case-global-exsting-fn-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/switch-case-global-exsting-var-no-init.js b/test/annexB/language/global-code/switch-case-global-exsting-var-no-init.js index 30b588f75f..34d65deb69 100644 --- a/test/annexB/language/global-code/switch-case-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/switch-case-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Function declaration in esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/switch-case-global-exsting-var-update.js b/test/annexB/language/global-code/switch-case-global-exsting-var-update.js index aca7c7d798..5019b0b1af 100644 --- a/test/annexB/language/global-code/switch-case-global-exsting-var-update.js +++ b/test/annexB/language/global-code/switch-case-global-exsting-var-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated following evaluation (Function d esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/switch-case-global-init.js b/test/annexB/language/global-code/switch-case-global-init.js index 4efe60ba08..38a3e928b4 100644 --- a/test/annexB/language/global-code/switch-case-global-init.js +++ b/test/annexB/language/global-code/switch-case-global-init.js @@ -7,15 +7,15 @@ esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/switch-case-global-no-skip-try.js b/test/annexB/language/global-code/switch-case-global-no-skip-try.js new file mode 100644 index 0000000000..26a8b6ee2d --- /dev/null +++ b/test/annexB/language/global-code/switch-case-global-no-skip-try.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/switch-case.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { + +switch (1) { + case 1: + function f() { return 123; } +} + +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/test/annexB/language/global-code/switch-case-global-skip-early-err-block.js b/test/annexB/language/global-code/switch-case-global-skip-early-err-block.js new file mode 100644 index 0000000000..aacd62aa85 --- /dev/null +++ b/test/annexB/language/global-code/switch-case-global-skip-early-err-block.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Function declaration in the `case` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +switch (1) { + case 1: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-case-global-skip-early-err-for-in.js b/test/annexB/language/global-code/switch-case-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..cddc56bfff --- /dev/null +++ b/test/annexB/language/global-code/switch-case-global-skip-early-err-for-in.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +switch (1) { + case 1: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-case-global-skip-early-err-for-of.js b/test/annexB/language/global-code/switch-case-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..68c55d6a32 --- /dev/null +++ b/test/annexB/language/global-code/switch-case-global-skip-early-err-for-of.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Function declaration in the `case` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +switch (1) { + case 1: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-case-global-skip-early-err-for.js b/test/annexB/language/global-code/switch-case-global-skip-early-err-for.js new file mode 100644 index 0000000000..3b589bddbc --- /dev/null +++ b/test/annexB/language/global-code/switch-case-global-skip-early-err-for.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Function declaration in the `case` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +switch (1) { + case 1: + function f() { } +} + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-case-global-skip-early-err-switch.js b/test/annexB/language/global-code/switch-case-global-skip-early-err-switch.js new file mode 100644 index 0000000000..3dc7e68442 --- /dev/null +++ b/test/annexB/language/global-code/switch-case-global-skip-early-err-switch.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/switch-case.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Function declaration in the `case` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +switch (1) { + case 1: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-case-global-skip-early-err-try.js b/test/annexB/language/global-code/switch-case-global-skip-early-err-try.js new file mode 100644 index 0000000000..fe9fcf2b50 --- /dev/null +++ b/test/annexB/language/global-code/switch-case-global-skip-early-err-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/switch-case.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Function declaration in the `case` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +switch (1) { + case 1: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-case-global-skip-early-err.js b/test/annexB/language/global-code/switch-case-global-skip-early-err.js index da95ca4bd2..5c55f0f0a9 100644 --- a/test/annexB/language/global-code/switch-case-global-skip-early-err.js +++ b/test/annexB/language/global-code/switch-case-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/switch-case-global-update.js b/test/annexB/language/global-code/switch-case-global-update.js index 72e0198281..63f9b357fd 100644 --- a/test/annexB/language/global-code/switch-case-global-update.js +++ b/test/annexB/language/global-code/switch-case-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Function de esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in diff --git a/test/annexB/language/global-code/switch-dflt-global-block-scoping.js b/test/annexB/language/global-code/switch-dflt-global-block-scoping.js index 0398137720..1d0fabbe01 100644 --- a/test/annexB/language/global-code/switch-dflt-global-block-scoping.js +++ b/test/annexB/language/global-code/switch-dflt-global-block-scoping.js @@ -6,9 +6,9 @@ description: A block-scoped binding is created (Funtion declaration in the `defa esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | 13.2.14 Runtime Semantics: BlockDeclarationInstantiation - + [...] 4. For each element d in declarations do a. For each element dn of the BoundNames of d do @@ -16,7 +16,7 @@ info: > [...] ii. Else, 2. Perform ! envRec.CreateMutableBinding(dn, false). - + b. If d is a GeneratorDeclaration production or a FunctionDeclaration production, then i. Let fn be the sole element of the BoundNames of d. diff --git a/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-no-init.js b/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-no-init.js index 9f24e25627..33d5844efc 100644 --- a/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-no-init.js +++ b/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-no-init.js @@ -6,9 +6,9 @@ description: Does not re-initialize binding created by similar forms (Funtion de esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-update.js b/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-update.js index 31ddc08fc5..08f6721561 100644 --- a/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-update.js +++ b/test/annexB/language/global-code/switch-dflt-global-exsting-block-fn-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated (Funtion declaration in the `def esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/switch-dflt-global-exsting-fn-no-init.js b/test/annexB/language/global-code/switch-dflt-global-exsting-fn-no-init.js index b797ef15fb..7d3421aaab 100644 --- a/test/annexB/language/global-code/switch-dflt-global-exsting-fn-no-init.js +++ b/test/annexB/language/global-code/switch-dflt-global-exsting-fn-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] 1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F). 2. If fnDefinable is true, then diff --git a/test/annexB/language/global-code/switch-dflt-global-exsting-fn-update.js b/test/annexB/language/global-code/switch-dflt-global-exsting-fn-update.js index cb65d245b2..4747826cc4 100644 --- a/test/annexB/language/global-code/switch-dflt-global-exsting-fn-update.js +++ b/test/annexB/language/global-code/switch-dflt-global-exsting-fn-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/switch-dflt-global-exsting-var-no-init.js b/test/annexB/language/global-code/switch-dflt-global-exsting-var-no-init.js index 68f10e3b67..952a765b8d 100644 --- a/test/annexB/language/global-code/switch-dflt-global-exsting-var-no-init.js +++ b/test/annexB/language/global-code/switch-dflt-global-exsting-var-no-init.js @@ -6,9 +6,9 @@ description: Existing variable binding is not modified (Funtion declaration in t esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). diff --git a/test/annexB/language/global-code/switch-dflt-global-exsting-var-update.js b/test/annexB/language/global-code/switch-dflt-global-exsting-var-update.js index 207509cd1c..83e131a035 100644 --- a/test/annexB/language/global-code/switch-dflt-global-exsting-var-update.js +++ b/test/annexB/language/global-code/switch-dflt-global-exsting-var-update.js @@ -6,13 +6,13 @@ description: Variable-scoped binding is updated following evaluation (Funtion de esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation [...] c. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in 14.1.21: - + i. Let genv be the running execution context's VariableEnvironment. ii. Let genvRec be genv's EnvironmentRecord. ii. Let benv be the running execution context's LexicalEnvironment. diff --git a/test/annexB/language/global-code/switch-dflt-global-init.js b/test/annexB/language/global-code/switch-dflt-global-init.js index 51cbb4974b..d9eb1c035f 100644 --- a/test/annexB/language/global-code/switch-dflt-global-init.js +++ b/test/annexB/language/global-code/switch-dflt-global-init.js @@ -7,15 +7,15 @@ esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] includes: [fnGlobalObject.js, propertyHelper.js] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If declaredFunctionOrVarNames does not contain F, then i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false). ii. Append F to declaredFunctionOrVarNames. [...] - + ---*/ var global = fnGlobalObject(); assert.sameValue(f, undefined, 'binding is initialized to `undefined`'); diff --git a/test/annexB/language/global-code/switch-dflt-global-no-skip-try.js b/test/annexB/language/global-code/switch-dflt-global-no-skip-try.js new file mode 100644 index 0000000000..c838b58155 --- /dev/null +++ b/test/annexB/language/global-code/switch-dflt-global-no-skip-try.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-no-skip-try.case +// - src/annex-b-fns/global/switch-dflt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.sameValue( + f, undefined, 'Initialized binding created prior to evaluation' +); + +try { + throw null; +} catch (f) { + +switch (1) { + default: + function f() { return 123; } +} + +} + +assert.sameValue( + typeof f, + 'function', + 'binding value is updated following evaluation' +); +assert.sameValue(f(), 123); diff --git a/test/annexB/language/global-code/switch-dflt-global-skip-early-err-block.js b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-block.js new file mode 100644 index 0000000000..fc3c87acbe --- /dev/null +++ b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-block.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-block.case +// - src/annex-b-fns/global/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (Block statement) (Funtion declaration in the `default` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +{ +let f = 123; + +switch (1) { + default: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-in.js b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-in.js new file mode 100644 index 0000000000..c6b6432d78 --- /dev/null +++ b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-in.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-in.case +// - src/annex-b-fns/global/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f in { key: 0 }) { + +switch (1) { + default: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-of.js b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-of.js new file mode 100644 index 0000000000..bd4fc217ff --- /dev/null +++ b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for-of.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for-of.case +// - src/annex-b-fns/global/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for-of statement) (Funtion declaration in the `default` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f of [0]) { + +switch (1) { + default: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for.js b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for.js new file mode 100644 index 0000000000..8832b56656 --- /dev/null +++ b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-for.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-for.case +// - src/annex-b-fns/global/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (for statement) (Funtion declaration in the `default` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +for (let f; ; ) { + +switch (1) { + default: + function f() { } +} + + break; +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-dflt-global-skip-early-err-switch.js b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-switch.js new file mode 100644 index 0000000000..4b79fbb219 --- /dev/null +++ b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-switch.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-switch.case +// - src/annex-b-fns/global/switch-dflt.template +/*--- +description: Extension not observed when creation of variable binding would produce an early error (switch statement) (Funtion declaration in the `default` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +switch (0) { + default: + let f; + +switch (1) { + default: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-dflt-global-skip-early-err-try.js b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-try.js new file mode 100644 index 0000000000..03f953d24e --- /dev/null +++ b/test/annexB/language/global-code/switch-dflt-global-skip-early-err-try.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/global-skip-early-err-try.case +// - src/annex-b-fns/global/switch-dflt.template +/*--- +description: Extension is observed when creation of variable binding would not produce an early error (try statement) (Funtion declaration in the `default` clause of a `switch` statement in the global scope) +esid: sec-web-compat-globaldeclarationinstantiation +es6id: B.3.3.2 +flags: [generated, noStrict] +info: | + B.3.3.2 Changes to GlobalDeclarationInstantiation + + [...] + b. If replacing the FunctionDeclaration f with a VariableStatement that has + F as a BindingIdentifier would not produce any Early Errors for script, + then + [...] + + 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. +---*/ +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created prior to evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created prior to evaluation' +); + +try { + throw {}; +} catch ({ f }) { + +switch (1) { + default: + function f() { } +} + +} + +assert.throws(ReferenceError, function() { + f; +}, 'An initialized binding is not created following evaluation'); +assert.sameValue( + typeof f, + 'undefined', + 'An uninitialized binding is not created following evaluation' +); diff --git a/test/annexB/language/global-code/switch-dflt-global-skip-early-err.js b/test/annexB/language/global-code/switch-dflt-global-skip-early-err.js index 2279d75d38..3c56b02c48 100644 --- a/test/annexB/language/global-code/switch-dflt-global-skip-early-err.js +++ b/test/annexB/language/global-code/switch-dflt-global-skip-early-err.js @@ -6,9 +6,9 @@ description: Extension not observed when creation of variable binding would prod esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] b. If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for script, diff --git a/test/annexB/language/global-code/switch-dflt-global-update.js b/test/annexB/language/global-code/switch-dflt-global-update.js index a663b4d2b8..399070d581 100644 --- a/test/annexB/language/global-code/switch-dflt-global-update.js +++ b/test/annexB/language/global-code/switch-dflt-global-update.js @@ -6,9 +6,9 @@ description: Variable binding value is updated following evaluation (Funtion dec esid: sec-web-compat-globaldeclarationinstantiation es6id: B.3.3.2 flags: [generated, noStrict] -info: > +info: | B.3.3.2 Changes to GlobalDeclarationInstantiation - + [...] e. When the FunctionDeclaration f is evaluated, perform the following steps in place of the FunctionDeclaration Evaluation algorithm provided in -- GitLab