From 8131d2d7248d8aa1f5db219178233146b9a4893e Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 20 Aug 2020 14:57:41 -0400 Subject: [PATCH] ExportDeclaration : HoistableDeclaration; Fixes gh-2068 --- ...syncfunction-declaration-binding-exists.js | 23 ++++++++++++++++++ ...fault-asyncfunction-declaration-binding.js | 18 ++++++++++++++ ...yncgenerator-declaration-binding-exists.js | 23 ++++++++++++++++++ ...ault-asyncgenerator-declaration-binding.js | 18 ++++++++++++++ ...ult-function-declaration-binding-exists.js | 24 +++++++++++++++++++ ...rt-default-function-declaration-binding.js | 18 ++++++++++++++ ...lt-generator-declaration-binding-exists.js | 23 ++++++++++++++++++ ...t-default-generator-declaration-binding.js | 18 ++++++++++++++ 8 files changed, 165 insertions(+) create mode 100644 test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js create mode 100644 test/language/module-code/export-default-asyncfunction-declaration-binding.js create mode 100644 test/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js create mode 100644 test/language/module-code/export-default-asyncgenerator-declaration-binding.js create mode 100644 test/language/module-code/export-default-function-declaration-binding-exists.js create mode 100644 test/language/module-code/export-default-function-declaration-binding.js create mode 100644 test/language/module-code/export-default-generator-declaration-binding-exists.js create mode 100644 test/language/module-code/export-default-generator-declaration-binding.js diff --git a/test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js b/test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js new file mode 100644 index 00000000000..ea726a58414 --- /dev/null +++ b/test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : AsyncFunctionDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + AsyncFunctionDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class A {}; +export default async function A() {} diff --git a/test/language/module-code/export-default-asyncfunction-declaration-binding.js b/test/language/module-code/export-default-asyncfunction-declaration-binding.js new file mode 100644 index 00000000000..dbf266a2ce1 --- /dev/null +++ b/test/language/module-code/export-default-asyncfunction-declaration-binding.js @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : AsyncFunctionDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + AsyncFunctionDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +---*/ + +export default async function A() {} +A.foo = ''; diff --git a/test/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js b/test/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js new file mode 100644 index 00000000000..9a0d71b6bd7 --- /dev/null +++ b/test/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : AsyncGeneratorDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + AsyncGeneratorDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class AG {} +export default async function * AG() {} diff --git a/test/language/module-code/export-default-asyncgenerator-declaration-binding.js b/test/language/module-code/export-default-asyncgenerator-declaration-binding.js new file mode 100644 index 00000000000..d0b31d4f391 --- /dev/null +++ b/test/language/module-code/export-default-asyncgenerator-declaration-binding.js @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : AsyncGeneratorDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + AsyncGeneratorDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +---*/ + +export default async function * AG() {} +AG.foo = ''; diff --git a/test/language/module-code/export-default-function-declaration-binding-exists.js b/test/language/module-code/export-default-function-declaration-binding-exists.js new file mode 100644 index 00000000000..cc97904bc89 --- /dev/null +++ b/test/language/module-code/export-default-function-declaration-binding-exists.js @@ -0,0 +1,24 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : FunctionDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + FunctionDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class F {} +export default function F() {} + diff --git a/test/language/module-code/export-default-function-declaration-binding.js b/test/language/module-code/export-default-function-declaration-binding.js new file mode 100644 index 00000000000..a5bce67dd50 --- /dev/null +++ b/test/language/module-code/export-default-function-declaration-binding.js @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : FunctionDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + FunctionDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +---*/ + +export default function F() {} +F.foo = ''; diff --git a/test/language/module-code/export-default-generator-declaration-binding-exists.js b/test/language/module-code/export-default-generator-declaration-binding-exists.js new file mode 100644 index 00000000000..5c21bd73b24 --- /dev/null +++ b/test/language/module-code/export-default-generator-declaration-binding-exists.js @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : GeneratorDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + GeneratorDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class G {} +export default function * G() {} diff --git a/test/language/module-code/export-default-generator-declaration-binding.js b/test/language/module-code/export-default-generator-declaration-binding.js new file mode 100644 index 00000000000..37fbffa2329 --- /dev/null +++ b/test/language/module-code/export-default-generator-declaration-binding.js @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ExportDeclaration : HoistableDeclaration : GeneratorDeclaration + esid: prod-HoistableDeclaration +info: | + ExportDeclaration : + HoistableDeclaration[Yield, Await, Default]: + + HoistableDeclaration[Yield, Await, Default]: + GeneratorDeclaration[?Yield, ?Await, ?Default] + +flags: [module] +---*/ + +export default function * G() {} +G.foo = '';