From d48f6179f1f97700bb0071dae8b4aa21692f8b75 Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Tue, 19 Apr 2016 12:50:50 +0000 Subject: [PATCH] fix 8117 --- src/compiler/emitter.ts | 2 +- .../singleLineCommentInConciseArrowFunctionES3.js | 14 ++++++++++++++ ...gleLineCommentInConciseArrowFunctionES3.symbols | 8 ++++++++ ...ingleLineCommentInConciseArrowFunctionES3.types | 11 +++++++++++ .../singleLineCommentInConciseArrowFunctionES3.ts | 5 +++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.js create mode 100644 tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.symbols create mode 100644 tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.types create mode 100644 tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 254b8d7e61..396f178cab 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -7879,7 +7879,7 @@ const _super = (function (geti, seti) { node.parent && node.parent.kind === SyntaxKind.ArrowFunction && (node.parent).body === node && - compilerOptions.target <= ScriptTarget.ES5) { + languageVersion <= ScriptTarget.ES5) { return false; } diff --git a/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.js b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.js new file mode 100644 index 0000000000..db4ab7950e --- /dev/null +++ b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.js @@ -0,0 +1,14 @@ +//// [singleLineCommentInConciseArrowFunctionES3.ts] +function test() { + return () => + // some comments here; + 123; +} + +//// [singleLineCommentInConciseArrowFunctionES3.js] +function test() { + return function () { + // some comments here; + return 123; + }; +} diff --git a/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.symbols b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.symbols new file mode 100644 index 0000000000..cb53d29288 --- /dev/null +++ b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts === +function test() { +>test : Symbol(test, Decl(singleLineCommentInConciseArrowFunctionES3.ts, 0, 0)) + + return () => + // some comments here; + 123; +} diff --git a/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.types b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.types new file mode 100644 index 0000000000..e8c449e7bb --- /dev/null +++ b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts === +function test() { +>test : () => () => number + + return () => +>() => // some comments here; 123 : () => number + + // some comments here; + 123; +>123 : number +} diff --git a/tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts b/tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts new file mode 100644 index 0000000000..0538df1c2d --- /dev/null +++ b/tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts @@ -0,0 +1,5 @@ +function test() { + return () => + // some comments here; + 123; +} \ No newline at end of file