From 2a6dec475a35ec104915000984ffb79452cb7350 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 2 May 2022 14:47:01 -0700 Subject: [PATCH] Add test of toplevel return in JS script --- .../reference/plainJSGrammarErrors2.js | 22 ++++--------------- .../reference/plainJSGrammarErrors2.symbols | 14 +++--------- .../reference/plainJSGrammarErrors2.types | 14 +++--------- .../salsa/plainJSGrammarErrors2.ts | 10 ++------- 4 files changed, 12 insertions(+), 48 deletions(-) diff --git a/tests/baselines/reference/plainJSGrammarErrors2.js b/tests/baselines/reference/plainJSGrammarErrors2.js index 501dd231c19..e239f6855a7 100644 --- a/tests/baselines/reference/plainJSGrammarErrors2.js +++ b/tests/baselines/reference/plainJSGrammarErrors2.js @@ -1,22 +1,8 @@ -//// [tests/cases/conformance/salsa/plainJSGrammarErrors2.ts] //// - //// [plainJSGrammarErrors2.js] - -//// [a.js] -export default 1; - -//// [b.js] -/** - * @deprecated - */ -export { default as A } from "./a"; +// top-level return allowed in JS script files +return //// [plainJSGrammarErrors2.js] -//// [a.js] -export default 1; -//// [b.js] -/** - * @deprecated - */ -export { default as A } from "./a"; +// top-level return allowed in JS script files +return; diff --git a/tests/baselines/reference/plainJSGrammarErrors2.symbols b/tests/baselines/reference/plainJSGrammarErrors2.symbols index d4186554ad0..dc8a39f4096 100644 --- a/tests/baselines/reference/plainJSGrammarErrors2.symbols +++ b/tests/baselines/reference/plainJSGrammarErrors2.symbols @@ -1,13 +1,5 @@ === tests/cases/conformance/salsa/plainJSGrammarErrors2.js === - -No type information for this code.=== /a.js === -export default 1; +// top-level return allowed in JS script files +No type information for this code.return No type information for this code. -No type information for this code.=== /b.js === -/** - * @deprecated - */ -export { default as A } from "./a"; ->default : Symbol(default, Decl(a.js, 0, 0)) ->A : Symbol(A, Decl(b.js, 3, 8)) - +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/plainJSGrammarErrors2.types b/tests/baselines/reference/plainJSGrammarErrors2.types index d2c6ae93364..dc8a39f4096 100644 --- a/tests/baselines/reference/plainJSGrammarErrors2.types +++ b/tests/baselines/reference/plainJSGrammarErrors2.types @@ -1,13 +1,5 @@ === tests/cases/conformance/salsa/plainJSGrammarErrors2.js === - -No type information for this code.=== /a.js === -export default 1; +// top-level return allowed in JS script files +No type information for this code.return No type information for this code. -No type information for this code.=== /b.js === -/** - * @deprecated - */ -export { default as A } from "./a"; ->default : 1 ->A : 1 - +No type information for this code. \ No newline at end of file diff --git a/tests/cases/conformance/salsa/plainJSGrammarErrors2.ts b/tests/cases/conformance/salsa/plainJSGrammarErrors2.ts index 73dfb48001e..53e82e022a9 100644 --- a/tests/cases/conformance/salsa/plainJSGrammarErrors2.ts +++ b/tests/cases/conformance/salsa/plainJSGrammarErrors2.ts @@ -4,11 +4,5 @@ // @allowJs: true // @filename: plainJSGrammarErrors2.js -// @filename: /a.js -export default 1; - -// @filename: /b.js -/** - * @deprecated - */ -export { default as A } from "./a"; +// top-level return allowed in JS script files +return