From ce6681cc93481d399bb3cc7332fe8577db0ecd36 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 23 Feb 2015 15:43:20 -0800 Subject: [PATCH 01/20] Support GetDefinitionLocation on module names and aliases for new import/export syntax --- src/compiler/checker.ts | 11 +++--- src/compiler/utilities.ts | 6 +++ src/services/services.ts | 13 +++++++ .../goToDefinitionExternamModuleName6.ts | 13 +++++++ .../goToDefinitionExternamModuleName7.ts | 13 +++++++ .../goToDefinitionExternamModuleName8.ts | 13 +++++++ .../goToDefinitionExternamModuleName9.ts | 13 +++++++ .../fourslash/goToDefinitionImportedNames.ts | 21 ++++++++++ .../fourslash/goToDefinitionImportedNames2.ts | 21 ++++++++++ .../fourslash/goToDefinitionImportedNames3.ts | 38 +++++++++++++++++++ .../fourslash/goToDefinitionImportedNames4.ts | 21 ++++++++++ .../fourslash/goToDefinitionImportedNames5.ts | 21 ++++++++++ .../fourslash/goToDefinitionImportedNames6.ts | 21 ++++++++++ .../fourslash/goToDefinitionImportedNames7.ts | 19 ++++++++++ 14 files changed, 239 insertions(+), 5 deletions(-) create mode 100644 tests/cases/fourslash/goToDefinitionExternamModuleName6.ts create mode 100644 tests/cases/fourslash/goToDefinitionExternamModuleName7.ts create mode 100644 tests/cases/fourslash/goToDefinitionExternamModuleName8.ts create mode 100644 tests/cases/fourslash/goToDefinitionExternamModuleName9.ts create mode 100644 tests/cases/fourslash/goToDefinitionImportedNames.ts create mode 100644 tests/cases/fourslash/goToDefinitionImportedNames2.ts create mode 100644 tests/cases/fourslash/goToDefinitionImportedNames3.ts create mode 100644 tests/cases/fourslash/goToDefinitionImportedNames4.ts create mode 100644 tests/cases/fourslash/goToDefinitionImportedNames5.ts create mode 100644 tests/cases/fourslash/goToDefinitionImportedNames6.ts create mode 100644 tests/cases/fourslash/goToDefinitionImportedNames7.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index acb90c4767b..1a20940741d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10278,11 +10278,12 @@ module ts { case SyntaxKind.StringLiteral: // External module name in an import declaration - if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && - getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) { - var importSymbol = getSymbolOfNode(node.parent.parent); - var moduleType = getTypeOfSymbol(importSymbol); - return moduleType ? moduleType.symbol : undefined; + var moduleName: Expression; + if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) && + getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && + (node.parent).moduleSpecifier === node)) { + return resolveExternalModuleName(node, node); } // Intentional fall-through diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c5bb46aa962..b53c0007248 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -745,6 +745,12 @@ module ts { } var parent = name.parent; + if (parent.kind === SyntaxKind.ImportSpecifier || parent.kind === SyntaxKind.ExportSpecifier) { + if ((parent).propertyName) { + return true; + } + } + if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) { return (parent).name === name; } diff --git a/src/services/services.ts b/src/services/services.ts index e3d8923890b..79d27517369 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3244,6 +3244,13 @@ module ts { return undefined; } + if (symbol.flags & SymbolFlags.Import) { + var declaration = symbol.declarations[0]; + if (node.kind === SyntaxKind.Identifier && node.parent === declaration) { + symbol = typeInfoResolver.getAliasedSymbol(symbol); + } + } + var result: DefinitionInfo[] = []; // Because name in short-hand property assignment has two different meanings: property name and property value, @@ -4694,12 +4701,18 @@ module ts { } case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportDeclaration: + case SyntaxKind.ExportAssignment: + case SyntaxKind.ExportDeclaration: return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; // An external module can be a Value case SyntaxKind.SourceFile: return SemanticMeaning.Namespace | SemanticMeaning.Value; } + + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + Debug.fail("Unknown declaration type"); } diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName6.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName6.ts new file mode 100644 index 00000000000..46cafbb806c --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName6.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////import * from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName7.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName7.ts new file mode 100644 index 00000000000..dcaf4b1f021 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName7.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////import {Foo, Bar} from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName8.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName8.ts new file mode 100644 index 00000000000..03c36567dc0 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName8.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////export {Foo, Bar} from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName9.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName9.ts new file mode 100644 index 00000000000..43111c6763f --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName9.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////export * from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionImportedNames.ts b/tests/cases/fourslash/goToDefinitionImportedNames.ts new file mode 100644 index 00000000000..64eb2df96bf --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////export {/*classAliasDefinition*/Class} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames2.ts b/tests/cases/fourslash/goToDefinitionImportedNames2.ts new file mode 100644 index 00000000000..8533dad62a8 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames2.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////import {/*classAliasDefinition*/Class} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames3.ts b/tests/cases/fourslash/goToDefinitionImportedNames3.ts new file mode 100644 index 00000000000..d55137575ef --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames3.ts @@ -0,0 +1,38 @@ +/// + +// @Filename: e.ts +//// import {M, /*classAliasDefinition*/C, I} from "d"; +//// var c = new /*classReference*/C(); + + +// @Filename: d.ts +////export * from "c"; + + +// @Filename: c.ts +////export {Module as M, Class as C, Interface as I} from "b"; + + +// @Filename: b.ts +////export * from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("e.ts"); + +goTo.marker('classReference'); +goTo.definition(); +verify.caretAtMarker('classAliasDefinition'); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames4.ts b/tests/cases/fourslash/goToDefinitionImportedNames4.ts new file mode 100644 index 00000000000..cce49af874b --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames4.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////import {Class as /*classAliasDefinition*/ClassAlias} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames5.ts b/tests/cases/fourslash/goToDefinitionImportedNames5.ts new file mode 100644 index 00000000000..46a8c45e272 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames5.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////export {Class as /*classAliasDefinition*/ClassAlias} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames6.ts b/tests/cases/fourslash/goToDefinitionImportedNames6.ts new file mode 100644 index 00000000000..27b6c55d107 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames6.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////import /*moduleAliasDefinition*/alias = require("a"); + + +// @Filename: a.ts +/////*moduleDefinition*/export module Module { +////} +////export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('moduleAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('moduleDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames7.ts b/tests/cases/fourslash/goToDefinitionImportedNames7.ts new file mode 100644 index 00000000000..de77b935fcd --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames7.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: b.ts +////import /*classAliasDefinition*/defaultExport from "myLib"; + + +// @Filename: a.ts +////module Module { +////} +/////*classDefinition*/class Class { +//// private f; +////} +////export = Class; + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); From ca5ea19cd8555b2a5135b6068270b93c41767bf8 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 23 Feb 2015 16:45:39 -0800 Subject: [PATCH 02/20] accept baselines --- tests/baselines/reference/es6ImportNamedImport.types | 10 +++++----- .../reference/es6ImportNamedImportInEs5.types | 10 +++++----- tests/cases/fourslash/goToDefinitionImportedNames7.ts | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/baselines/reference/es6ImportNamedImport.types b/tests/baselines/reference/es6ImportNamedImport.types index e86955b3c96..cb06c9918ea 100644 --- a/tests/baselines/reference/es6ImportNamedImport.types +++ b/tests/baselines/reference/es6ImportNamedImport.types @@ -23,16 +23,16 @@ import { a } from "es6ImportNamedImport_0"; >a : number import { a as b } from "es6ImportNamedImport_0"; ->a : unknown +>a : number >b : number import { x, a as y } from "es6ImportNamedImport_0"; >x : number ->a : unknown +>a : number >y : number import { x as z, } from "es6ImportNamedImport_0"; ->x : unknown +>x : number >z : number import { m, } from "es6ImportNamedImport_0"; @@ -43,8 +43,8 @@ import { a1, x1 } from "es6ImportNamedImport_0"; >x1 : number import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; ->a1 : unknown +>a1 : number >a11 : number ->x1 : unknown +>x1 : number >x11 : number diff --git a/tests/baselines/reference/es6ImportNamedImportInEs5.types b/tests/baselines/reference/es6ImportNamedImportInEs5.types index 4f96b8a4dfa..334ae905e95 100644 --- a/tests/baselines/reference/es6ImportNamedImportInEs5.types +++ b/tests/baselines/reference/es6ImportNamedImportInEs5.types @@ -23,16 +23,16 @@ import { a } from "es6ImportNamedImportInEs5_0"; >a : number import { a as b } from "es6ImportNamedImportInEs5_0"; ->a : unknown +>a : number >b : number import { x, a as y } from "es6ImportNamedImportInEs5_0"; >x : number ->a : unknown +>a : number >y : number import { x as z, } from "es6ImportNamedImportInEs5_0"; ->x : unknown +>x : number >z : number import { m, } from "es6ImportNamedImportInEs5_0"; @@ -43,8 +43,8 @@ import { a1, x1 } from "es6ImportNamedImportInEs5_0"; >x1 : number import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; ->a1 : unknown +>a1 : number >a11 : number ->x1 : unknown +>x1 : number >x11 : number diff --git a/tests/cases/fourslash/goToDefinitionImportedNames7.ts b/tests/cases/fourslash/goToDefinitionImportedNames7.ts index de77b935fcd..5a43f0a1ee9 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames7.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames7.ts @@ -1,17 +1,17 @@ /// // @Filename: b.ts -////import /*classAliasDefinition*/defaultExport from "myLib"; +////import /*classAliasDefinition*/defaultExport from "a"; // @Filename: a.ts -////module Module { -////} /////*classDefinition*/class Class { //// private f; ////} ////export = Class; +debugger; + goTo.file("b.ts"); goTo.marker('classAliasDefinition'); From bb349dafccb1e174059079e4f6fda060ba909b93 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 23 Feb 2015 16:50:16 -0800 Subject: [PATCH 03/20] Add a comment --- src/services/services.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/services.ts b/src/services/services.ts index 79d27517369..38d444b6f68 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3244,6 +3244,10 @@ module ts { return undefined; } + // If this is an alias, and the request came at the declaration location + // get the aliased symbol instead. This allows for goto def on an import e.g. + // import {A, B} from "mod"; + // to jump to the implementation directelly. if (symbol.flags & SymbolFlags.Import) { var declaration = symbol.declarations[0]; if (node.kind === SyntaxKind.Identifier && node.parent === declaration) { From fa504f68087ab89d965f8dbf49db95b804014702 Mon Sep 17 00:00:00 2001 From: steveluc Date: Mon, 23 Feb 2015 23:44:15 -0800 Subject: [PATCH 04/20] Update project structure after change. After each change a timer is started. If timer finishes before another change takes place, project structure will be updated to reflect any changes in reference comments or import statements. --- src/server/editorServices.ts | 30 ++++++++++++++++-------------- src/server/server.ts | 7 +++++-- src/server/session.ts | 32 ++++++++++++++++++++------------ 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index d7eda52ce38..d3bf1718a28 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -101,13 +101,7 @@ module ts.server { } getScriptFileNames() { - var filenames: string[] = []; - for (var filename in this.filenameToScript) { - if (this.filenameToScript[filename] && this.filenameToScript[filename].isOpen) { - filenames.push(filename); - } - } - return filenames; + return this.roots.map(root => root.fileName); } getScriptVersion(filename: string) { @@ -536,15 +530,20 @@ module ts.server { updateProjectStructure() { this.log("updating project structure from ...", "Info"); this.printProjects(); + var openFilesReferenced: ScriptInfo[] = []; + var unattachedOpenFiles: ScriptInfo[] = []; for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { - var refdFile = this.openFilesReferenced[i]; - refdFile.defaultProject.updateGraph(); - var sourceFile = refdFile.defaultProject.getSourceFile(refdFile); - if (!sourceFile) { - this.openFilesReferenced = copyListRemovingItem(refdFile, this.openFilesReferenced); - this.addOpenFile(refdFile); + var referencedFile = this.openFilesReferenced[i]; + referencedFile.defaultProject.updateGraph(); + var sourceFile = referencedFile.defaultProject.getSourceFile(referencedFile); + if (sourceFile) { + openFilesReferenced.push(referencedFile); + } + else { + unattachedOpenFiles.push(referencedFile); } } + this.openFilesReferenced = openFilesReferenced; var openFileRoots: ScriptInfo[] = []; for (var i = 0, len = this.openFileRoots.length; i < len; i++) { var rootFile = this.openFileRoots[i]; @@ -555,12 +554,15 @@ module ts.server { openFileRoots.push(rootFile); } else { - // remove project from inferred projects list + // remove project from inferred projects list because root captured this.inferredProjects = copyListRemovingItem(rootedProject, this.inferredProjects); this.openFilesReferenced.push(rootFile); } } this.openFileRoots = openFileRoots; + for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) { + this.addOpenFile(unattachedOpenFiles[i]); + } this.printProjects(); } diff --git a/src/server/server.ts b/src/server/server.ts index 2b9040b4df3..c48ba951347 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -206,7 +206,10 @@ module ts.server { } }; - + var ioSession = new IOSession(ts.sys, logger); + process.on('uncaughtException', function(err: Error) { + ioSession.logError(err, "unknown"); + }); // Start listening - new IOSession(ts.sys, logger).listen(); + ioSession.listen(); } \ No newline at end of file diff --git a/src/server/session.ts b/src/server/session.ts index 21238e88992..7e9c6972a1f 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -181,18 +181,29 @@ module ts.server { } semanticCheck(file: string, project: Project) { - var diags = project.compilerService.languageService.getSemanticDiagnostics(file); - if (diags) { - var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + try { + var diags = project.compilerService.languageService.getSemanticDiagnostics(file); + + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + } + } + catch (err) { + this.logError(err, "semantic check"); } } syntacticCheck(file: string, project: Project) { - var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); - if (diags) { - var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + try { + var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + } + } + catch (err) { + this.logError(err, "syntactic check"); } } @@ -553,10 +564,7 @@ module ts.server { compilerService.host.editScript(file, start, end, insertString); this.changeSeq++; } - // update project structure on idle commented out - // until we can have the host return only the root files - // from getScriptFileNames() - //this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq); + this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq); } } From 68049ea5035884216b45215d6d2dcfa37619e798 Mon Sep 17 00:00:00 2001 From: steveluc Date: Tue, 24 Feb 2015 00:08:34 -0800 Subject: [PATCH 05/20] Added comments for updateProjectStructure. --- src/server/editorServices.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index d3bf1718a28..49a1ac4784c 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -530,8 +530,15 @@ module ts.server { updateProjectStructure() { this.log("updating project structure from ...", "Info"); this.printProjects(); + + // First loop through all open files that are referenced by projects but are not + // project roots. For each referenced file, see if the default project still + // references that file. If so, then just keep the file in the referenced list. + // If not, add the file to an unattached list, to be rechecked later. + var openFilesReferenced: ScriptInfo[] = []; var unattachedOpenFiles: ScriptInfo[] = []; + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { var referencedFile = this.openFilesReferenced[i]; referencedFile.defaultProject.updateGraph(); @@ -544,6 +551,14 @@ module ts.server { } } this.openFilesReferenced = openFilesReferenced; + + // Then, loop through all of the open files that are project roots. + // For each root file, note the project that it roots. Then see if + // any other projects newly reference the file. If zero projects + // newly reference the file, keep it as a root. If one or more + // projects newly references the file, remove its project from the + // inferred projects list (since it is no longer a root) and add + // the file to the open, referenced file list. var openFileRoots: ScriptInfo[] = []; for (var i = 0, len = this.openFileRoots.length; i < len; i++) { var rootFile = this.openFileRoots[i]; @@ -560,6 +575,10 @@ module ts.server { } } this.openFileRoots = openFileRoots; + + // Finally, if we found any open, referenced files that are no longer + // referenced by their default project, treat them as newly opened + // by the editor. for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) { this.addOpenFile(unattachedOpenFiles[i]); } From 61e6b3258da980efdb340ed0b76c3d20a76b3ebc Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 24 Feb 2015 01:18:31 -0800 Subject: [PATCH 06/20] Remove debugger statement --- tests/cases/fourslash/goToDefinitionImportedNames7.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/cases/fourslash/goToDefinitionImportedNames7.ts b/tests/cases/fourslash/goToDefinitionImportedNames7.ts index 5a43f0a1ee9..46d09012d40 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames7.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames7.ts @@ -10,8 +10,6 @@ ////} ////export = Class; -debugger; - goTo.file("b.ts"); goTo.marker('classAliasDefinition'); From e93748ac58eaea3995260af25b0562eaad68af0e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 24 Feb 2015 01:19:48 -0800 Subject: [PATCH 07/20] Support find references on the new import/export syntax --- src/services/services.ts | 68 +++++++++++++++++-- .../fourslash/findAllRefsOnImportAliases.ts | 29 ++++++++ .../fourslash/findAllRefsOnImportAliases2.ts | 31 +++++++++ 3 files changed, 122 insertions(+), 6 deletions(-) create mode 100644 tests/cases/fourslash/findAllRefsOnImportAliases.ts create mode 100644 tests/cases/fourslash/findAllRefsOnImportAliases2.ts diff --git a/src/services/services.ts b/src/services/services.ts index db6a09c1a71..708869fddf5 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3986,7 +3986,7 @@ module ts { var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); // Get the text to search for, we need to normalize it as external module names will have quote - var declaredName = getDeclaredName(symbol); + var declaredName = getDeclaredName(symbol, node); // Try to get the smallest valid scope that we can limit our search to; // otherwise we'll need to search globally (i.e. include each file). @@ -4003,7 +4003,7 @@ module ts { getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); } else { - var internedName = getInternedName(symbol, declarations) + var internedName = getInternedName(symbol, node, declarations) forEach(sourceFiles, sourceFile => { cancellationToken.throwIfCancellationRequested(); @@ -4023,13 +4023,51 @@ module ts { return result; - function getDeclaredName(symbol: Symbol) { + function isImportOrExportSpecifierName(location: Node): boolean { + return location.parent && + (location.parent.kind === SyntaxKind.ImportSpecifier || location.parent.kind === SyntaxKind.ExportSpecifier) && + (location.parent).propertyName === location; + } + + function isImportOrExportSpecifierImportSymbol(symbol: Symbol) { + return (symbol.flags & SymbolFlags.Import) && forEach(symbol.declarations, declaration => { + return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier; + }); + } + + function getDeclaredName(symbol: Symbol, location: Node) { + // Special case for function expressions, whose names are solely local to their bodies. + var functionExpression = forEach(symbol.declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); + + // When a name gets interned into a SourceFile's 'identifiers' Map, + // its name is escaped and stored in the same way its symbol name/identifier + // name should be stored. Function expressions, however, are a special case, + // because despite sometimes having a name, the binder unconditionally binds them + // to a symbol with the name "__function". + if (functionExpression && functionExpression.name) { + var name = functionExpression.name.text; + } + + // If this is an export or import specifier it could have been renamed using the as syntax. + // if so we want to search for whatever under the cursor, the symbol is pointing to the alias (name) + // so check for the propertyName. + if (isImportOrExportSpecifierName(location)) { + return location.getText(); + } + var name = typeInfoResolver.symbolToString(symbol); return stripQuotes(name); } - function getInternedName(symbol: Symbol, declarations: Declaration[]): string { + function getInternedName(symbol: Symbol, location: Node, declarations: Declaration[]): string { + // If this is an export or import specifier it could have been renamed using the as syntax. + // if so we want to search for whatever under the cursor, the symbol is pointing to the alias (name) + // so check for the propertyName. + if (isImportOrExportSpecifierName(location)) { + return location.getText(); + } + // Special case for function expressions, whose names are solely local to their bodies. var functionExpression = forEach(declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); @@ -4058,16 +4096,22 @@ module ts { function getSymbolScope(symbol: Symbol): Node { // If this is private property or method, the scope is the containing class - if (symbol.getFlags() && (SymbolFlags.Property | SymbolFlags.Method)) { + if (symbol.flags & (SymbolFlags.Property | SymbolFlags.Method)) { var privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined); if (privateDeclaration) { return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration); } } + // If the symbol is an import we would like to find it if we are looking for what it imports. + // So consider it visibile outside its declaration scope. + if (symbol.flags & SymbolFlags.Import) { + return undefined; + } + // if this symbol is visible from its parent container, e.g. exported, then bail out // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.getFlags() & SymbolFlags.UnionProperty)) { + if (symbol.parent || (symbol.flags & SymbolFlags.UnionProperty)) { return undefined; } @@ -4422,6 +4466,11 @@ module ts { // The search set contains at least the current symbol var result = [symbol]; + // If the symbol is an alias, add what it alaises to the list + if (isImportOrExportSpecifierImportSymbol(symbol)) { + result.push(typeInfoResolver.getAliasedSymbol(symbol)); + } + // If the location is in a context sensitive location (i.e. in an object literal) try // to get a contextual type for it, and add the property symbol from the contextual // type to the search set @@ -4498,6 +4547,13 @@ module ts { return true; } + // If the reference symbol is an alias, check if what it is aliasing is one of the search + // symbols. + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && + searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + return true; + } + // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases.ts b/tests/cases/fourslash/findAllRefsOnImportAliases.ts new file mode 100644 index 00000000000..dbfab33aa86 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsOnImportAliases.ts @@ -0,0 +1,29 @@ +/// + +//@Filename: a.ts +////export class /*1*/Class{ +////} + +//@Filename: b.ts +////import { /*2*/Class } from "a"; +//// +////var c = new /*3*/Class(); + +//@Filename: c.ts +////export { /*4*/Class } from "a"; + +goTo.file("a.ts"); +goTo.marker("1"); +verify.referencesCountIs(4); + +goTo.file("b.ts"); +goTo.marker("2"); +verify.referencesCountIs(4); + +goTo.marker("3"); +verify.referencesCountIs(4); + +goTo.file("c.ts"); +goTo.marker("4"); +verify.referencesCountIs(4); + diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases2.ts b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts new file mode 100644 index 00000000000..dca6b13bbd2 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts @@ -0,0 +1,31 @@ +/// + +//@Filename: a.ts +////export class /*1*/Class{ +////} + +//@Filename: b.ts +////import { /*2*/Class as /*3*/C2} from "a"; +//// +////var c = new C2(); + +//@Filename: c.ts +////export { /*4*/Class as /*5*/C3 } from "a"; + +goTo.file("a.ts"); +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.file("b.ts"); +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(2); + +goTo.file("c.ts"); +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); +verify.referencesCountIs(1); From 7b7d2b6006ec510fc391fc1a197647ad3382c622 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 24 Feb 2015 11:54:10 -0800 Subject: [PATCH 08/20] Support navigation bar for new import/export syntax --- src/services/navigationBar.ts | 45 ++++++++++++++++++- .../scriptLexicalStructureExports.ts | 18 ++++++++ .../scriptLexicalStructureImports.ts | 25 +++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/scriptLexicalStructureExports.ts create mode 100644 tests/cases/fourslash/scriptLexicalStructureImports.ts diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index b254397f8b0..8bc02d7698b 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -50,6 +50,38 @@ module ts.NavigationBar { case SyntaxKind.ArrayBindingPattern: forEach((node).elements, visit); break; + + case SyntaxKind.ExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + if ((node).exportClause) { + forEach((node).exportClause.elements, visit); + } + break; + + case SyntaxKind.ImportDeclaration: + var importClause = (node).importClause; + if (importClause) { + // Handle default import case e.g.: + // import d from "mod"; + if (importClause.name) { + childNodes.push(importClause); + } + + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + childNodes.push(importClause.namedBindings); + } + else { + forEach((importClause.namedBindings).elements, visit); + } + } + } + break; + case SyntaxKind.BindingElement: case SyntaxKind.VariableDeclaration: if (isBindingPattern((node).name)) { @@ -62,7 +94,11 @@ module ts.NavigationBar { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ExportSpecifier: childNodes.push(node); + break; } } @@ -291,9 +327,16 @@ module ts.NavigationBar { else { return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); } - + case SyntaxKind.Constructor: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); + + case SyntaxKind.ExportSpecifier: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportClause: + case SyntaxKind.NamespaceImport: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.alias); } return undefined; diff --git a/tests/cases/fourslash/scriptLexicalStructureExports.ts b/tests/cases/fourslash/scriptLexicalStructureExports.ts new file mode 100644 index 00000000000..f2a4adfa0d1 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureExports.ts @@ -0,0 +1,18 @@ +/// + + +////export { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////export { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a" +//// +////{| "itemName": "e", "kind": "alias", "parentName": "" |} export import e = require("a"); +//// +////export * from "a"; // no bindings here + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(4); diff --git a/tests/cases/fourslash/scriptLexicalStructureImports.ts b/tests/cases/fourslash/scriptLexicalStructureImports.ts new file mode 100644 index 00000000000..9d9e3e8b468 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureImports.ts @@ -0,0 +1,25 @@ +/// + + +////import {| "itemName": "d1", "kind": "alias", "parentName": "" |}d1 from "a"; +//// +////import { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////import { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a" +//// +////import {| "itemName": "d2", "kind": "alias", "parentName": "" |}d2, +//// { {| "itemName": "c", "kind": "alias", "parentName": "" |}c, +//// {| "itemName": "D", "kind": "alias", "parentName": "" |} d as D } from "a" +//// +////{| "itemName": "e", "kind": "alias", "parentName": "" |}import e = require("a"); +//// +////import {| "itemName": "ns", "kind": "alias", "parentName": "" |}* as ns from "a"; + + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(9); From 951f7cf31f977a23d7f893a8e549dd5ecc95498a Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 24 Feb 2015 12:24:41 -0800 Subject: [PATCH 09/20] Support navigateTo for new import/export syntax --- src/services/services.ts | 42 +++++++++++++++++++ tests/cases/fourslash/navigateItemsExports.ts | 20 +++++++++ tests/cases/fourslash/navigateItemsImports.ts | 25 +++++++++++ 3 files changed, 87 insertions(+) create mode 100644 tests/cases/fourslash/navigateItemsExports.ts create mode 100644 tests/cases/fourslash/navigateItemsImports.ts diff --git a/src/services/services.ts b/src/services/services.ts index 708869fddf5..be515abeb50 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -802,6 +802,11 @@ module ts { case SyntaxKind.EnumDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportClause: + case SyntaxKind.NamespaceImport: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.TypeLiteral: @@ -841,6 +846,37 @@ module ts { case SyntaxKind.PropertySignature: namedDeclarations.push(node); break; + + case SyntaxKind.ExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + if ((node).exportClause) { + forEach((node).exportClause.elements, visit); + } + break; + + case SyntaxKind.ImportDeclaration: + var importClause = (node).importClause; + if (importClause) { + // Handle default import case e.g.: + // import d from "mod"; + if (importClause.name) { + namedDeclarations.push(importClause); + } + + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + namedDeclarations.push(importClause.namedBindings); + } + else { + forEach((importClause.namedBindings).elements, visit); + } + } + } + break; } }); @@ -2010,6 +2046,12 @@ module ts { case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportClause: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.NamespaceImport: + return ScriptElementKind.alias; } return ScriptElementKind.unknown; } diff --git a/tests/cases/fourslash/navigateItemsExports.ts b/tests/cases/fourslash/navigateItemsExports.ts new file mode 100644 index 00000000000..646d557aace --- /dev/null +++ b/tests/cases/fourslash/navigateItemsExports.ts @@ -0,0 +1,20 @@ +/// + +////export { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////export { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a"; +//// +////export { {| "itemName": "c", "kind": "alias", "parentName": "" |}c, +//// {| "itemName": "D", "kind": "alias", "parentName": "" |}d as D } from "a"; +//// +////{| "itemName": "f", "kind": "alias", "parentName": "" |}export import f = require("a"); + +test.markers().forEach(marker => { + verify.navigationItemsListContains( + marker.data.itemName, + marker.data.kind, + marker.data.itemName, + "exact", + marker.fileName, + marker.data.parentName); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/navigateItemsImports.ts b/tests/cases/fourslash/navigateItemsImports.ts new file mode 100644 index 00000000000..8ac3e000639 --- /dev/null +++ b/tests/cases/fourslash/navigateItemsImports.ts @@ -0,0 +1,25 @@ +/// + +////import {| "itemName": "ns", "kind": "alias", "parentName": "" |}* as ns from "a"; +//// +////import { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////import { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a"; +//// +////import { {| "itemName": "c", "kind": "alias", "parentName": "" |}c, +//// {| "itemName": "D", "kind": "alias", "parentName": "" |}d as D } from "a"; +//// +////import {| "itemName": "d1", "kind": "alias", "parentName": "" |}d1, { +//// {| "itemName": "e", "kind": "alias", "parentName": "" |}e } from "a"; +//// +////{| "itemName": "f", "kind": "alias", "parentName": "" |}import f = require("a"); + +test.markers().forEach(marker => { + verify.navigationItemsListContains( + marker.data.itemName, + marker.data.kind, + marker.data.itemName, + "exact", + marker.fileName, + marker.data.parentName); +}); \ No newline at end of file From bc4057af858e0a50c4dffab9286eb24cc7114230 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 24 Feb 2015 13:03:14 -0800 Subject: [PATCH 10/20] breakpoint support for new import/export syntax --- src/services/breakpoints.ts | 10 +++++- .../reference/bpSpan_exports.baseline | 17 +++++++++ .../reference/bpSpan_imports.baseline | 35 +++++++++++++++++++ .../fourslash/breakpointValidationExports.ts | 9 +++++ .../fourslash/breakpointValidationImports.ts | 12 +++++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/bpSpan_exports.baseline create mode 100644 tests/baselines/reference/bpSpan_imports.baseline create mode 100644 tests/cases/fourslash/breakpointValidationExports.ts create mode 100644 tests/cases/fourslash/breakpointValidationImports.ts diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index a4943705e72..59c4e716890 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -178,7 +178,15 @@ module ts.BreakpointResolver { case SyntaxKind.ImportEqualsDeclaration: // import statement without including semicolon - return textSpan(node,(node).moduleReference); + return textSpan(node, (node).moduleReference); + + case SyntaxKind.ImportDeclaration: + // import statement without including semicolon + return textSpan(node, (node).moduleSpecifier); + + case SyntaxKind.ExportDeclaration: + // import statement without including semicolon + return textSpan(node, (node).moduleSpecifier); case SyntaxKind.ModuleDeclaration: // span on complete module if it is instantiated diff --git a/tests/baselines/reference/bpSpan_exports.baseline b/tests/baselines/reference/bpSpan_exports.baseline new file mode 100644 index 00000000000..1b09fb75a2f --- /dev/null +++ b/tests/baselines/reference/bpSpan_exports.baseline @@ -0,0 +1,17 @@ + +1 >export * from "a"; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17} + >export * from "a" + >:=> (line 1, col 0) to (line 1, col 17) +-------------------------------- +2 >export {a as A} from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (19 to 44) SpanInfo: {"start":19,"length":24} + >export {a as A} from "a" + >:=> (line 2, col 0) to (line 2, col 24) +-------------------------------- +3 >export import e = require("a"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (45 to 75) SpanInfo: {"start":45,"length":30} + >export import e = require("a") + >:=> (line 3, col 0) to (line 3, col 30) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_imports.baseline b/tests/baselines/reference/bpSpan_imports.baseline new file mode 100644 index 00000000000..c59f9faf904 --- /dev/null +++ b/tests/baselines/reference/bpSpan_imports.baseline @@ -0,0 +1,35 @@ + +1 >import * as NS from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 24) SpanInfo: {"start":0,"length":23} + >import * as NS from "a" + >:=> (line 1, col 0) to (line 1, col 23) +-------------------------------- +2 >import {a as A} from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 50) SpanInfo: {"start":25,"length":24} + >import {a as A} from "a" + >:=> (line 2, col 0) to (line 2, col 24) +-------------------------------- +3 > import d from "a"; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (51 to 70) SpanInfo: {"start":52,"length":17} + >import d from "a" + >:=> (line 3, col 1) to (line 3, col 18) +-------------------------------- +4 >import d2, {c, d as D} from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (71 to 103) SpanInfo: {"start":71,"length":31} + >import d2, {c, d as D} from "a" + >:=> (line 4, col 0) to (line 4, col 31) +-------------------------------- +5 >import "a"; + + ~~~~~~~~~~~~ => Pos: (104 to 115) SpanInfo: {"start":104,"length":10} + >import "a" + >:=> (line 5, col 0) to (line 5, col 10) +-------------------------------- +6 >import e = require("a"); + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (116 to 139) SpanInfo: {"start":116,"length":23} + >import e = require("a") + >:=> (line 6, col 0) to (line 6, col 23) \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationExports.ts b/tests/cases/fourslash/breakpointValidationExports.ts new file mode 100644 index 00000000000..092d4fdc143 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationExports.ts @@ -0,0 +1,9 @@ +/// + +// @BaselineFile: bpSpan_exports.baseline +// @Filename: bpSpan_exports.ts +////export * from "a"; +////export {a as A} from "a"; +////export import e = require("a"); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationImports.ts b/tests/cases/fourslash/breakpointValidationImports.ts new file mode 100644 index 00000000000..c2ec25a1096 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationImports.ts @@ -0,0 +1,12 @@ +/// + +// @BaselineFile: bpSpan_imports.baseline +// @Filename: bpSpan_imports.ts +////import * as NS from "a"; +////import {a as A} from "a"; +//// import d from "a"; +////import d2, {c, d as D} from "a"; +////import "a"; +////import e = require("a"); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file From ebd63c0fde464cb33e95bb8b5997b6fc5aaa66ca Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 13:32:45 -0800 Subject: [PATCH 11/20] Remove optimization of eliding the preamble code for functions without statements. --- src/compiler/emitter.ts | 42 +------- .../reference/accessorWithRestParam.js | 14 ++- .../arrayLiteralInNonVarArgParameter.js | 7 +- .../reference/baseTypeAfterDerivedType.js | 7 +- tests/baselines/reference/callWithSpread.js | 8 ++ .../collisionRestParameterFunction.js | 4 + ...llisionRestParameterFunctionExpressions.js | 4 + .../reference/contextualTyping.js.map | 2 +- .../reference/contextualTyping.sourcemap.txt | 4 +- ...RestParametersOfFunctionAndFunctionType.js | 7 +- .../baselines/reference/emitArrowFunction.js | 7 +- .../reference/emitRestParametersFunction.js | 14 ++- .../emitRestParametersFunctionExpression.js | 28 +++++- .../emitRestParametersFunctionProperty.js | 7 +- .../reference/emitRestParametersMethod.js | 28 +++++- tests/baselines/reference/es6ClassTest2.js | 7 +- .../reference/fatarrowfunctionsErrors.js | 7 +- .../fatarrowfunctionsOptionalArgs.js | 7 +- tests/baselines/reference/functionCall10.js | 7 +- tests/baselines/reference/functionCall13.js | 7 +- tests/baselines/reference/functionCall14.js | 7 +- tests/baselines/reference/functionCall15.js | 7 +- tests/baselines/reference/functionCall16.js | 7 +- tests/baselines/reference/functionCall17.js | 7 +- ...icitAnyDeclareFunctionWithoutFormalType.js | 7 +- ...eArgumentsInSignatureWithRestParameters.js | 21 +++- .../noImplicitAnyParametersInBareFunctions.js | 14 ++- .../noImplicitAnyParametersInClass.js | 28 +++++- .../noImplicitAnyParametersInModule.js | 14 ++- .../optionalBindingParametersInOverloads1.js | 4 + .../optionalBindingParametersInOverloads2.js | 4 + tests/baselines/reference/out-flag.js.map | 2 +- .../reference/out-flag.sourcemap.txt | 8 +- .../parserMemberAccessorDeclaration18.js | 7 +- .../reference/parserParameterList9.js | 7 +- tests/baselines/reference/properties.js.map | 2 +- .../reference/properties.sourcemap.txt | 8 +- .../recursiveClassReferenceTest.js.map | 2 +- .../recursiveClassReferenceTest.sourcemap.txt | 4 +- .../baselines/reference/restArgMissingName.js | 7 +- .../reference/restParamAsOptional.js | 7 +- .../restParameterAssignmentCompatibility.js | 4 + ...estParameterWithoutAnnotationIsAnyArray.js | 49 ++++++++-- tests/baselines/reference/restParameters.js | 28 +++++- .../restParametersOfNonArrayTypes.js | 49 ++++++++-- .../restParametersOfNonArrayTypes2.js | 98 ++++++++++++++++--- .../restParametersWithArrayTypeAnnotations.js | 98 ++++++++++++++++--- .../reference/restParamsWithNonRestParams.js | 21 +++- .../sourceMap-FileWithComments.js.map | 2 +- .../sourceMap-FileWithComments.sourcemap.txt | 4 +- ...alidationFunctionPropertyAssignment.js.map | 2 +- ...onFunctionPropertyAssignment.sourcemap.txt | 4 +- ...tionExpressionsInSubstitutionExpression.js | 4 + .../baselines/reference/typeResolution.js.map | 2 +- .../reference/typeResolution.sourcemap.txt | 20 ++-- .../reference/undeclaredModuleError.js | 7 +- tests/baselines/reference/underscoreTest1.js | 7 +- .../reference/varArgParamTypeCheck.js | 4 + .../reference/varArgWithNoParamName.js | 7 +- tests/baselines/reference/vararg.js | 4 + 60 files changed, 638 insertions(+), 168 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3247b5ff1d1..f9624399038 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3992,46 +3992,6 @@ module ts { } function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) { - // If the body has no statements, and we know there's no code that would cause any - // prologue to be emitted, then just do a simple emit if the empty block. - if (body.statements.length === 0 && !anyParameterHasBindingPatternOrInitializer(node)) { - emitFunctionBodyWithNoStatements(node, body); - } - else { - emitFunctionBodyWithStatements(node, body); - } - } - - function anyParameterHasBindingPatternOrInitializer(func: FunctionLikeDeclaration) { - return forEach(func.parameters, hasBindingPatternOrInitializer); - } - - function hasBindingPatternOrInitializer(parameter: ParameterDeclaration) { - return parameter.initializer || isBindingPattern(parameter.name); - } - - function emitFunctionBodyWithNoStatements(node: FunctionLikeDeclaration, body: Block) { - var singleLine = isSingleLineEmptyBlock(node.body); - - write(" {"); - if (singleLine) { - write(" "); - } - else { - increaseIndent(); - writeLine(); - } - - emitLeadingCommentsOfPosition(body.statements.end); - - if (!singleLine) { - decreaseIndent(); - } - - emitToken(SyntaxKind.CloseBraceToken, body.statements.end); - } - - function emitFunctionBodyWithStatements(node: FunctionLikeDeclaration, body: Block) { write(" {"); scopeEmitStart(node); @@ -4046,7 +4006,7 @@ module ts { var preambleEmitted = writer.getTextPos() !== outPos; if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var i = 0, n = body.statements.length; i < n; i++) { + for (var i = startIndex, n = body.statements.length; i < n; i++) { write(" "); emit(body.statements[i]); } diff --git a/tests/baselines/reference/accessorWithRestParam.js b/tests/baselines/reference/accessorWithRestParam.js index a0b7e849e51..9feafe1904d 100644 --- a/tests/baselines/reference/accessorWithRestParam.js +++ b/tests/baselines/reference/accessorWithRestParam.js @@ -10,12 +10,22 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - set: function () { }, + set: function () { + var v = []; + for (var _i = 0; _i < arguments.length; _i++) { + v[_i - 0] = arguments[_i]; + } + }, enumerable: true, configurable: true }); Object.defineProperty(C, "X", { - set: function () { }, + set: function () { + var v2 = []; + for (var _i = 0; _i < arguments.length; _i++) { + v2[_i - 0] = arguments[_i]; + } + }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js index 9edf545f8b4..57cba07d6bf 100644 --- a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js +++ b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js @@ -5,5 +5,10 @@ panic([], 'one', 'two'); //// [arrayLiteralInNonVarArgParameter.js] -function panic(val) { } +function panic(val) { + var opt = []; + for (var _i = 1; _i < arguments.length; _i++) { + opt[_i - 1] = arguments[_i]; + } +} panic([], 'one', 'two'); diff --git a/tests/baselines/reference/baseTypeAfterDerivedType.js b/tests/baselines/reference/baseTypeAfterDerivedType.js index 65b73a17542..c64239ac0c8 100644 --- a/tests/baselines/reference/baseTypeAfterDerivedType.js +++ b/tests/baselines/reference/baseTypeAfterDerivedType.js @@ -20,6 +20,11 @@ interface Base2 { var Derived2 = (function () { function Derived2() { } - Derived2.prototype.method = function () { }; + Derived2.prototype.method = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + }; return Derived2; })(); diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index e9f7a7a3288..d676c0f2a33 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -61,6 +61,10 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; function foo(x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } } var a; var z; @@ -89,6 +93,10 @@ var C = (function () { this.foo.apply(this, [x, y].concat(z)); } C.prototype.foo = function (x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } }; return C; })(); diff --git a/tests/baselines/reference/collisionRestParameterFunction.js b/tests/baselines/reference/collisionRestParameterFunction.js index 9ae266dad41..8660e8f5db0 100644 --- a/tests/baselines/reference/collisionRestParameterFunction.js +++ b/tests/baselines/reference/collisionRestParameterFunction.js @@ -56,6 +56,10 @@ function f3NoError() { var _i = 10; // no error } function f4(_i) { + var rest = []; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; + } } function f4NoError(_i) { } diff --git a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js index f45619ddb71..22709b087eb 100644 --- a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js +++ b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js @@ -47,6 +47,10 @@ function foo() { var _i = 10; // no error } function f4(_i) { + var rest = []; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; + } } function f4NoError(_i) { } diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index 7cb571ee5af..df52fd930cb 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAA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G,CAAC,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AA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ference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 9dc9c4b3ee6..45b93e3ce97 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -2210,8 +2210,8 @@ sourceFile:contextualTyping.ts 2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0) 3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) 4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) -5 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) -6 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) +5 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) name (c9t5) +6 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) name (c9t5) --- >>>; 1 > diff --git a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js index 0150c3f9d42..563551d67a8 100644 --- a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js +++ b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js @@ -11,7 +11,12 @@ var f6 = () => { return [10]; } //// [declFileRestParametersOfFunctionAndFunctionType.js] -function f1() { } +function f1() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} function f2(x) { } function f3(x) { } function f4() { } diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js index 455972f781b..7e2617045a8 100644 --- a/tests/baselines/reference/emitArrowFunction.js +++ b/tests/baselines/reference/emitArrowFunction.js @@ -10,7 +10,12 @@ foo(() => { return false; }); //// [emitArrowFunction.js] var f1 = function () { }; var f2 = function (x, y) { }; -var f3 = function (x, y) { }; +var f3 = function (x, y) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +}; var f4 = function (x, y, z) { if (z === void 0) { z = 10; } }; diff --git a/tests/baselines/reference/emitRestParametersFunction.js b/tests/baselines/reference/emitRestParametersFunction.js index 4ee4ff06df9..01116f2ac92 100644 --- a/tests/baselines/reference/emitRestParametersFunction.js +++ b/tests/baselines/reference/emitRestParametersFunction.js @@ -3,5 +3,15 @@ function bar(...rest) { } function foo(x: number, y: string, ...rest) { } //// [emitRestParametersFunction.js] -function bar() { } -function foo(x, y) { } +function bar() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +} +function foo(x, y) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/emitRestParametersFunctionExpression.js b/tests/baselines/reference/emitRestParametersFunctionExpression.js index 6229c1e8d64..da87cc79f2d 100644 --- a/tests/baselines/reference/emitRestParametersFunctionExpression.js +++ b/tests/baselines/reference/emitRestParametersFunctionExpression.js @@ -6,7 +6,27 @@ var funcExp3 = (function (...rest) { })() //// [emitRestParametersFunctionExpression.js] -var funcExp = function () { }; -var funcExp1 = function (X) { }; -var funcExp2 = function () { }; -var funcExp3 = (function () { })(); +var funcExp = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +}; +var funcExp1 = function (X) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +}; +var funcExp2 = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +}; +var funcExp3 = (function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +})(); diff --git a/tests/baselines/reference/emitRestParametersFunctionProperty.js b/tests/baselines/reference/emitRestParametersFunctionProperty.js index eec67fb880a..4fd60a9269d 100644 --- a/tests/baselines/reference/emitRestParametersFunctionProperty.js +++ b/tests/baselines/reference/emitRestParametersFunctionProperty.js @@ -10,5 +10,10 @@ var obj2 = { //// [emitRestParametersFunctionProperty.js] var obj; var obj2 = { - func: function () { } + func: function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/emitRestParametersMethod.js b/tests/baselines/reference/emitRestParametersMethod.js index 4e4c62dc47b..5ceb6d768f8 100644 --- a/tests/baselines/reference/emitRestParametersMethod.js +++ b/tests/baselines/reference/emitRestParametersMethod.js @@ -21,8 +21,18 @@ var C = (function () { rest[_i - 1] = arguments[_i]; } } - C.prototype.bar = function () { }; - C.prototype.foo = function (x) { }; + C.prototype.bar = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } + }; + C.prototype.foo = function (x) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + }; return C; })(); var D = (function () { @@ -32,7 +42,17 @@ var D = (function () { rest[_i - 0] = arguments[_i]; } } - D.prototype.bar = function () { }; - D.prototype.foo = function (x) { }; + D.prototype.bar = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } + }; + D.prototype.foo = function (x) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + }; return D; })(); diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index fb0349c9044..f23be04fd17 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -240,7 +240,12 @@ var SplatMonster = (function () { args[_i - 0] = arguments[_i]; } } - SplatMonster.prototype.roar = function (name) { }; + SplatMonster.prototype.roar = function (name) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + }; return SplatMonster; })(); function foo() { return true; } diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.js b/tests/baselines/reference/fatarrowfunctionsErrors.js index 7b7a8f30f05..2ac20f1966a 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.js +++ b/tests/baselines/reference/fatarrowfunctionsErrors.js @@ -33,4 +33,9 @@ false ? (function () { return null; }) : null; var x1 = function () { }; var x2 = function (a) { }; var x3 = function (a) { }; -var x4 = function () { }; +var x4 = function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } +}; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js index 9052b894337..e6e43f8bbf4 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js @@ -351,7 +351,12 @@ false ? null : function () { return 108; }); // Function Parameters -function foo() { } +function foo() { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } +} foo(function (a) { return 110; }, (function (a) { return 111; }), function (a) { return 112; }, function (a) { return 113; }, function (a, b) { return 114; }, function (a) { return 115; }, function (a) { diff --git a/tests/baselines/reference/functionCall10.js b/tests/baselines/reference/functionCall10.js index 299d73ee24a..9d5cb33a56a 100644 --- a/tests/baselines/reference/functionCall10.js +++ b/tests/baselines/reference/functionCall10.js @@ -7,7 +7,12 @@ foo(1, 'bar'); //// [functionCall10.js] -function foo() { } +function foo() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } +} ; foo(0, 1); foo('foo'); diff --git a/tests/baselines/reference/functionCall13.js b/tests/baselines/reference/functionCall13.js index a66ecafc8b4..ce57f43215e 100644 --- a/tests/baselines/reference/functionCall13.js +++ b/tests/baselines/reference/functionCall13.js @@ -8,7 +8,12 @@ foo('foo', 1, 3); //// [functionCall13.js] -function foo(a) { } +function foo(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo(); diff --git a/tests/baselines/reference/functionCall14.js b/tests/baselines/reference/functionCall14.js index f3af9f65436..47447f46db5 100644 --- a/tests/baselines/reference/functionCall14.js +++ b/tests/baselines/reference/functionCall14.js @@ -8,7 +8,12 @@ foo('foo', 1, 3); //// [functionCall14.js] -function foo(a) { } +function foo(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo(); diff --git a/tests/baselines/reference/functionCall15.js b/tests/baselines/reference/functionCall15.js index baef02be27d..28fa4c917c8 100644 --- a/tests/baselines/reference/functionCall15.js +++ b/tests/baselines/reference/functionCall15.js @@ -2,4 +2,9 @@ function foo(a?:string, b?:number, ...b:number[]){} //// [functionCall15.js] -function foo(a, b) { } +function foo(a, b) { + var b = []; + for (var _i = 2; _i < arguments.length; _i++) { + b[_i - 2] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/functionCall16.js b/tests/baselines/reference/functionCall16.js index d9b416581a7..187572a9a7e 100644 --- a/tests/baselines/reference/functionCall16.js +++ b/tests/baselines/reference/functionCall16.js @@ -9,7 +9,12 @@ foo('foo', 'bar', 3); //// [functionCall16.js] -function foo(a, b) { } +function foo(a, b) { + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo('foo', 'bar'); diff --git a/tests/baselines/reference/functionCall17.js b/tests/baselines/reference/functionCall17.js index 62495358210..73f7fd6070b 100644 --- a/tests/baselines/reference/functionCall17.js +++ b/tests/baselines/reference/functionCall17.js @@ -9,7 +9,12 @@ foo('foo', 'bar', 3, 4); //// [functionCall17.js] -function foo(a, b, c) { } +function foo(a, b, c) { + var d = []; + for (var _i = 3; _i < arguments.length; _i++) { + d[_i - 3] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo(); diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js index 4dce5ba1816..c13479daff3 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js @@ -19,7 +19,12 @@ function bar(x, y) { } ; // error at "y"; no error at "x" function func2(a, b, c) { } ; // error at "a,b,c" -function func3() { } +function func3() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} ; // error at "args" function func4(z, w) { if (z === void 0) { z = null; } diff --git a/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js b/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js index de0c107e561..97fefc0571c 100644 --- a/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js +++ b/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js @@ -12,9 +12,24 @@ i(a); // OK //// [inferTypeArgumentsInSignatureWithRestParameters.js] -function f(array) { } -function g(array) { } -function h(nonarray) { } +function f(array) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } +} +function g(array) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } +} +function h(nonarray) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } +} function i(array, opt) { } var a = [1, 2, 3, 4, 5]; f(a); // OK diff --git a/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js b/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js index bfa7f4b868f..8efe32d3140 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js +++ b/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js @@ -56,9 +56,19 @@ function f4(x, y, z) { } // Implicit-'any' errors for x, and z. function f5(x, y, z) { } // Implicit-'any[]' error for r. -function f6() { } +function f6() { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } +} // Implicit-'any'/'any[]' errors for x, r. -function f7(x) { } +function f7(x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } +} function f8(x3, y3) { } // No implicit-'any' errors. var f9 = function () { return ""; }; diff --git a/tests/baselines/reference/noImplicitAnyParametersInClass.js b/tests/baselines/reference/noImplicitAnyParametersInClass.js index 089680781b5..0873935b600 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInClass.js +++ b/tests/baselines/reference/noImplicitAnyParametersInClass.js @@ -155,9 +155,19 @@ var C = (function () { // Implicit-'any' errors for x, and z. C.prototype.pub_f5 = function (x, y, z) { }; // Implicit-'any[]' errors for r. - C.prototype.pub_f6 = function () { }; + C.prototype.pub_f6 = function () { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } + }; // Implicit-'any'/'any[]' errors for x, r. - C.prototype.pub_f7 = function (x) { }; + C.prototype.pub_f7 = function (x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } + }; C.prototype.pub_f8 = function (x3, y3) { }; /////////////////////////////////////////// // No implicit-'any' errors. @@ -171,9 +181,19 @@ var C = (function () { // Implicit-'any' errors for x, and z. C.prototype.priv_f5 = function (x, y, z) { }; // Implicit-'any[]' errors for r. - C.prototype.priv_f6 = function () { }; + C.prototype.priv_f6 = function () { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } + }; // Implicit-'any'/'any[]' errors for x, r. - C.prototype.priv_f7 = function (x) { }; + C.prototype.priv_f7 = function (x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } + }; C.prototype.priv_f8 = function (x3, y3) { }; return C; })(); diff --git a/tests/baselines/reference/noImplicitAnyParametersInModule.js b/tests/baselines/reference/noImplicitAnyParametersInModule.js index 7c31ccb8013..e7f30205559 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInModule.js +++ b/tests/baselines/reference/noImplicitAnyParametersInModule.js @@ -60,9 +60,19 @@ var M; // Implicit-'any' errors for x and z. function m_f5(x, y, z) { } // Implicit-'any[]' error for r. - function m_f6() { } + function m_f6() { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } + } // Implicit-'any'/'any[]' errors for x and r. - function m_f7(x) { } + function m_f7(x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } + } function m_f8(x3, y3) { } // No implicit-'any' errors. var m_f9 = function () { return ""; }; diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads1.js b/tests/baselines/reference/optionalBindingParametersInOverloads1.js index af83404c2c8..3658efa72c6 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads1.js +++ b/tests/baselines/reference/optionalBindingParametersInOverloads1.js @@ -11,6 +11,10 @@ foo([false, 0, ""]); //// [optionalBindingParametersInOverloads1.js] function foo() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } } foo(["", 0, false]); foo([false, 0, ""]); diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads2.js b/tests/baselines/reference/optionalBindingParametersInOverloads2.js index f32fb1bfbf4..1ddfdae4f07 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads2.js +++ b/tests/baselines/reference/optionalBindingParametersInOverloads2.js @@ -11,6 +11,10 @@ foo({ x: false, y: 0, z: "" }); //// [optionalBindingParametersInOverloads2.js] function foo() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } } foo({ x: "", y: 0, z: false }); foo({ x: false, y: 0, z: "" }); diff --git a/tests/baselines/reference/out-flag.js.map b/tests/baselines/reference/out-flag.js.map index 795d564b2c0..9247af9d5d4 100644 --- a/tests/baselines/reference/out-flag.js.map +++ b/tests/baselines/reference/out-flag.js.map @@ -1,2 +1,2 @@ //// [out-flag.js.map] -{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBA,EAAEA;IACNA,CAACA;IACLA,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file +{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag.sourcemap.txt b/tests/baselines/reference/out-flag.sourcemap.txt index b54f7f8d0a1..c0289140552 100644 --- a/tests/baselines/reference/out-flag.sourcemap.txt +++ b/tests/baselines/reference/out-flag.sourcemap.txt @@ -150,8 +150,8 @@ sourceFile:out-flag.ts > { > 2 > // -1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass) -2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass) +1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass.SetCount) +2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass.SetCount) --- >>> }; 1 >^^^^ @@ -160,8 +160,8 @@ sourceFile:out-flag.ts 1 > > 2 > } -1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass) -2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass) +1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass.SetCount) +2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass.SetCount) --- >>> return MyClass; 1->^^^^ diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration18.js b/tests/baselines/reference/parserMemberAccessorDeclaration18.js index ee47bd6edd9..9483a1f2daf 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration18.js +++ b/tests/baselines/reference/parserMemberAccessorDeclaration18.js @@ -8,7 +8,12 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "Foo", { - set: function () { }, + set: function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } + }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/parserParameterList9.js b/tests/baselines/reference/parserParameterList9.js index 4eff1ad8f73..965b92a7ef6 100644 --- a/tests/baselines/reference/parserParameterList9.js +++ b/tests/baselines/reference/parserParameterList9.js @@ -7,6 +7,11 @@ class C { var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var bar = []; + for (var _i = 0; _i < arguments.length; _i++) { + bar[_i - 0] = arguments[_i]; + } + }; return C; })(); diff --git a/tests/baselines/reference/properties.js.map b/tests/baselines/reference/properties.js.map index e59b82653b6..d47694825ec 100644 --- a/tests/baselines/reference/properties.js.map +++ b/tests/baselines/reference/properties.js.map @@ -1,2 +1,2 @@ //// [properties.js.map] -{"version":3,"file":"properties.js","sourceRoot":"","sources":["properties.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AACA,IAAM,OAAO;IAAbA,SAAMA,OAAOA;IAWbC,CAACA;IATGD,sBAAWA,0BAAKA;aAAhBA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;aAEDF,UAAiBA,KAAaA;YAE1BA,EAAEA;QACNA,CAACA;;;OALAA;IAMLA,cAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file +{"version":3,"file":"properties.js","sourceRoot":"","sources":["properties.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AACA,IAAM,OAAO;IAAbA,SAAMA,OAAOA;IAWbC,CAACA;IATGD,sBAAWA,0BAAKA;aAAhBA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;aAEDF,UAAiBA,KAAaA;YAE1BE,EAAEA;QACNA,CAACA;;;OALAF;IAMLA,cAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/properties.sourcemap.txt b/tests/baselines/reference/properties.sourcemap.txt index ac124f60230..7ef028e33c0 100644 --- a/tests/baselines/reference/properties.sourcemap.txt +++ b/tests/baselines/reference/properties.sourcemap.txt @@ -118,8 +118,8 @@ sourceFile:properties.ts > { > 2 > // -1 >Emitted(9, 13) Source(11, 9) + SourceIndex(0) name (MyClass) -2 >Emitted(9, 15) Source(11, 11) + SourceIndex(0) name (MyClass) +1 >Emitted(9, 13) Source(11, 9) + SourceIndex(0) name (MyClass.Count) +2 >Emitted(9, 15) Source(11, 11) + SourceIndex(0) name (MyClass.Count) --- >>> }, 1 >^^^^^^^^ @@ -128,8 +128,8 @@ sourceFile:properties.ts 1 > > 2 > } -1 >Emitted(10, 9) Source(12, 5) + SourceIndex(0) name (MyClass) -2 >Emitted(10, 10) Source(12, 6) + SourceIndex(0) name (MyClass) +1 >Emitted(10, 9) Source(12, 5) + SourceIndex(0) name (MyClass.Count) +2 >Emitted(10, 10) Source(12, 6) + SourceIndex(0) name (MyClass.Count) --- >>> enumerable: true, >>> configurable: true diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index 0faf03690d3..a2c623e2cf5 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,QAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA,cAAiBE,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD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KA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,QAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA,cAAiBE,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,C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ACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index be632f2f517..8e4f3be36ff 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -975,8 +975,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/restArgMissingName.js b/tests/baselines/reference/restArgMissingName.js index bbd3641478e..b87800c7dac 100644 --- a/tests/baselines/reference/restArgMissingName.js +++ b/tests/baselines/reference/restArgMissingName.js @@ -3,4 +3,9 @@ function sum (...) {} //// [restArgMissingName.js] -function sum() { } +function sum() { + var = []; + for (var _i = 0; _i < arguments.length; _i++) { + [_i - 0] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/restParamAsOptional.js b/tests/baselines/reference/restParamAsOptional.js index 8b0a1329680..59aea1cc9c4 100644 --- a/tests/baselines/reference/restParamAsOptional.js +++ b/tests/baselines/reference/restParamAsOptional.js @@ -3,7 +3,12 @@ function f(...x?) { } function f2(...x = []) { } //// [restParamAsOptional.js] -function f() { } +function f() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} function f2() { if (x === void 0) { x = []; } var x = []; diff --git a/tests/baselines/reference/restParameterAssignmentCompatibility.js b/tests/baselines/reference/restParameterAssignmentCompatibility.js index cdfc257db41..62c0204c749 100644 --- a/tests/baselines/reference/restParameterAssignmentCompatibility.js +++ b/tests/baselines/reference/restParameterAssignmentCompatibility.js @@ -31,6 +31,10 @@ var T = (function () { function T() { } T.prototype.m = function () { + var p3 = []; + for (var _i = 0; _i < arguments.length; _i++) { + p3[_i - 0] = arguments[_i]; + } }; return T; })(); diff --git a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js index 30547f3f637..c800c628c9c 100644 --- a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js +++ b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js @@ -28,18 +28,53 @@ var b = { //// [restParameterWithoutAnnotationIsAnyArray.js] // Rest parameters without type annotations are 'any', errors only for the functions with 2 rest params -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParameters.js b/tests/baselines/reference/restParameters.js index f71401d2f18..2e5b7bb4c92 100644 --- a/tests/baselines/reference/restParameters.js +++ b/tests/baselines/reference/restParameters.js @@ -8,7 +8,27 @@ function f20(a:string, b?:string, ...c:number[]){} function f21(a:string, b?:string, c?:number, ...d:number[]){} //// [restParameters.js] -function f18(a) { } -function f19(a, b) { } -function f20(a, b) { } -function f21(a, b, c) { } +function f18(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} +function f19(a, b) { + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } +} +function f20(a, b) { + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } +} +function f21(a, b, c) { + var d = []; + for (var _i = 3; _i < arguments.length; _i++) { + d[_i - 3] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes.js b/tests/baselines/reference/restParametersOfNonArrayTypes.js index b1b2d7d2fb2..f6f6a8af44d 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes.js +++ b/tests/baselines/reference/restParametersOfNonArrayTypes.js @@ -27,18 +27,53 @@ var b = { //// [restParametersOfNonArrayTypes.js] // Rest parameters must be an array type if they have a type annotation, so all these are errors -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes2.js b/tests/baselines/reference/restParametersOfNonArrayTypes2.js index c6ad1f2ce25..73d0ddaeef2 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes2.js +++ b/tests/baselines/reference/restParametersOfNonArrayTypes2.js @@ -59,33 +59,103 @@ var b2 = { //// [restParametersOfNonArrayTypes2.js] // Rest parameters must be an array type if they have a type annotation, // user defined subtypes of array do not count, all of these are errors -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } +}; +function foo2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f3 = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f4 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } }; -function foo2() { } -var f3 = function foo() { }; -var f4 = function (x) { }; var C2 = (function () { function C2() { } - C2.prototype.foo = function () { }; + C2.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C2; })(); var a2; var b2 = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js index a199edea2c6..c7d1dee9295 100644 --- a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js +++ b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js @@ -54,33 +54,103 @@ var b2 = { //// [restParametersWithArrayTypeAnnotations.js] // Rest parameters must be an array type if they have a type annotation, errors only for the functions with 2 rest params -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } +}; +function foo2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f3 = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f4 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } }; -function foo2() { } -var f3 = function foo() { }; -var f4 = function (x) { }; var C2 = (function () { function C2() { } - C2.prototype.foo = function () { }; + C2.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C2; })(); var a2; var b2 = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParamsWithNonRestParams.js b/tests/baselines/reference/restParamsWithNonRestParams.js index b58870f1346..6b0caa72394 100644 --- a/tests/baselines/reference/restParamsWithNonRestParams.js +++ b/tests/baselines/reference/restParamsWithNonRestParams.js @@ -7,9 +7,24 @@ function foo3(a?:string, ...b:number[]){} foo3(); // error but shouldn't be //// [restParamsWithNonRestParams.js] -function foo() { } +function foo() { + var b = []; + for (var _i = 0; _i < arguments.length; _i++) { + b[_i - 0] = arguments[_i]; + } +} foo(); // ok -function foo2(a) { } +function foo2(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo2(); // should be an error -function foo3(a) { } +function foo3(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo3(); // error but shouldn't be diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index 914d81cee83..28d4566efc7 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBA,CAACA;IADeA,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index 74975cdc583..c0e46430688 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -450,8 +450,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 >() { > 2 > } -1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes) +1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) +2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) --- >>> Shapes.foo = foo; 1->^^^^ diff --git a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map index 4f11f33d322..81066a66bad 100644 --- a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map +++ b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationFunctionPropertyAssignment.js.map] -{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,gBAAK,CAAC,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":["n"],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,gBAAKA,CAACA,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt index a1a44c4ffb4..52a8bfe688c 100644 --- a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt @@ -36,8 +36,8 @@ sourceFile:sourceMapValidationFunctionPropertyAssignment.ts 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) 5 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) 6 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 17) + SourceIndex(0) -8 >Emitted(1, 29) Source(1, 18) + SourceIndex(0) +7 >Emitted(1, 28) Source(1, 17) + SourceIndex(0) name (n) +8 >Emitted(1, 29) Source(1, 18) + SourceIndex(0) name (n) 9 >Emitted(1, 31) Source(1, 20) + SourceIndex(0) 10>Emitted(1, 32) Source(1, 21) + SourceIndex(0) --- diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index 1f5d65390a7..a4dd1619642 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -8,5 +8,9 @@ foo `${function (x: number) { x = "bad"; } }`; //// [taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js] function foo() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } } foo "" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/typeResolution.js.map b/tests/baselines/reference/typeResolution.js.map index a7bdf6606c9..6173573d306 100644 --- a/tests/baselines/reference/typeResolution.js.map +++ b/tests/baselines/reference/typeResolution.js.map @@ -1,2 +1,2 @@ //// [typeResolution.js.map] -{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA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oBAAlBD,2BAAUA,GAAjBA,cAAsBA,CAACA;oBAACA,aAACA;gBAADA,CAACA,AAA/CL,IAA+CA;gBAAlCA,oBAAMA,GAANA,MAAkCA,CAAAA;gBAEZA,JACvCA,CAACA,EAPaD,aAAaA,GAAbA,wBAAaA,KAAbA,wBAAaA,QAO1BA;YAE0CA,JAC/CA,CAACA,EAXaf,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAWvBA;QAEDA,IAAMA,MAAMA;YAAZuB,SAAMA,MAAMA;YAEZC,CAACA;YADUD,uBAAMA,GAAbA,cAAkBA,CAACA;YACvBA,aAACA;QAADA,CAACA,AAFDvB,IAECA;QAMDA,IAAOA,iBAAiBA,CAEvBA;QAFDA,WAAOA,iBAAiBA,EAACA,CAACA;YACtByB,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAAGC,CAACA;gBAADD,aAACA;YAADA,CAACA,AAAvBD,IAAuBA;YAAVA,wBAAMA,GAANA,MAAUA,CAAAA;QAC3BA,CAACA,EAFMzB,iBAAiBA,KAAjBA,iBAAiBA,QAEvBA;IACLA,CAACA,EAnGa,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAmG5B;IAED,IAAO,eAAe,CAMrB;IAND,WAAO,eAAe,EAAC,CAAC;QACpB4B,IAAcA,UAAUA,CAIvBA;QAJDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAEnBC,CAACA;gBADUD,yBAAQA,GAAfA,cAAoBA,CAACA;gBACzBA,aAACA;YAADA,CAACA,AAFDD,IAECA;YAFYA,iBAAMA,GAANA,MAEZA,CAAAA;QACLA,CAACA,EAJaD,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAIvBA;IACLA,CAACA,EANM,eAAe,KAAf,eAAe,QAMrB"} \ No newline at end of file +{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.ClassA.AisIn1","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor","TopLevelModule2.SubModule3.ClassA.AisIn2_3"],"mappings":";IAAA,IAAc,eAAe,CAmG5B;IAnGD,WAAc,eAAe,EAAC,CAAC;QAC3BA,IAAcA,UAAUA,CAw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AMA,GAANA,MAAkCA,CAAAA;gBAEZA,JACvCA,CAACA,EAPaD,aAAaA,GAAbA,wBAAaA,KAAbA,wBAAaA,QAO1BA;YAE0CA,JAC/CA,CAACA,EAXaf,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAWvBA;QAEDA,IAAMA,MAAMA;YAAZ0B,SAAMA,MAAMA;YAEZC,CAACA;YADUD,uBAAMA,GAAbA,cAAkBE,CAACA;YACvBF,aAACA;QAADA,CAACA,AAFD1B,IAECA;QAMDA,IAAOA,iBAAiBA,CAEvBA;QAFDA,WAAOA,iBAAiBA,EAACA,CAACA;YACtB6B,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAAGC,CAACA;gBAADD,aAACA;YAADA,CAACA,AAAvBD,IAAuBA;YAAVA,wBAAMA,GAANA,MAAUA,CAAAA;QAC3BA,CAACA,EAFM7B,iBAAiBA,KAAjBA,iBAAiBA,QAEvBA;IACLA,CAACA,EAnGa,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAmG5B;IAED,IAAO,eAAe,CAMrB;IAND,WAAO,eAAe,EAAC,CAAC;QACpBgC,IAAcA,UAAUA,CAIvBA;QAJDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAEnBC,CAACA;gBADUD,yBAAQA,GAAfA,cAAoBE,CAACA;gBACzBF,aAACA;YAADA,CAACA,AAFDD,IAECA;YAFYA,iBAAMA,GAANA,MAEZA,CAAAA;QACLA,CAACA,EAJaD,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAIvBA;IACLA,CAACA,EANM,eAAe,KAAf,eAAe,QAMrB"} \ No newline at end of file diff --git a/tests/baselines/reference/typeResolution.sourcemap.txt b/tests/baselines/reference/typeResolution.sourcemap.txt index d233e267f9f..af7aa7cca93 100644 --- a/tests/baselines/reference/typeResolution.sourcemap.txt +++ b/tests/baselines/reference/typeResolution.sourcemap.txt @@ -2276,8 +2276,8 @@ sourceFile:typeResolution.ts 1->Emitted(114, 21) Source(79, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) 2 >Emitted(114, 48) Source(79, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) 3 >Emitted(114, 51) Source(79, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) -4 >Emitted(114, 65) Source(79, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) -5 >Emitted(114, 66) Source(79, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) +4 >Emitted(114, 65) Source(79, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2) +5 >Emitted(114, 66) Source(79, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2) --- >>> return ClassA; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2366,8 +2366,8 @@ sourceFile:typeResolution.ts 1->Emitted(121, 21) Source(80, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) 2 >Emitted(121, 48) Source(80, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) 3 >Emitted(121, 51) Source(80, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) -4 >Emitted(121, 65) Source(80, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) -5 >Emitted(121, 66) Source(80, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) +4 >Emitted(121, 65) Source(80, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2) +5 >Emitted(121, 66) Source(80, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2) --- >>> return ClassB; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2456,8 +2456,8 @@ sourceFile:typeResolution.ts 1->Emitted(128, 21) Source(81, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) 2 >Emitted(128, 48) Source(81, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) 3 >Emitted(128, 51) Source(81, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) -4 >Emitted(128, 65) Source(81, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) -5 >Emitted(128, 66) Source(81, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) +4 >Emitted(128, 65) Source(81, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2) +5 >Emitted(128, 66) Source(81, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2) --- >>> return ClassC; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2638,8 +2638,8 @@ sourceFile:typeResolution.ts 1->Emitted(137, 13) Source(90, 16) + SourceIndex(0) name (TopLevelModule1.ClassA) 2 >Emitted(137, 36) Source(90, 22) + SourceIndex(0) name (TopLevelModule1.ClassA) 3 >Emitted(137, 39) Source(90, 9) + SourceIndex(0) name (TopLevelModule1.ClassA) -4 >Emitted(137, 53) Source(90, 27) + SourceIndex(0) name (TopLevelModule1.ClassA) -5 >Emitted(137, 54) Source(90, 28) + SourceIndex(0) name (TopLevelModule1.ClassA) +4 >Emitted(137, 53) Source(90, 27) + SourceIndex(0) name (TopLevelModule1.ClassA.AisIn1) +5 >Emitted(137, 54) Source(90, 28) + SourceIndex(0) name (TopLevelModule1.ClassA.AisIn1) --- >>> return ClassA; 1 >^^^^^^^^^^^^ @@ -3065,8 +3065,8 @@ sourceFile:typeResolution.ts 1->Emitted(157, 17) Source(105, 20) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) 2 >Emitted(157, 42) Source(105, 28) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) 3 >Emitted(157, 45) Source(105, 13) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) -4 >Emitted(157, 59) Source(105, 33) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) -5 >Emitted(157, 60) Source(105, 34) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) +4 >Emitted(157, 59) Source(105, 33) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA.AisIn2_3) +5 >Emitted(157, 60) Source(105, 34) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA.AisIn2_3) --- >>> return ClassA; 1 >^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/undeclaredModuleError.js b/tests/baselines/reference/undeclaredModuleError.js index 4b93db57682..0764840cadf 100644 --- a/tests/baselines/reference/undeclaredModuleError.js +++ b/tests/baselines/reference/undeclaredModuleError.js @@ -18,7 +18,12 @@ function instrumentFile(covFileDir: string, covFileName: string, originalFilePat //// [undeclaredModuleError.js] define(["require", "exports", 'fs'], function (require, exports, fs) { function readdir(path, accept, callback) { } - function join() { } + function join() { + var paths = []; + for (var _i = 0; _i < arguments.length; _i++) { + paths[_i - 0] = arguments[_i]; + } + } function instrumentFile(covFileDir, covFileName, originalFilePath) { fs.readFile(originalFilePath, function () { readdir(covFileDir, function () { diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index bbecbac4059..a4fa2cbc65d 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -977,7 +977,12 @@ $('#underscore_button').bind('click', buttonView.onClick); var fibonacci = _.memoize(function (n) { return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); }); -var log = _.bind(function (message) { }, Date); +var log = _.bind(function (message) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +}, Date); _.delay(log, 1000, 'logged later'); _.defer(function () { alert('deferred'); }); var updatePosition = function () { return alert('updating position...'); }; diff --git a/tests/baselines/reference/varArgParamTypeCheck.js b/tests/baselines/reference/varArgParamTypeCheck.js index 5d8a60a564a..c2a33416436 100644 --- a/tests/baselines/reference/varArgParamTypeCheck.js +++ b/tests/baselines/reference/varArgParamTypeCheck.js @@ -23,6 +23,10 @@ sequence( //// [varArgParamTypeCheck.js] function sequence() { + var sequences = []; + for (var _i = 0; _i < arguments.length; _i++) { + sequences[_i - 0] = arguments[_i]; + } } function callback(clb) { } diff --git a/tests/baselines/reference/varArgWithNoParamName.js b/tests/baselines/reference/varArgWithNoParamName.js index b61400ff739..05a9695770a 100644 --- a/tests/baselines/reference/varArgWithNoParamName.js +++ b/tests/baselines/reference/varArgWithNoParamName.js @@ -2,4 +2,9 @@ function t1(...) {} //// [varArgWithNoParamName.js] -function t1() { } +function t1() { + var = []; + for (var _i = 0; _i < arguments.length; _i++) { + [_i - 0] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/vararg.js b/tests/baselines/reference/vararg.js index c0260cd8d86..038afb90cbc 100644 --- a/tests/baselines/reference/vararg.js +++ b/tests/baselines/reference/vararg.js @@ -57,6 +57,10 @@ var M; return result; }; C.prototype.fnope = function (x) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } }; C.prototype.fonly = function () { var rest = []; From 5f9b49fa4c1d66d3fbb6634121f0626892815b0f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 13:39:57 -0800 Subject: [PATCH 12/20] Avoid allocation during binary expression emit when unnecessary. --- src/compiler/emitter.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f9624399038..d5c47356d3b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3109,13 +3109,12 @@ module ts { // // So we only indent if the right side of the binary expression starts further in on the line // versus the left. - var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); - var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); // Check if the right expression is on a different line versus the operator itself. If so, // we'll emit newline. - var onDifferentLine = operatorEnd.line !== rightStart.line; - if (onDifferentLine) { + if (!nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right)) { + var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + // Also, if the right expression starts further in on the line than the left, then we'll indent. var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); From 8e292a19f7d451c6b03ab636434d7f70831b76e8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 13:39:57 -0800 Subject: [PATCH 13/20] Avoid allocation during binary expression emit when unnecessary. --- src/compiler/emitter.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3247b5ff1d1..30d863ab90d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3109,13 +3109,12 @@ module ts { // // So we only indent if the right side of the binary expression starts further in on the line // versus the left. - var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); - var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); // Check if the right expression is on a different line versus the operator itself. If so, // we'll emit newline. - var onDifferentLine = operatorEnd.line !== rightStart.line; - if (onDifferentLine) { + if (!nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right)) { + var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + // Also, if the right expression starts further in on the line than the left, then we'll indent. var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); From 9c867e32805fba77e723e424d6a25d20f6674284 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 13:39:57 -0800 Subject: [PATCH 14/20] Avoid allocation during binary expression emit when unnecessary. --- src/compiler/emitter.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3247b5ff1d1..30d863ab90d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3109,13 +3109,12 @@ module ts { // // So we only indent if the right side of the binary expression starts further in on the line // versus the left. - var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); - var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); // Check if the right expression is on a different line versus the operator itself. If so, // we'll emit newline. - var onDifferentLine = operatorEnd.line !== rightStart.line; - if (onDifferentLine) { + if (!nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right)) { + var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + // Also, if the right expression starts further in on the line than the left, then we'll indent. var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); From 09c0c179373397510807456e9734cfcd1c33460a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 13:59:16 -0800 Subject: [PATCH 15/20] Avoid unnecessary allocations in binary expression emit. --- src/compiler/emitter.ts | 45 ++---------- .../baselines/reference/ES5SymbolProperty1.js | 4 +- .../reference/FunctionDeclaration8_es6.js | 4 +- .../reference/FunctionDeclaration9_es6.js | 4 +- .../FunctionPropertyAssignments5_es6.js | 2 +- tests/baselines/reference/asiArith.js | 4 +- .../reference/computedPropertyNames10_ES5.js | 2 +- .../reference/computedPropertyNames11_ES5.js | 2 +- .../reference/computedPropertyNames18_ES5.js | 4 +- .../reference/computedPropertyNames19_ES5.js | 4 +- .../reference/computedPropertyNames1_ES5.js | 2 +- .../reference/computedPropertyNames20_ES5.js | 4 +- .../reference/computedPropertyNames22_ES5.js | 2 +- .../reference/computedPropertyNames23_ES5.js | 4 +- .../reference/computedPropertyNames25_ES5.js | 2 +- .../reference/computedPropertyNames26_ES5.js | 4 +- .../reference/computedPropertyNames28_ES5.js | 2 +- .../reference/computedPropertyNames29_ES5.js | 2 +- .../reference/computedPropertyNames30_ES5.js | 2 +- .../reference/computedPropertyNames31_ES5.js | 2 +- .../reference/computedPropertyNames33_ES5.js | 2 +- .../reference/computedPropertyNames34_ES5.js | 2 +- .../reference/computedPropertyNames46_ES5.js | 4 +- .../reference/computedPropertyNames47_ES5.js | 4 +- .../reference/computedPropertyNames48_ES5.js | 12 ++-- .../reference/computedPropertyNames49_ES5.js | 6 +- .../reference/computedPropertyNames4_ES5.js | 24 +++---- .../reference/computedPropertyNames50_ES5.js | 6 +- .../reference/computedPropertyNames5_ES5.js | 14 ++-- .../reference/computedPropertyNames6_ES5.js | 8 +-- .../reference/computedPropertyNames7_ES5.js | 4 +- .../reference/computedPropertyNames8_ES5.js | 6 +- .../reference/computedPropertyNames9_ES5.js | 8 +-- ...mputedPropertyNamesContextualType10_ES5.js | 6 +- ...omputedPropertyNamesContextualType1_ES5.js | 4 +- ...omputedPropertyNamesContextualType2_ES5.js | 4 +- ...omputedPropertyNamesContextualType3_ES5.js | 4 +- ...omputedPropertyNamesContextualType4_ES5.js | 6 +- ...omputedPropertyNamesContextualType5_ES5.js | 6 +- ...omputedPropertyNamesContextualType6_ES5.js | 12 ++-- ...omputedPropertyNamesContextualType7_ES5.js | 12 ++-- ...omputedPropertyNamesContextualType8_ES5.js | 6 +- ...omputedPropertyNamesContextualType9_ES5.js | 6 +- ...mputedPropertyNamesDeclarationEmit5_ES5.js | 4 +- .../computedPropertyNamesSourceMap2_ES5.js | 2 +- ...computedPropertyNamesSourceMap2_ES5.js.map | 2 +- ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 69 +++++++++---------- ...constructorWithIncompleteTypeAnnotation.js | 4 +- .../reference/duplicateLocalVariable1.js | 2 +- .../parserES5ComputedPropertyName2.js | 4 +- .../parserES5ComputedPropertyName3.js | 2 +- .../parserES5ComputedPropertyName4.js | 2 +- .../parserGreaterThanTokenAmbiguity10.js | 2 +- .../parserGreaterThanTokenAmbiguity15.js | 2 +- .../parserGreaterThanTokenAmbiguity20.js | 2 +- .../parserGreaterThanTokenAmbiguity5.js | 2 +- .../baselines/reference/parserRealSource14.js | 4 +- tests/baselines/reference/privateIndexer2.js | 4 +- .../templateStringInEqualityChecks.js | 4 +- .../templateStringInEqualityChecksES6.js | 4 +- .../thisInPropertyBoundDeclarations.js | 8 +-- .../typeGuardsInConditionalExpression.js | 4 +- 62 files changed, 178 insertions(+), 216 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 30d863ab90d..eb333fc5ca0 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3088,52 +3088,15 @@ module ts { write(tokenToString(node.operatorToken.kind)); - // We'd like to preserve newlines found in the original binary expression. i.e. if a user has: - // - // Foo() || - // Bar(); - // - // Then we'd like to emit it as such. It seems like we'd only need to check for a newline and - // then just indent and emit. However, that will lead to a problem with deeply nested code. - // i.e. if you have: - // - // Foo() || - // Bar() || - // Baz(); - // - // Then we don't want to emit it as: - // - // Foo() || - // Bar() || - // Baz(); - // - // So we only indent if the right side of the binary expression starts further in on the line - // versus the left. - - // Check if the right expression is on a different line versus the operator itself. If so, - // we'll emit newline. if (!nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right)) { - var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); - - // Also, if the right expression starts further in on the line than the left, then we'll indent. - var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); - var shouldIndent = rightStart.character > firstCharOfExpr; - - if (shouldIndent) { - increaseIndent(); - } - + increaseIndent(); writeLine(); + emit(node.right); + decreaseIndent(); } else { write(" "); - } - - emit(node.right); - - if (shouldIndent) { - decreaseIndent(); + emit(node.right); } } } diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index e977df7dc6b..7d29658e286 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.js +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -13,7 +13,7 @@ obj[Symbol.foo]; //// [ES5SymbolProperty1.js] var Symbol; var obj = (_a = {}, _a[Symbol.foo] = -0, -_a); + 0, + _a); obj[Symbol.foo]; var _a; diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 3f6d2499cef..acb336b6418 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -3,6 +3,6 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] var v = (_a = {}, _a[yield] = -foo, -_a); + foo, + _a); var _a; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index 04c946a96eb..9ecc0eb6d65 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -6,7 +6,7 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function foo() { var v = (_a = {}, _a[] = - foo, - _a); + foo, + _a); var _a; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index 0b786632bdf..6a20d4aff03 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -3,5 +3,5 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] var v = (_a = {}, _a[foo()] = function () { }, -_a); + _a); var _a; diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index ac739bbd767..8e957aae332 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -38,8 +38,8 @@ y var x = 1; var y = 1; var z = x + -+ +y; + + +y; var a = 1; var b = 1; var c = x - -- -y; + - -y; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index ececb28b8cc..00b43fb551d 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -21,5 +21,5 @@ var s; var n; var a; var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, -_a); + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index d8450deb765..db3b12cbf32 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -21,5 +21,5 @@ var s; var n; var a; var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), -_a); + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index 0ccc0fb4e00..47950473370 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -8,7 +8,7 @@ function foo() { //// [computedPropertyNames18_ES5.js] function foo() { var obj = (_a = {}, _a[this.bar] = - 0, - _a); + 0, + _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index a18cb7b95c3..fcc46aeff2f 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -9,7 +9,7 @@ module M { var M; (function (M) { var obj = (_a = {}, _a[this.bar] = - 0, - _a); + 0, + _a); var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index 36a7fd6052d..115daa53ace 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -6,5 +6,5 @@ var v = { //// [computedPropertyNames1_ES5.js] var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), -_a); + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index 21af64d7e41..06a08c6b730 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -5,6 +5,6 @@ var obj = { //// [computedPropertyNames20_ES5.js] var obj = (_a = {}, _a[this.bar] = -0, -_a); + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index e3e685aa54b..12ec32d7e93 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -14,7 +14,7 @@ var C = (function () { } C.prototype.bar = function () { var obj = (_a = {}, _a[this.bar()] = function () { }, - _a); + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js index 7b5a5a101a5..f0eebd119e8 100644 --- a/tests/baselines/reference/computedPropertyNames23_ES5.js +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -16,8 +16,8 @@ var C = (function () { return 0; }; C.prototype[(_a = {}, _a[this.bar()] = - 1, - _a)[0]] = function () { }; + 1, + _a)[0]] = function () { }; return C; })(); var _a; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index bd2212b72b3..07673dded76 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -35,7 +35,7 @@ var C = (function (_super) { } C.prototype.foo = function () { var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, - _a); + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 5df2f6dc1b6..50a14294c53 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -35,8 +35,8 @@ var C = (function (_super) { // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. C.prototype[(_a = {}, _a[super.bar.call(this)] = - 1, - _a)[0]] = function () { }; + 1, + _a)[0]] = function () { }; return C; })(Base); var _a; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 7e548d4d6d3..0ee4c6fcb39 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -27,7 +27,7 @@ var C = (function (_super) { function C() { _super.call(this); var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, - _a); + _a); var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 27c7cd97988..6c571ffc48d 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -18,7 +18,7 @@ var C = (function () { var _this = this; (function () { var obj = (_a = {}, _a[_this.bar()] = function () { }, - _a); + _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 505b149f62d..be54ac9f390 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -33,7 +33,7 @@ var C = (function (_super) { _super.call(this); (function () { var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, - _a); + _a); var _a; }); } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 0c8cbac455f..c195af3eb5a 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -39,7 +39,7 @@ var C = (function (_super) { var _this = this; (function () { var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, - _a); + _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 84df68fcc10..805531eb6b3 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -16,7 +16,7 @@ var C = (function () { } C.prototype.bar = function () { var obj = (_a = {}, _a[foo()] = function () { }, - _a); + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index 9e1de33be7c..8e5fbe96f67 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -16,7 +16,7 @@ var C = (function () { } C.bar = function () { var obj = (_a = {}, _a[foo()] = function () { }, - _a); + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 3e4329b8a20..0cd5bd9beab 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -5,6 +5,6 @@ var o = { //// [computedPropertyNames46_ES5.js] var o = (_a = {}, _a["" || 0] = -0, -_a); + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index 7874a25976f..2ec3fa5d668 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -15,6 +15,6 @@ var E2; E2[E2["x"] = 0] = "x"; })(E2 || (E2 = {})); var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = -0, -_a); + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index f3f9941aeae..4a397507680 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -24,12 +24,12 @@ var E; })(E || (E = {})); var a; extractIndexer((_a = {}, _a[a] = -"", -_a)); // Should return string + "", + _a)); // Should return string extractIndexer((_b = {}, _b[0 /* x */] = -"", -_b)); // Should return string + "", + _b)); // Should return string extractIndexer((_c = {}, _c["" || 0] = -"", -_c)); // Should return any (widened form of undefined) + "", + _c)); // Should return any (widened form of undefined) var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index a64d9431a9a..79c09624f4f 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -29,7 +29,7 @@ var x = { var x = (_a = { p1: 10 }, _a.p1 = -10, _a[1 + 1] = Object.defineProperty({ get: function () { + 10, _a[1 + 1] = Object.defineProperty({ get: function () { throw 10; }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { return 10; @@ -41,6 +41,6 @@ var x = (_a = { return 10; } }, enumerable: true, configurable: true }), _a.p2 = -20, -_a); + 20, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index 255b14eb970..22e23f14905 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -21,16 +21,16 @@ var s; var n; var a; var v = (_a = {}, _a[s] = -0, _a[n] = -n, _a[s + s] = -1, _a[s + n] = -2, _a[+s] = -s, _a[""] = -0, _a[0] = -0, _a[a] = -1, _a[true] = -0, _a["hello bye"] = -0, _a["hello " + a + " bye"] = -0, -_a); + 0, _a[n] = + n, _a[s + s] = + 1, _a[s + n] = + 2, _a[+s] = + s, _a[""] = + 0, _a[0] = + 0, _a[a] = + 1, _a[true] = + 0, _a["hello bye"] = + 0, _a["hello " + a + " bye"] = + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index a0703eeac05..36ca71707cc 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -34,7 +34,7 @@ var x = (_a = { } } }, _a.p1 = -10, _a.foo = Object.defineProperty({ get: function () { + 10, _a.foo = Object.defineProperty({ get: function () { if (1 == 1) { return 10; } @@ -46,6 +46,6 @@ var x = (_a = { }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { return 10; }, enumerable: true, configurable: true }), _a.p2 = -20, -_a); + 20, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index 722c0f3a74d..e99c4ed73b7 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -12,11 +12,11 @@ var v = { //// [computedPropertyNames5_ES5.js] var b; var v = (_a = {}, _a[b] = -0, _a[true] = -1, _a[[]] = -0, _a[{}] = -0, _a[undefined] = -undefined, _a[null] = -null, -_a); + 0, _a[true] = + 1, _a[[]] = + 0, _a[{}] = + 0, _a[undefined] = + undefined, _a[null] = + null, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index 4e3ed1b2e9f..a4b9f2131e2 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -13,8 +13,8 @@ var p1; var p2; var p3; var v = (_a = {}, _a[p1] = -0, _a[p2] = -1, _a[p3] = -2, -_a); + 0, _a[p2] = + 1, _a[p3] = + 2, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 3e1bcc1151c..bd19f0cc5e4 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -12,6 +12,6 @@ var E; E[E["member"] = 0] = "member"; })(E || (E = {})); var v = (_a = {}, _a[0 /* member */] = -0, -_a); + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 4db9ed2ec13..9035777bcba 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -13,8 +13,8 @@ function f() { var t; var u; var v = (_a = {}, _a[t] = - 0, _a[u] = - 1, - _a); + 0, _a[u] = + 1, + _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index a7c4a74d5ec..1c5198da767 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -13,8 +13,8 @@ var v = { //// [computedPropertyNames9_ES5.js] function f(x) { } var v = (_a = {}, _a[f("")] = -0, _a[f(0)] = -0, _a[f(true)] = -0, -_a); + 0, _a[f(0)] = + 0, _a[f(true)] = + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index 5ea05124674..c29260da041 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -10,7 +10,7 @@ var o: I = { //// [computedPropertyNamesContextualType10_ES5.js] var o = (_a = {}, _a[+"foo"] = -"", _a[+"bar"] = -0, -_a); + "", _a[+"bar"] = + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index a7994495411..60d5706e3f4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -11,6 +11,6 @@ var o: I = { //// [computedPropertyNamesContextualType1_ES5.js] var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = -function (y) { return y.length; }, -_a); + function (y) { return y.length; }, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index 0c6b80bbabb..aba28acdd24 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -11,6 +11,6 @@ var o: I = { //// [computedPropertyNamesContextualType2_ES5.js] var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = -function (y) { return y.length; }, -_a); + function (y) { return y.length; }, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 4336808c558..6752bf590dc 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -10,6 +10,6 @@ var o: I = { //// [computedPropertyNamesContextualType3_ES5.js] var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = -function (y) { return y.length; }, -_a); + function (y) { return y.length; }, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index b813da30496..6e9dbab4b53 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -11,7 +11,7 @@ var o: I = { //// [computedPropertyNamesContextualType4_ES5.js] var o = (_a = {}, _a["" + "foo"] = -"", _a["" + "bar"] = -0, -_a); + "", _a["" + "bar"] = + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index f75389de3e9..1d7d456195e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -11,7 +11,7 @@ var o: I = { //// [computedPropertyNamesContextualType5_ES5.js] var o = (_a = {}, _a[+"foo"] = -"", _a[+"bar"] = -0, -_a); + "", _a[+"bar"] = + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index bc724320d14..82229dc92e2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -18,10 +18,10 @@ foo((_a = { p: "", 0: function () { } }, _a.p = -"", _a[0] = -function () { }, _a["hi" + "bye"] = -true, _a[0 + 1] = -0, _a[+"hi"] = -[0], -_a)); + "", _a[0] = + function () { }, _a["hi" + "bye"] = + true, _a[0 + 1] = + 0, _a[+"hi"] = + [0], + _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 8d2386a1d14..ca335566d7e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -18,10 +18,10 @@ foo((_a = { p: "", 0: function () { } }, _a.p = -"", _a[0] = -function () { }, _a["hi" + "bye"] = -true, _a[0 + 1] = -0, _a[+"hi"] = -[0], -_a)); + "", _a[0] = + function () { }, _a["hi" + "bye"] = + true, _a[0 + 1] = + 0, _a[+"hi"] = + [0], + _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index 626f3d1a8e2..89ea38eaa74 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -11,7 +11,7 @@ var o: I = { //// [computedPropertyNamesContextualType8_ES5.js] var o = (_a = {}, _a["" + "foo"] = -"", _a["" + "bar"] = -0, -_a); + "", _a["" + "bar"] = + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index c28db4ded97..b4f94dcadbe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -11,7 +11,7 @@ var o: I = { //// [computedPropertyNamesContextualType9_ES5.js] var o = (_a = {}, _a[+"foo"] = -"", _a[+"bar"] = -0, -_a); + "", _a[+"bar"] = + 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index a0666f166d4..bb495c0f532 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -8,8 +8,8 @@ var v = { //// [computedPropertyNamesDeclarationEmit5_ES5.js] var v = (_a = {}, _a["" + ""] = -0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), -_a); + 0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index c5af22ef398..299c5994424 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -9,6 +9,6 @@ var v = { var v = (_a = {}, _a["hello"] = function () { debugger; }, -_a); + _a); var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 82a729df957..2ea24d441ea 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;IACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index 33a3a2b4c2c..bc6d862eb93 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -99,7 +99,7 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 1 > 2 >^ 3 > -4 > ^^^^-> +4 > ^^^^^^^^-> 1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found 1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1) 1 > @@ -114,45 +114,44 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) 3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) --- ->>>_a); -1-> -2 >^^ -3 > -4 > ^ -5 > ^ -6 > ^^^^-> -1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1) -1-> -2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) -2 > -3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -3 > -4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1) -4 > -5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1) -5 > -1->Emitted(4, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0) -3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0) -4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0) -5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0) ---- ->>>var _a; +>>> _a); 1->^^^^ 2 > ^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +3 > +4 > ^ +5 > ^ +1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) 1-> 2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) 2 > -1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1) +4 > +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1) +5 > +1->Emitted(4, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0) +3 >Emitted(4, 7) Source(0, NaN) + SourceIndex(0) +4 >Emitted(4, 8) Source(5, 2) + SourceIndex(0) +5 >Emitted(4, 9) Source(5, 2) + SourceIndex(0) +--- +>>>var _a; +1 >^^^^ +2 > ^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 5) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +1 >Emitted(5, 5) Source(1, 1) + SourceIndex(0) 2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) --- !!!! **** There are more source map entries in the sourceMap's mapping than what was encoded diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index cd31308311b..ac77cc177b8 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -315,7 +315,7 @@ var TypeScriptAllInOne; if (retValue === void 0) { retValue = != 0; } return 1; ^ - retValue; + retValue; bfs.TYPES(); if (retValue != 0) { return 1 && @@ -543,7 +543,7 @@ while () rest: string[]; { & - public; + public; DefaultValue(value ? : string = "Hello"); { } } diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index e77a38c5be8..62e291f28c0 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -431,7 +431,7 @@ exports.tests = (function () { })); testRunner.addTest(new TestCase("Check binary file doesn't match", function () { return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && - !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); + !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); })); // Command-line parameter tests testRunner.addTest(new TestCase("Check App defaults", function () { diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js index 2b39e305e07..cd5b088d0ec 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -3,6 +3,6 @@ var v = { [e]: 1 }; //// [parserES5ComputedPropertyName2.js] var v = (_a = {}, _a[e] = -1, -_a); + 1, + _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index 3247b0251f1..8bfed4e8228 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -3,5 +3,5 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] var v = (_a = {}, _a[e] = function () { }, -_a); + _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 436f967e8de..bb0b389afdf 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -3,5 +3,5 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), -_a); + _a); var _a; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js index 766c95632ab..a558407de43 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity10.js] 1 >>> -2; + 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js index 8675365d9ea..83f2cda2364 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity15.js] 1 >>= -2; + 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js index e190e94e9f9..9ac06e9644f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity20.js] 1 >>>= -2; + 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js index 59d13d5c9d3..cde18d5c63d 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity5.js] 1 >> -2; + 2; diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js index 540296e6973..8deae79f5e2 100644 --- a/tests/baselines/reference/parserRealSource14.js +++ b/tests/baselines/reference/parserRealSource14.js @@ -999,8 +999,8 @@ var TypeScript; // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || - cur.nodeType === TypeScript.NodeType.Name || - pos === script.limChar; // Special "EOF" case + cur.nodeType === TypeScript.NodeType.Name || + pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 5a36a9eae18..40b28ce9809 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -12,8 +12,8 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed var x = (_a = {}, _a[x] = -string, _a.string = + string, _a.string = , -_a); + _a); var y; var _a; diff --git a/tests/baselines/reference/templateStringInEqualityChecks.js b/tests/baselines/reference/templateStringInEqualityChecks.js index ca9fc2ed80b..f7573f8efd5 100644 --- a/tests/baselines/reference/templateStringInEqualityChecks.js +++ b/tests/baselines/reference/templateStringInEqualityChecks.js @@ -7,5 +7,5 @@ var x = `abc${0}abc` === `abc` || //// [templateStringInEqualityChecks.js] var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && - "abc" + 0 + "abc" == "abc0abc" && - "abc0abc" !== "abc" + 0 + "abc"; + "abc" + 0 + "abc" == "abc0abc" && + "abc0abc" !== "abc" + 0 + "abc"; diff --git a/tests/baselines/reference/templateStringInEqualityChecksES6.js b/tests/baselines/reference/templateStringInEqualityChecksES6.js index db00827fac5..9bb001d9dc7 100644 --- a/tests/baselines/reference/templateStringInEqualityChecksES6.js +++ b/tests/baselines/reference/templateStringInEqualityChecksES6.js @@ -7,5 +7,5 @@ var x = `abc${0}abc` === `abc` || //// [templateStringInEqualityChecksES6.js] var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && - `abc${0}abc` == "abc0abc" && - "abc0abc" !== `abc${0}abc`; + `abc${0}abc` == "abc0abc" && + "abc0abc" !== `abc${0}abc`; diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index 3f1bac98075..e5004eed431 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -117,10 +117,10 @@ var B = (function () { this.prop2 = function () { return _this; }; this.prop3 = function () { return function () { return function () { return function () { return _this; }; }; }; }; this.prop4 = ' ' + - function () { - } + - ' ' + - (function () { return function () { return function () { return _this; }; }; }); + function () { + } + + ' ' + + (function () { return function () { return function () { return _this; }; }; }); this.prop5 = { a: function () { return _this; } }; diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.js b/tests/baselines/reference/typeGuardsInConditionalExpression.js index e493df66ce6..7c87d80d592 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.js +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.js @@ -143,8 +143,8 @@ function foo7(x) { function foo8(x) { var b; return typeof x === "string" ? x === "hello" : ((b = x) && - (typeof x === "boolean" ? x // boolean - : x == 10)); // number + (typeof x === "boolean" ? x // boolean + : x == 10)); // number } function foo9(x) { var y = 10; From b9f43b95637859723ba7536df5871b5b5569cb8c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 14:16:35 -0800 Subject: [PATCH 16/20] CR feedback. --- src/compiler/emitter.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d5c47356d3b..4813e62b60e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3994,7 +3994,7 @@ module ts { write(" {"); scopeEmitStart(node); - var outPos = writer.getTextPos(); + var initialTextPos = writer.getTextPos(); increaseIndent(); emitDetachedComments(body.statements); @@ -4002,10 +4002,10 @@ module ts { emitFunctionBodyPreamble(node); decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== outPos; + var preambleEmitted = writer.getTextPos() !== initialTextPos; if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var i = startIndex, n = body.statements.length; i < n; i++) { + for (var i = 0, n = body.statements.length; i < n; i++) { write(" "); emit(body.statements[i]); } From 8bfc35030d3efbde2141c69a0ec54a32bd939793 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 14:23:51 -0800 Subject: [PATCH 17/20] CR feedback. --- src/compiler/emitter.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4813e62b60e..504a384f579 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3998,6 +3998,9 @@ module ts { increaseIndent(); emitDetachedComments(body.statements); + + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); emitFunctionBodyPreamble(node); decreaseIndent(); From a020a43216a085695a318373be0dc2f4b04be561 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 25 Feb 2015 16:45:45 -0800 Subject: [PATCH 18/20] Ensure that the cost for typechecking is not billed to the emit portion of the compiler. --- src/compiler/program.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b74ef039fd6..a8e5b0b3a74 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -177,10 +177,15 @@ module ts { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } + // Create the emit resolver outside of the "emitTime" tracking code below. That way + // any cost associated with it (like type checking) are appropriate associated with + // the type-checking counter. + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + var start = new Date().getTime(); var emitResult = emitFiles( - getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile), + emitResolver, getEmitHost(writeFileCallback), sourceFile); From 909c367ed898b8e2bf87f595c72639eb46c10c7c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 25 Feb 2015 17:51:42 -0800 Subject: [PATCH 19/20] Added tests for testing escapes. --- ...CharactersThatArePartsOfEscapes01.errors.txt | 13 +++++++++++++ ...ngsPlainCharactersThatArePartsOfEscapes01.js | 17 +++++++++++++++++ ...lainCharactersThatArePartsOfEscapes01_ES6.js | 12 ++++++++++++ ...nCharactersThatArePartsOfEscapes01_ES6.types | 11 +++++++++++ ...ngsPlainCharactersThatArePartsOfEscapes02.js | 7 +++++++ ...PlainCharactersThatArePartsOfEscapes02.types | 5 +++++ ...lainCharactersThatArePartsOfEscapes02_ES6.js | 12 ++++++++++++ ...nCharactersThatArePartsOfEscapes02_ES6.types | 11 +++++++++++ .../templateStringControlCharacterEscapes01.js | 7 +++++++ ...emplateStringControlCharacterEscapes01.types | 6 ++++++ ...mplateStringControlCharacterEscapes01_ES6.js | 6 ++++++ ...ateStringControlCharacterEscapes01_ES6.types | 5 +++++ .../templateStringControlCharacterEscapes02.js | 7 +++++++ ...emplateStringControlCharacterEscapes02.types | 6 ++++++ ...mplateStringControlCharacterEscapes02_ES6.js | 6 ++++++ ...ateStringControlCharacterEscapes02_ES6.types | 5 +++++ .../templateStringControlCharacterEscapes03.js | 7 +++++++ ...emplateStringControlCharacterEscapes03.types | 6 ++++++ ...mplateStringControlCharacterEscapes03_ES6.js | 6 ++++++ ...ateStringControlCharacterEscapes03_ES6.types | 5 +++++ .../templateStringControlCharacterEscapes04.js | 7 +++++++ ...emplateStringControlCharacterEscapes04.types | 6 ++++++ ...mplateStringControlCharacterEscapes04_ES6.js | 6 ++++++ ...ateStringControlCharacterEscapes04_ES6.types | 5 +++++ ...ingPlainCharactersThatArePartsOfEscapes01.js | 6 ++++++ ...PlainCharactersThatArePartsOfEscapes01.types | 4 ++++ ...lainCharactersThatArePartsOfEscapes01_ES6.js | 6 ++++++ ...nCharactersThatArePartsOfEscapes01_ES6.types | 4 ++++ ...ingPlainCharactersThatArePartsOfEscapes02.js | 7 +++++++ ...PlainCharactersThatArePartsOfEscapes02.types | 5 +++++ ...lainCharactersThatArePartsOfEscapes02_ES6.js | 6 ++++++ ...nCharactersThatArePartsOfEscapes02_ES6.types | 4 ++++ ...ngsPlainCharactersThatArePartsOfEscapes01.ts | 7 +++++++ ...lainCharactersThatArePartsOfEscapes01_ES6.ts | 7 +++++++ ...ngsPlainCharactersThatArePartsOfEscapes02.ts | 3 +++ ...lainCharactersThatArePartsOfEscapes02_ES6.ts | 7 +++++++ .../templateStringControlCharacterEscapes01.ts | 3 +++ ...mplateStringControlCharacterEscapes01_ES6.ts | 3 +++ .../templateStringControlCharacterEscapes02.ts | 3 +++ ...mplateStringControlCharacterEscapes02_ES6.ts | 3 +++ .../templateStringControlCharacterEscapes03.ts | 3 +++ ...mplateStringControlCharacterEscapes03_ES6.ts | 3 +++ .../templateStringControlCharacterEscapes04.ts | 3 +++ ...mplateStringControlCharacterEscapes04_ES6.ts | 3 +++ ...ingPlainCharactersThatArePartsOfEscapes01.ts | 2 ++ ...lainCharactersThatArePartsOfEscapes01_ES6.ts | 3 +++ ...ingPlainCharactersThatArePartsOfEscapes02.ts | 3 +++ ...lainCharactersThatArePartsOfEscapes02_ES6.ts | 3 +++ 48 files changed, 285 insertions(+) create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.errors.txt create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.types create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.types create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js create mode 100644 tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes01.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes01.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes02.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes02.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes03.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes03.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes04.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes04.types create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.js create mode 100644 tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.types create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.types create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.types create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.types create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js create mode 100644 tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.types create mode 100644 tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts create mode 100644 tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts create mode 100644 tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.errors.txt b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.errors.txt new file mode 100644 index 00000000000..93b22614b95 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts(7,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts (1 errors) ==== + + + function f(...x: any[]) { + + } + + f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js new file mode 100644 index 00000000000..44eeeed4dfc --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js @@ -0,0 +1,17 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts] + + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js] +function f() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +f "0 1 2 3 4 5 6 7 8 \u0039 10 11 12 13 14 15 16 17 18 1\u0039 20 2028 202\u0039 0085 t v f b r n"; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js new file mode 100644 index 00000000000..a3c6806b1d3 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js @@ -0,0 +1,12 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts] + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js] +function f(...x) { +} +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.types b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.types new file mode 100644 index 00000000000..e1e63197c90 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts === + +function f(...x: any[]) { +>f : (...x: any[]) => void +>x : any[] + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` +>f : (...x: any[]) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js new file mode 100644 index 00000000000..6b087cc2df7 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js @@ -0,0 +1,7 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts] + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js] +"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "\u0039" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "1\u0039" + " " + "20" + " " + "2028" + " " + "202\u0039" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n"; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.types b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.types new file mode 100644 index 00000000000..3ee1a72f8e2 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts === + +No type information for this code. +No type information for this code.`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js new file mode 100644 index 00000000000..46eb5e90cd9 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js @@ -0,0 +1,12 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts] + +function f(...x: any[]) { + +} + +f `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js] +function f(...x) { +} +f `0${" "}1${" "}2${" "}3${" "}4${" "}5${" "}6${" "}7${" "}8${" "}9${" "}10${" "}11${" "}12${" "}13${" "}14${" "}15${" "}16${" "}17${" "}18${" "}19${" "}20${" "}2028${" "}2029${" "}0085${" "}t${" "}v${" "}f${" "}b${" "}r${" "}n`; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.types b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.types new file mode 100644 index 00000000000..727aa7daeb0 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts === + +function f(...x: any[]) { +>f : (...x: any[]) => void +>x : any[] + +} + +f `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +>f : (...x: any[]) => void + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01.js b/tests/baselines/reference/templateStringControlCharacterEscapes01.js new file mode 100644 index 00000000000..1b129e802e3 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes01.ts] + + +var x = `\0\x00\u0000 0 00 0000`; + +//// [templateStringControlCharacterEscapes01.js] +var x = "\0\0\0 0 00 0000"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01.types b/tests/baselines/reference/templateStringControlCharacterEscapes01.types new file mode 100644 index 00000000000..9a7a04c99a4 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts === + + +var x = `\0\x00\u0000 0 00 0000`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.js new file mode 100644 index 00000000000..9015655576c --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes01_ES6.ts] + +var x = `\0\x00\u0000 0 00 0000`; + +//// [templateStringControlCharacterEscapes01_ES6.js] +var x = `\0\x00\u0000 0 00 0000`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.types new file mode 100644 index 00000000000..5decfbc2924 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts === + +var x = `\0\x00\u0000 0 00 0000`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02.js b/tests/baselines/reference/templateStringControlCharacterEscapes02.js new file mode 100644 index 00000000000..eec39954b08 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes02.ts] + + +var x = `\x19\u0019 19`; + +//// [templateStringControlCharacterEscapes02.js] +var x = " 1\u0039"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02.types b/tests/baselines/reference/templateStringControlCharacterEscapes02.types new file mode 100644 index 00000000000..f47a3f69a77 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts === + + +var x = `\x19\u0019 19`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.js new file mode 100644 index 00000000000..2d76674b4dd --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes02_ES6.ts] + +var x = `\x19\u0019 19`; + +//// [templateStringControlCharacterEscapes02_ES6.js] +var x = `\x19\u0019 19`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.types new file mode 100644 index 00000000000..e7e123e0ab3 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts === + +var x = `\x19\u0019 19`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03.js b/tests/baselines/reference/templateStringControlCharacterEscapes03.js new file mode 100644 index 00000000000..1be2852214b --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes03.ts] + + +var x = `\x1F\u001f 1F 1f`; + +//// [templateStringControlCharacterEscapes03.js] +var x = " 1F 1f"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03.types b/tests/baselines/reference/templateStringControlCharacterEscapes03.types new file mode 100644 index 00000000000..23410460560 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts === + + +var x = `\x1F\u001f 1F 1f`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.js new file mode 100644 index 00000000000..b9b3df266d9 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes03_ES6.ts] + +var x = `\x1F\u001f 1F 1f`; + +//// [templateStringControlCharacterEscapes03_ES6.js] +var x = `\x1F\u001f 1F 1f`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.types new file mode 100644 index 00000000000..03642563b8a --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts === + +var x = `\x1F\u001f 1F 1f`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04.js b/tests/baselines/reference/templateStringControlCharacterEscapes04.js new file mode 100644 index 00000000000..70636a584b4 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes04.ts] + + +var x = `\x20\u0020 20`; + +//// [templateStringControlCharacterEscapes04.js] +var x = " 20"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04.types b/tests/baselines/reference/templateStringControlCharacterEscapes04.types new file mode 100644 index 00000000000..00aca41a83a --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts === + + +var x = `\x20\u0020 20`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.js new file mode 100644 index 00000000000..17461fb0841 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes04_ES6.ts] + +var x = `\x20\u0020 20`; + +//// [templateStringControlCharacterEscapes04_ES6.js] +var x = `\x20\u0020 20`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.types new file mode 100644 index 00000000000..0b993a8b2dc --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts === + +var x = `\x20\u0020 20`; +>x : string + diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js new file mode 100644 index 00000000000..580a5179a99 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js @@ -0,0 +1,6 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes01.ts] + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes01.js] +"0 1 2 3 4 5 6 7 8 \u0039 10 11 12 13 14 15 16 17 18 1\u0039 20 2028 202\u0039 0085 t v f b r n"; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.types new file mode 100644 index 00000000000..2b77345f8ff --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts === + +No type information for this code.`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js new file mode 100644 index 00000000000..4b599ee1d55 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts] + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js] +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.types new file mode 100644 index 00000000000..33c8839e194 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts === + +No type information for this code.`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js new file mode 100644 index 00000000000..79c1d350eb1 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js @@ -0,0 +1,7 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes02.ts] + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes02.js] +"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "\u0039" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "1\u0039" + " " + "20" + " " + "2028" + " " + "202\u0039" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n"; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.types new file mode 100644 index 00000000000..f630d9e71e6 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts === + +No type information for this code. +No type information for this code.`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js new file mode 100644 index 00000000000..0924c35b6ce --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts] + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js] +`0${" "}1${" "}2${" "}3${" "}4${" "}5${" "}6${" "}7${" "}8${" "}9${" "}10${" "}11${" "}12${" "}13${" "}14${" "}15${" "}16${" "}17${" "}18${" "}19${" "}20${" "}2028${" "}2029${" "}0085${" "}t${" "}v${" "}f${" "}b${" "}r${" "}n`; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.types new file mode 100644 index 00000000000..934e0fc495c --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts === + +No type information for this code.`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +No type information for this code. \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts new file mode 100644 index 00000000000..70f0a82a25f --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts @@ -0,0 +1,7 @@ + + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts new file mode 100644 index 00000000000..2bb885e5979 --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts @@ -0,0 +1,7 @@ +// @target: es6 + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts new file mode 100644 index 00000000000..33b9d27a233 --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts @@ -0,0 +1,3 @@ + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts new file mode 100644 index 00000000000..71627997068 --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts @@ -0,0 +1,7 @@ +// @target: es6 + +function f(...x: any[]) { + +} + +f `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts new file mode 100644 index 00000000000..dda77a70cad --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts @@ -0,0 +1,3 @@ + + +var x = `\0\x00\u0000 0 00 0000`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts new file mode 100644 index 00000000000..9875706896f --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\0\x00\u0000 0 00 0000`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts new file mode 100644 index 00000000000..a583517e987 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts @@ -0,0 +1,3 @@ + + +var x = `\x19\u0019 19`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts new file mode 100644 index 00000000000..4b514ba80c6 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\x19\u0019 19`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts new file mode 100644 index 00000000000..755cdedc270 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts @@ -0,0 +1,3 @@ + + +var x = `\x1F\u001f 1F 1f`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts new file mode 100644 index 00000000000..a24d3b57ae3 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\x1F\u001f 1F 1f`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts new file mode 100644 index 00000000000..19820e9daaa --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts @@ -0,0 +1,3 @@ + + +var x = `\x20\u0020 20`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts new file mode 100644 index 00000000000..45026545775 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\x20\u0020 20`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts new file mode 100644 index 00000000000..4f0d66e74a2 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts @@ -0,0 +1,2 @@ + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts new file mode 100644 index 00000000000..73ac4864314 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts new file mode 100644 index 00000000000..33b9d27a233 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts @@ -0,0 +1,3 @@ + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts new file mode 100644 index 00000000000..04b69b7f706 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file From d43e2e0fbbabd9e4eceeb819b88ee3d01be6de3e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 25 Feb 2015 18:01:23 -0800 Subject: [PATCH 20/20] Fixed character escaping for characters with values below 0x20 and '9'. --- src/compiler/core.ts | 4 ++-- ...edTemplateStringsPlainCharactersThatArePartsOfEscapes01.js | 2 +- ...edTemplateStringsPlainCharactersThatArePartsOfEscapes02.js | 2 +- .../reference/templateStringControlCharacterEscapes02.js | 2 +- .../reference/templateStringControlCharacterEscapes03.js | 2 +- .../templateStringPlainCharactersThatArePartsOfEscapes01.js | 2 +- .../templateStringPlainCharactersThatArePartsOfEscapes02.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d527b62005e..e27d3cb5207 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -607,7 +607,7 @@ module ts { } var backslashOrDoubleQuote = /[\"\\]/g; - var escapedCharsRegExp = /[\0-\19\t\v\f\b\0\r\n\u2028\u2029\u0085]/g; + var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; var escapedCharsMap: Map = { "\0": "\\0", "\t": "\\t", @@ -624,7 +624,7 @@ module ts { }; /** - * Based heavily on the abstract 'Quote' operation from ECMA-262 (24.3.2.2), + * Based heavily on the abstract 'Quote'/ 'QuoteJSONString' operation from ECMA-262 (24.3.2.2), * but augmented for a few select characters. * Note that this doesn't actually wrap the input in double quotes. */ diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js index 44eeeed4dfc..5e5feac077b 100644 --- a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js @@ -14,4 +14,4 @@ function f() { x[_i - 0] = arguments[_i]; } } -f "0 1 2 3 4 5 6 7 8 \u0039 10 11 12 13 14 15 16 17 18 1\u0039 20 2028 202\u0039 0085 t v f b r n"; +f "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js index 6b087cc2df7..ca192ef98d3 100644 --- a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js @@ -4,4 +4,4 @@ `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` //// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js] -"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "\u0039" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "1\u0039" + " " + "20" + " " + "2028" + " " + "202\u0039" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n"; +"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "9" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "19" + " " + "20" + " " + "2028" + " " + "2029" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02.js b/tests/baselines/reference/templateStringControlCharacterEscapes02.js index eec39954b08..5b5d34dae02 100644 --- a/tests/baselines/reference/templateStringControlCharacterEscapes02.js +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02.js @@ -4,4 +4,4 @@ var x = `\x19\u0019 19`; //// [templateStringControlCharacterEscapes02.js] -var x = " 1\u0039"; +var x = "\u0019\u0019 19"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03.js b/tests/baselines/reference/templateStringControlCharacterEscapes03.js index 1be2852214b..ae9774d952a 100644 --- a/tests/baselines/reference/templateStringControlCharacterEscapes03.js +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03.js @@ -4,4 +4,4 @@ var x = `\x1F\u001f 1F 1f`; //// [templateStringControlCharacterEscapes03.js] -var x = " 1F 1f"; +var x = "\u001f\u001f 1F 1f"; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js index 580a5179a99..62629f3284f 100644 --- a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js @@ -3,4 +3,4 @@ `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` //// [templateStringPlainCharactersThatArePartsOfEscapes01.js] -"0 1 2 3 4 5 6 7 8 \u0039 10 11 12 13 14 15 16 17 18 1\u0039 20 2028 202\u0039 0085 t v f b r n"; +"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js index 79c1d350eb1..27090032ab9 100644 --- a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js @@ -4,4 +4,4 @@ `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` //// [templateStringPlainCharactersThatArePartsOfEscapes02.js] -"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "\u0039" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "1\u0039" + " " + "20" + " " + "2028" + " " + "202\u0039" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n"; +"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "9" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "19" + " " + "20" + " " + "2028" + " " + "2029" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n";