Merge branch 'master' into this-function-types

This commit is contained in:
Nathan Shively-Sanders
2016-02-16 13:57:25 -08:00
520 changed files with 8644 additions and 2453 deletions
+3 -3
View File
@@ -28,9 +28,9 @@ build.json
*.actual
tests/webhost/*.d.ts
tests/webhost/webtsc.js
tests/*.js
tests/*.js.map
tests/*.d.ts
tests/cases/**/*.js
tests/cases/**/*.js.map
tests/cases/**/*.d.ts
*.config
scripts/debug.bat
scripts/run.bat
+1 -1
View File
@@ -13,7 +13,7 @@ Issues that ask questions answered in the FAQ will be closed without elaboration
## 3. Do you have a question?
The issue tracker is for **issues**, in other words, bugs and suggestions.
If you have a *question*, please use [http://stackoverflow.com/questions/tagged/typescript](Stack Overflow), [https://gitter.im/Microsoft/TypeScript](Gitter), your favorite search engine, or other resources.
If you have a *question*, please use [Stack Overflow](http://stackoverflow.com/questions/tagged/typescript), [Gitter](https://gitter.im/Microsoft/TypeScript), your favorite search engine, or other resources.
Due to increased traffic, we can no longer answer questions in the issue tracker.
## 4. Did you find a bug?
+41 -34
View File
@@ -223,51 +223,59 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
* @param prereqs: prerequisite tasks to compiling the file
* @param prefixes: a list of files to prepend to the target file
* @param useBuiltCompiler: true to use the built compiler, false to use the LKG
* @param noOutFile: true to compile without using --out
* @param generateDeclarations: true to compile using --declaration
* @param outDir: true to compile using --outDir
* @param keepComments: false to compile using --removeComments
* @parap {Object} opts - property bag containing auxiliary options
* @param {boolean} opts.noOutFile: true to compile without using --out
* @param {boolean} opts.generateDeclarations: true to compile using --declaration
* @param {string} opts.outDir: value for '--outDir' command line option
* @param {boolean} opts.keepComments: false to compile using --removeComments
* @param {boolean} opts.preserveConstEnums: true if compiler should keep const enums in code
* @param {boolean} opts.noResolve: true if compiler should not include non-rooted files in compilation
* @param {boolean} opts.stripInternal: true if compiler should remove declarations marked as @internal
* @param {boolean} opts.noMapRoot: true if compiler omit mapRoot option
* @param callback: a function to execute after the compilation process ends
*/
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) {
file(outFile, prereqs, function() {
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
var options = "--noImplicitAny --noEmitOnError --pretty";
opts = opts || {};
// Keep comments when specifically requested
// or when in debug mode.
if (!(keepComments || useDebugMode)) {
if (!(opts.keepComments || useDebugMode)) {
options += " --removeComments";
}
if (generateDeclarations) {
if (opts.generateDeclarations) {
options += " --declaration";
}
if (preserveConstEnums || useDebugMode) {
if (opts.preserveConstEnums || useDebugMode) {
options += " --preserveConstEnums";
}
if (outDir) {
options += " --outDir " + outDir;
if (opts.outDir) {
options += " --outDir " + opts.outDir;
}
if (!noOutFile) {
if (!opts.noOutFile) {
options += " --out " + outFile;
}
else {
options += " --module commonjs"
}
if(noResolve) {
if(opts.noResolve) {
options += " --noResolve";
}
if (useDebugMode) {
options += " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile));
options += " -sourcemap";
if (!opts.noMapRoot) {
options += " -mapRoot file:///" + path.resolve(path.dirname(outFile));
}
}
if (stripInternal) {
if (opts.stripInternal) {
options += " --stripInternal"
}
@@ -382,13 +390,7 @@ compileFile(/*outfile*/configureNightlyJs,
/*prereqs*/ [configureNightlyTs],
/*prefixes*/ [],
/*useBuiltCompiler*/ false,
/*noOutFile*/ false,
/*generateDeclarations*/ false,
/*outDir*/ undefined,
/*preserveConstEnums*/ undefined,
/*keepComments*/ false,
/*noResolve*/ false,
/*stripInternal*/ false);
{ noOutFile: false, generateDeclarations: false, keepComments: false, noResolve: false, stripInternal: false });
task("setDebugMode", function() {
useDebugMode = true;
@@ -438,6 +440,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
var servicesFileInBrowserTest = path.join(builtLocalDirectory, "typescriptServicesInBrowserTest.js");
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
@@ -446,13 +449,7 @@ var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_s
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
/*prefixes*/ [copyright],
/*useBuiltCompiler*/ true,
/*noOutFile*/ false,
/*generateDeclarations*/ true,
/*outDir*/ undefined,
/*preserveConstEnums*/ true,
/*keepComments*/ true,
/*noResolve*/ false,
/*stripInternal*/ true,
{ noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true },
/*callback*/ function () {
jake.cpR(servicesFile, nodePackageFile, {silent: true});
@@ -475,6 +472,16 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
});
compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
/*prefixes*/ [copyright],
/*useBuiltCompiler*/ true,
{ noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true, noMapRoot: true },
/*callback*/ function () {
var content = fs.readFileSync(servicesFileInBrowserTest).toString();
var i = content.lastIndexOf("\n");
fs.writeFileSync(servicesFileInBrowserTest, content.substring(0, i) + "\r\n//# sourceURL=../built/local/typeScriptServices.js" + content.substring(i));
});
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
@@ -486,8 +493,7 @@ compileFile(
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
/*prefixes*/ [copyright],
/*useBuiltCompiler*/ true,
/*noOutFile*/ false,
/*generateDeclarations*/ true);
{ noOutFile: false, generateDeclarations: true });
// Local target to build the language service server library
desc("Builds language service server library");
@@ -720,7 +726,7 @@ task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
// Browser tests
var nodeServerOutFile = 'tests/webTestServer.js'
var nodeServerInFile = 'tests/webTestServer.ts'
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, /*noOutFile*/ true);
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true });
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function() {
@@ -729,7 +735,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
}, {async: true});
desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]");
task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function() {
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() {
cleanTestDirs();
host = "node"
port = process.env.port || process.env.p || '8888';
@@ -881,7 +887,8 @@ var tslintRulesOutFiles = tslintRules.map(function(p) {
desc("Compiles tslint rules to js");
task("build-rules", tslintRulesOutFiles);
tslintRulesFiles.forEach(function(ruleFile, i) {
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false,
{ noOutFile: true, generateDeclarations: false, outDir: path.join(builtLocalDirectory, "tslint")});
});
function getLinterOptions() {
+3 -1
View File
@@ -1,7 +1,9 @@
# Read This!
This directory contains miscellaneous documentation such as the TypeScript language specification and logo.
If you are looking for more introductory material, you might want to take a look at the [TypeScript Handbook](https://github.com/Microsoft/TypeScript-Handbook).
# Spec Contributions
The specification is first authored as a Microsoft Word (docx) file and then generated into Markdown and PDF formats.
Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new) rather than sent as pull requests.
Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that **any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new)** rather than sent as pull requests.
+4
View File
@@ -0,0 +1,4 @@
# The TypeScript Handbook
The contents of the TypeScript Handbook can be read from [its GitHub repository](https://github.com/Microsoft/TypeScript-Handbook).
Issues and pull requests should be directed there.
+6
View File
@@ -0,0 +1,6 @@
# The TypeScript Wiki
To read the wiki, [visit the wiki on GitHub](https://github.com/Microsoft/TypeScript/wiki).
To contribute by filing an issue or sending a pull request, [visit the wiki repository](https://github.com/Microsoft/TypeScript-wiki).
+4 -3
View File
@@ -1,4 +1,5 @@
# Read this!
# Read This!
These files are not meant to be edited by hand.
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. Running `jake LKG` will then appropriately update the files in this directory.
**These files are not meant to be edited by hand.**
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory.
Running `jake LKG` will then appropriately update the files in this directory.
+10 -10
View File
@@ -12,7 +12,7 @@ namespace ts {
}
const enum Reachability {
Unintialized = 1 << 0,
Uninitialized = 1 << 0,
Reachable = 1 << 1,
Unreachable = 1 << 2,
ReportedUnreachable = 1 << 3
@@ -393,7 +393,7 @@ namespace ts {
// the getLocalNameOfContainer function in the type checker to validate that the local name
// used for a container is unique.
function bindChildren(node: Node) {
// Before we recurse into a node's chilren, we first save the existing parent, container
// Before we recurse into a node's children, we first save the existing parent, container
// and block-container. Then after we pop out of processing the children, we restore
// these saved values.
const saveParent = parent;
@@ -418,7 +418,7 @@ namespace ts {
// Finally, if this is a block-container, then we clear out any existing .locals object
// it may contain within it. This happens in incremental scenarios. Because we can be
// reusing a node from a previous compilation, that node may have had 'locals' created
// for it. We must clear this so we don't accidently move any stale data forward from
// for it. We must clear this so we don't accidentally move any stale data forward from
// a previous compilation.
const containerFlags = getContainerFlags(node);
if (containerFlags & ContainerFlags.IsContainer) {
@@ -699,7 +699,7 @@ namespace ts {
const hasDefault = forEach(n.caseBlock.clauses, c => c.kind === SyntaxKind.DefaultClause);
// post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case
// post switch state is unreachable if switch is exhaustive (has a default case ) and does not have fallthrough from the last case
const postSwitchState = hasDefault && currentReachabilityState !== Reachability.Reachable ? Reachability.Unreachable : preSwitchState;
popImplicitLabel(postSwitchLabel, postSwitchState);
@@ -766,7 +766,7 @@ namespace ts {
case SyntaxKind.Block:
// do not treat blocks directly inside a function as a block-scoped-container.
// Locals that reside in this block should go to the function locals. Othewise 'x'
// Locals that reside in this block should go to the function locals. Otherwise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
// example:
//
@@ -956,7 +956,7 @@ namespace ts {
const identifier = <Identifier>prop.name;
// ECMA-262 11.1.5 Object Initialiser
// ECMA-262 11.1.5 Object Initializer
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and
// IsDataDescriptor(propId.descriptor) is true.
@@ -1632,14 +1632,14 @@ namespace ts {
if (hasProperty(labelIndexMap, name.text)) {
return false;
}
labelIndexMap[name.text] = labelStack.push(Reachability.Unintialized) - 1;
labelIndexMap[name.text] = labelStack.push(Reachability.Uninitialized) - 1;
return true;
}
function pushImplicitLabel(): number {
initializeReachabilityStateIfNecessary();
const index = labelStack.push(Reachability.Unintialized) - 1;
const index = labelStack.push(Reachability.Uninitialized) - 1;
implicitLabels.push(index);
return index;
}
@@ -1669,7 +1669,7 @@ namespace ts {
}
function setCurrentStateAtLabel(innerMergedState: Reachability, outerState: Reachability, label: Identifier): void {
if (innerMergedState === Reachability.Unintialized) {
if (innerMergedState === Reachability.Uninitialized) {
if (label && !options.allowUnusedLabels) {
file.bindDiagnostics.push(createDiagnosticForNode(label, Diagnostics.Unused_label));
}
@@ -1690,7 +1690,7 @@ namespace ts {
return false;
}
const stateAtLabel = labelStack[index];
labelStack[index] = stateAtLabel === Reachability.Unintialized ? outerState : or(stateAtLabel, outerState);
labelStack[index] = stateAtLabel === Reachability.Uninitialized ? outerState : or(stateAtLabel, outerState);
return true;
}
+353 -301
View File
File diff suppressed because it is too large Load Diff
+27 -3
View File
@@ -78,6 +78,7 @@ namespace ts {
name: "module",
shortName: "m",
type: {
"none": ModuleKind.None,
"commonjs": ModuleKind.CommonJS,
"amd": ModuleKind.AMD,
"system": ModuleKind.System,
@@ -87,7 +88,7 @@ namespace ts {
},
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,
paramType: Diagnostics.KIND,
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none
},
{
name: "newLine",
@@ -324,6 +325,11 @@ namespace ts {
name: "allowSyntheticDefaultImports",
type: "boolean",
description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking
},
{
name: "noImplicitUseStrict",
type: "boolean",
description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output
}
];
@@ -550,7 +556,21 @@ namespace ts {
}
else {
const filesSeen: Map<boolean> = {};
const exclude = json["exclude"] instanceof Array ? map(<string[]>json["exclude"], normalizeSlashes) : undefined;
let exclude: string[] = [];
if (json["exclude"] instanceof Array) {
exclude = json["exclude"];
}
else {
// by default exclude node_modules, and any specificied output directory
exclude = ["node_modules"];
const outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
exclude.push(outDir);
}
}
exclude = map(exclude, normalizeSlashes);
const supportedExtensions = getSupportedExtensions(options);
Debug.assert(indexOf(supportedExtensions, ".ts") < indexOf(supportedExtensions, ".d.ts"), "Changed priority of extensions to pick");
@@ -564,6 +584,11 @@ namespace ts {
continue;
}
// Skip over any minified JavaScript files (ending in ".min.js")
if (/\.min\.js$/.test(fileName)) {
continue;
}
// If this is one of the output extension (which would be .d.ts and .js if we are allowing compilation of js files)
// do not include this file if we included .ts or .tsx file with same base name as it could be output of the earlier compilation
if (extension === ".d.ts" || (options.allowJs && contains(supportedJavascriptExtensions, extension))) {
@@ -587,7 +612,6 @@ namespace ts {
const errors: Diagnostic[] = [];
if (configFileName && getBaseFileName(configFileName) === "jsconfig.json") {
options.module = ModuleKind.CommonJS;
options.allowJs = true;
}
+2 -2
View File
@@ -667,7 +667,7 @@ namespace ts {
}
function getNormalizedPathComponentsOfUrl(url: string) {
// Get root length of http://www.website.com/folder1/foler2/
// Get root length of http://www.website.com/folder1/folder2/
// In this example the root is: http://www.website.com/
// normalized path components should be ["http://www.website.com/", "folder1", "folder2"]
@@ -695,7 +695,7 @@ namespace ts {
const indexOfNextSlash = url.indexOf(directorySeparator, rootLength);
if (indexOfNextSlash !== -1) {
// Found the "/" after the website.com so the root is length of http://www.website.com/
// and get components afetr the root normally like any other folder components
// and get components after the root normally like any other folder components
rootLength = indexOfNextSlash + 1;
return normalizedPathComponents(url, rootLength);
}
+66 -69
View File
@@ -18,7 +18,7 @@ namespace ts {
referencePathsOutput: string;
}
type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic;
type GetSymbolAccessibilityDiagnostic = (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic;
interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter {
getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic;
@@ -51,7 +51,9 @@ namespace ts {
let decreaseIndent: () => void;
let writeTextOfNode: (text: string, node: Node) => void;
let writer = createAndSetNewTextWriterWithSymbolWriter();
let writer: EmitTextWriterWithSymbolWriter;
createAndSetNewTextWriterWithSymbolWriter();
let enclosingDeclaration: Node;
let resultHasExternalModuleIndicator: boolean;
@@ -174,7 +176,7 @@ namespace ts {
}
}
function createAndSetNewTextWriterWithSymbolWriter(): EmitTextWriterWithSymbolWriter {
function createAndSetNewTextWriterWithSymbolWriter(): void {
const writer = <EmitTextWriterWithSymbolWriter>createTextWriter(newLine);
writer.trackSymbol = trackSymbol;
writer.reportInaccessibleThisError = reportInaccessibleThisError;
@@ -186,7 +188,6 @@ namespace ts {
writer.writeParameter = writer.write;
writer.writeSymbol = writer.write;
setWriter(writer);
return writer;
}
function setWriter(newWriter: EmitTextWriterWithSymbolWriter) {
@@ -252,30 +253,30 @@ namespace ts {
setWriter(oldWriter);
}
function handleSymbolAccessibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
function handleSymbolAccessibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) {
if (symbolAccessibilityResult.accessibility === SymbolAccessibility.Accessible) {
// write the aliases
if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) {
writeAsynchronousModuleElements(symbolAccesibilityResult.aliasesToMakeVisible);
if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {
writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible);
}
}
else {
// Report error
reportedDeclarationError = true;
const errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult);
const errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
if (errorInfo) {
if (errorInfo.typeName) {
emitterDiagnostics.add(createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode,
emitterDiagnostics.add(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode,
errorInfo.diagnosticMessage,
getTextOfNodeFromSourceText(currentText, errorInfo.typeName),
symbolAccesibilityResult.errorSymbolName,
symbolAccesibilityResult.errorModuleName));
symbolAccessibilityResult.errorSymbolName,
symbolAccessibilityResult.errorModuleName));
}
else {
emitterDiagnostics.add(createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode,
emitterDiagnostics.add(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode,
errorInfo.diagnosticMessage,
symbolAccesibilityResult.errorSymbolName,
symbolAccesibilityResult.errorModuleName));
symbolAccessibilityResult.errorSymbolName,
symbolAccessibilityResult.errorModuleName));
}
}
}
@@ -548,7 +549,7 @@ namespace ts {
writeAsynchronousModuleElements(nodes);
}
function getDefaultExportAccessibilityDiagnostic(diagnostic: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
function getDefaultExportAccessibilityDiagnostic(diagnostic: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
return {
diagnosticMessage: Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
errorNode: node
@@ -677,7 +678,7 @@ namespace ts {
}
writer.writeLine();
function getImportEntityNameVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
function getImportEntityNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
return {
diagnosticMessage: Diagnostics.Import_declaration_0_is_using_private_name_1,
errorNode: node,
@@ -698,10 +699,6 @@ namespace ts {
}
function writeImportDeclaration(node: ImportDeclaration) {
if (!node.importClause && !(node.flags & NodeFlags.Export)) {
// do not write non-exported import declarations that don't have import clauses
return;
}
emitJsDocComments(node);
if (node.flags & NodeFlags.Export) {
write("export ");
@@ -737,7 +734,7 @@ namespace ts {
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration) {
// emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations).
// the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered
// external modules since they are indistingushable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}'
// external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}'
// so compiler will treat them as external modules.
resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== SyntaxKind.ModuleDeclaration;
let moduleSpecifier: Node;
@@ -854,7 +851,7 @@ namespace ts {
writeLine();
enclosingDeclaration = prevEnclosingDeclaration;
function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
return {
diagnosticMessage: Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,
errorNode: node.type,
@@ -921,7 +918,7 @@ namespace ts {
}
}
function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
// Type parameter constraints are named by user so we should always be able to name it
let diagnosticMessage: DiagnosticMessage;
switch (node.parent.kind) {
@@ -991,7 +988,7 @@ namespace ts {
write("null");
}
function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
function getHeritageClauseVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;
// Heritage clause is written by user so it can always be named
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
@@ -1108,10 +1105,10 @@ namespace ts {
}
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult: SymbolAccessiblityResult) {
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) {
if (node.kind === SyntaxKind.VariableDeclaration) {
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
@@ -1120,30 +1117,30 @@ namespace ts {
else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (node.flags & NodeFlags.Static) {
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
}
else {
// Interfaces cannot have types that cannot be named
return symbolAccesibilityResult.errorModuleName ?
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
}
}
}
function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: node,
@@ -1167,8 +1164,8 @@ namespace ts {
}
function emitBindingElement(bindingElement: BindingElement) {
function getBindingElementTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
function getBindingElementTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: bindingElement,
@@ -1259,17 +1256,17 @@ namespace ts {
}
}
function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;
if (accessorWithTypeAnnotation.kind === SyntaxKind.SetAccessor) {
// Setters have to have type named and cannot infer it so, the type should always be named
if (accessorWithTypeAnnotation.parent.flags & NodeFlags.Static) {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1;
}
@@ -1282,15 +1279,15 @@ namespace ts {
}
else {
if (accessorWithTypeAnnotation.flags & NodeFlags.Static) {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0;
}
else {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0;
@@ -1389,26 +1386,26 @@ namespace ts {
writeLine();
}
function getReturnTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
function getReturnTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;
switch (node.kind) {
case SyntaxKind.ConstructSignature:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
case SyntaxKind.CallSignature:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
case SyntaxKind.IndexSignature:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
@@ -1416,30 +1413,30 @@ namespace ts {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
if (node.flags & NodeFlags.Static) {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;
}
else {
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
case SyntaxKind.FunctionDeclaration:
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;
@@ -1485,8 +1482,8 @@ namespace ts {
writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError);
}
function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: node,
@@ -1494,53 +1491,53 @@ namespace ts {
} : undefined;
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult: SymbolAccessiblityResult): DiagnosticMessage {
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult): DiagnosticMessage {
switch (node.parent.kind) {
case SyntaxKind.Constructor:
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
case SyntaxKind.ConstructSignature:
// Interfaces cannot have parameter types that cannot be named
return symbolAccesibilityResult.errorModuleName ?
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
case SyntaxKind.CallSignature:
// Interfaces cannot have parameter types that cannot be named
return symbolAccesibilityResult.errorModuleName ?
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
if (node.parent.flags & NodeFlags.Static) {
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
// Interfaces cannot have parameter types that cannot be named
return symbolAccesibilityResult.errorModuleName ?
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
case SyntaxKind.FunctionDeclaration:
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
+30 -29
View File
@@ -1,4 +1,4 @@
{
{
"Unterminated string literal.": {
"category": "Error",
"code": 1002
@@ -123,7 +123,7 @@
"category": "Error",
"code": 1043
},
"'{0}' modifier cannot appear on a module element.": {
"'{0}' modifier cannot appear on a module or namespace element.": {
"category": "Error",
"code": 1044
},
@@ -447,7 +447,7 @@
"category": "Error",
"code": 1147
},
"Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": {
"Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": {
"category": "Error",
"code": 1148
},
@@ -687,7 +687,7 @@
"category": "Error",
"code": 1218
},
"Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.": {
"Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.": {
"category": "Error",
"code": 1219
},
@@ -723,6 +723,10 @@
"category": "Error",
"code": 1227
},
"A type predicate is only allowed in return type position for functions and methods.": {
"category": "Error",
"code": 1228
},
"A type predicate cannot reference a rest parameter.": {
"category": "Error",
"code": 1229
@@ -1279,10 +1283,6 @@
"category": "Error",
"code": 2417
},
"Type name '{0}' in extends clause does not reference constructor function for '{0}'.": {
"category": "Error",
"code": 2419
},
"Class '{0}' incorrectly implements interface '{1}'.": {
"category": "Error",
"code": 2420
@@ -2203,6 +2203,7 @@
"category": "Error",
"code": 5062
},
"Concatenate and emit output to single file.": {
"category": "Message",
"code": 6001
@@ -2247,10 +2248,10 @@
"category": "Message",
"code": 6011
},
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
"category": "Message",
"code": 6015
},
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
"category": "Message",
"code": 6015
},
"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'": {
"category": "Message",
"code": 6016
@@ -2335,7 +2336,7 @@
"category": "Error",
"code": 6045
},
"Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'.": {
"Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'none'.": {
"category": "Error",
"code": 6046
},
@@ -2587,6 +2588,11 @@
"category": "Message",
"code": 6111
},
"Do not emit 'use strict' directives in module output.": {
"category": "Message",
"code": 6112
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
"code": 7005
@@ -2739,11 +2745,6 @@
"category": "Error",
"code": 8016
},
"'decorators' can only be used in a .ts file.": {
"category": "Error",
"code": 8017
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
"category": "Error",
"code": 9002
@@ -2773,23 +2774,23 @@
"code": 17004
},
"A constructor cannot contain a 'super' call when its class extends 'null'": {
"category": "Error",
"code": 17005
"category": "Error",
"code": 17005
},
"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
"category": "Error",
"code": 17006
"category": "Error",
"code": 17006
},
"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
"category": "Error",
"code": 17007
"category": "Error",
"code": 17007
},
"JSX element '{0}' has no corresponding closing tag.": {
"category": "Error",
"code": 17008
"category": "Error",
"code": 17008
},
"'super' must be called before accessing 'this' in the constructor of a derived class.": {
"category": "Error",
"code": 17009
"category": "Error",
"code": 17009
}
}
}
+160 -47
View File
@@ -287,6 +287,54 @@ namespace ts {
_i = 0x10000000, // Use/preference flag for '_i'
}
const enum CopyDirection {
ToOriginal,
ToOutParameter
}
/**
* If loop contains block scoped binding captured in some function then loop body is converted to a function.
* Lexical bindings declared in loop initializer will be passed into the loop body function as parameters,
* however if this binding is modified inside the body - this new value should be propagated back to the original binding.
* This is done by declaring new variable (out parameter holder) outside of the loop for every binding that is reassigned inside the body.
* On every iteration this variable is initialized with value of corresponding binding.
* At every point where control flow leaves the loop either explicitly (break/continue) or implicitly (at the end of loop body)
* we copy the value inside the loop to the out parameter holder.
*
* for (let x;;) {
* let a = 1;
* let b = () => a;
* x++
* if (...) break;
* ...
* }
*
* will be converted to
*
* var out_x;
* var loop = function(x) {
* var a = 1;
* var b = function() { return a; }
* x++;
* if (...) return out_x = x, "break";
* ...
* out_x = x;
* }
* for (var x;;) {
* out_x = x;
* var state = loop(x);
* x = out_x;
* if (state === "break") break;
* }
*
* NOTE: values to out parameters are not copies if loop is abrupted with 'return' - in this case this will end the entire enclosing function
* so nobody can observe this new value.
*/
interface LoopOutParameter {
originalName: Identifier;
outParamName: string;
}
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult {
// emit output for the __extends helper function
@@ -359,14 +407,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
interface ConvertedLoopState {
/*
* set of labels that occured inside the converted loop
* set of labels that occurred inside the converted loop
* used to determine if labeled jump can be emitted as is or it should be dispatched to calling code
*/
labels?: Map<string>;
/*
* collection of labeled jumps that transfer control outside the converted loop.
* maps store association 'label -> labelMarker' where
* - label - value of label as it apprear in code
* - label - value of label as it appear in code
* - label marker - return value that should be interpreted by calling code as 'jump to <label>'
*/
labeledNonLocalBreaks?: Map<string>;
@@ -389,7 +437,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
* i.e.
* for (let x;;) <statement that captures x in closure and uses 'arguments'>
* should be converted to
* var loop = function(x) { <code where 'arguments' is replaced witg 'arguments_1'> }
* var loop = function(x) { <code where 'arguments' is replaced with 'arguments_1'> }
* var arguments_1 = arguments
* for (var x;;) loop(x);
* otherwise semantics of the code will be different since 'arguments' inside converted loop body
@@ -419,6 +467,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
* for (var x;;) loop(x);
*/
hoistedLocalVariables?: Identifier[];
/**
* List of loop out parameters - detailed descripion can be found in the comment to LoopOutParameter
*/
loopOutParameters?: LoopOutParameter[];
}
function setLabeledJump(state: ConvertedLoopState, isBreak: boolean, labelText: string, labelMarker: string): void {
@@ -952,7 +1005,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
// Examples: `\n` is converted to "\\n", a template string with a newline to "\n".
let text = getTextOfNodeFromSourceText(currentText, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// text contains the original source, it will also contain quotes ("`"), dollar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
@@ -2968,11 +3021,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
let loopParameters: string[];
let loopOutParameters: LoopOutParameter[];
if (loopInitializer && (getCombinedNodeFlags(loopInitializer) & NodeFlags.BlockScoped)) {
// if loop initializer contains block scoped variables - they should be passed to converted loop body as parameters
loopParameters = [];
for (const varDeclaration of loopInitializer.declarations) {
collectNames(varDeclaration.name);
processVariableDeclaration(varDeclaration.name);
}
}
@@ -2982,14 +3036,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
writeLine();
write(`var ${functionName} = function(${paramList})`);
if (!bodyIsBlock) {
write(" {");
writeLine();
increaseIndent();
}
const convertedOuterLoopState = convertedLoopState;
convertedLoopState = {};
convertedLoopState = { loopOutParameters };
if (convertedOuterLoopState) {
// convertedOuterLoopState !== undefined means that this converted loop is nested in another converted loop.
@@ -3013,16 +3061,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
}
emitEmbeddedStatement(node.statement);
write(" {");
writeLine();
increaseIndent();
if (!bodyIsBlock) {
decreaseIndent();
writeLine();
write("}");
if (bodyIsBlock) {
emitLines((<Block>node.statement).statements);
}
write(";");
else {
emit(node.statement);
}
writeLine();
// end of loop body -> copy out parameter
copyLoopOutParameters(convertedLoopState, CopyDirection.ToOutParameter, /*emitAsStatements*/true);
decreaseIndent();
writeLine();
write("};");
writeLine();
if (loopOutParameters) {
// declare variables to hold out params for loop body
write(`var `);
for (let i = 0; i < loopOutParameters.length; i++) {
if (i !== 0) {
write(", ");
}
write(loopOutParameters[i].outParamName);
}
write(";");
writeLine();
}
if (convertedLoopState.argumentsName) {
// if alias for arguments is set
if (convertedOuterLoopState) {
@@ -3086,14 +3156,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
return { functionName, paramList, state: currentLoopState };
function collectNames(name: Identifier | BindingPattern): void {
function processVariableDeclaration(name: Identifier | BindingPattern): void {
if (name.kind === SyntaxKind.Identifier) {
const nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(<Identifier>name) ? getGeneratedNameForNode(name) : (<Identifier>name).text;
const nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(<Identifier>name)
? getGeneratedNameForNode(name)
: (<Identifier>name).text;
loopParameters.push(nameText);
if (resolver.getNodeCheckFlags(name.parent) & NodeCheckFlags.NeedsLoopOutParameter) {
const reassignedVariable = { originalName: <Identifier>name, outParamName: makeUniqueName(`out_${nameText}`) };
(loopOutParameters || (loopOutParameters = [])).push(reassignedVariable);
}
}
else {
for (const element of (<BindingPattern>name).elements) {
collectNames(element.name);
processVariableDeclaration(element.name);
}
}
}
@@ -3124,6 +3201,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
}
function copyLoopOutParameters(state: ConvertedLoopState, copyDirection: CopyDirection, emitAsStatements: boolean) {
if (state.loopOutParameters) {
for (const outParam of state.loopOutParameters) {
if (copyDirection === CopyDirection.ToOriginal) {
emitIdentifier(outParam.originalName);
write(` = ${outParam.outParamName}`);
}
else {
write(`${outParam.outParamName} = `);
emitIdentifier(outParam.originalName);
}
if (emitAsStatements) {
write(";");
writeLine();
}
else {
write(", ");
}
}
}
}
function emitConvertedLoopCall(loop: ConvertedLoop, emitAsBlock: boolean): void {
if (emitAsBlock) {
write(" {");
@@ -3144,6 +3243,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
write(`${loop.functionName}(${loop.paramList});`);
writeLine();
copyLoopOutParameters(loop.state, CopyDirection.ToOriginal, /*emitAsStatements*/ true);
if (!isSimpleLoop) {
// for non simple loops we need to store result returned from converted loop function and use it to do dispatching
@@ -3463,14 +3565,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
write ("return ");
// explicit exit from loop -> copy out parameters
copyLoopOutParameters(convertedLoopState, CopyDirection.ToOutParameter, /*emitAsStatements*/ false);
if (!node.label) {
if (node.kind === SyntaxKind.BreakStatement) {
convertedLoopState.nonLocalJumps |= Jump.Break;
write(`return "break";`);
write(`"break";`);
}
else {
convertedLoopState.nonLocalJumps |= Jump.Continue;
write(`return "continue";`);
write(`"continue";`);
}
}
else {
@@ -3483,7 +3588,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
labelMarker = `continue-${node.label.text}`;
setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker);
}
write(`return "${labelMarker}";`);
write(`"${labelMarker}";`);
}
return;
@@ -3959,14 +4064,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
if (properties.length !== 1) {
// For anything but a single element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once.
// When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
// When doing so we want to highlight the passed in source map node since thats the one needing this temp assignment
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode);
}
for (const p of properties) {
if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) {
const propName = <Identifier | LiteralExpression>(<PropertyAssignment>p).name;
const target = p.kind === SyntaxKind.ShorthandPropertyAssignment ? <ShorthandPropertyAssignment>p : (<PropertyAssignment>p).initializer || propName;
// Assignment for target = value.propName should highligh whole property, hence use p as source map node
// Assignment for target = value.propName should highlight whole property, hence use p as source map node
emitDestructuringAssignment(target, createPropertyAccessForDestructuringProperty(value, propName), p);
}
}
@@ -3977,13 +4082,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
if (elements.length !== 1) {
// For anything but a single element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once.
// When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
// When doing so we want to highlight the passed in source map node since thats the one needing this temp assignment
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode);
}
for (let i = 0; i < elements.length; i++) {
const e = elements[i];
if (e.kind !== SyntaxKind.OmittedExpression) {
// Assignment for target = value.propName should highligh whole property, hence use e as source map node
// Assignment for target = value.propName should highlight whole property, hence use e as source map node
if (e.kind !== SyntaxKind.SpreadElementExpression) {
emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e);
}
@@ -4791,18 +4896,24 @@ const _super = (function (geti, seti) {
emitToken(SyntaxKind.CloseBraceToken, body.statements.end);
}
function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement {
if (ctor.body) {
const statement = (<Block>ctor.body).statements[0];
if (statement && statement.kind === SyntaxKind.ExpressionStatement) {
const expr = (<ExpressionStatement>statement).expression;
if (expr && expr.kind === SyntaxKind.CallExpression) {
const func = (<CallExpression>expr).expression;
if (func && func.kind === SyntaxKind.SuperKeyword) {
return <ExpressionStatement>statement;
}
}
}
/**
* Return the statement at a given index if it is a super-call statement
* @param ctor a constructor declaration
* @param index an index to constructor's body to check
*/
function getSuperCallAtGivenIndex(ctor: ConstructorDeclaration, index: number): ExpressionStatement {
if (!ctor.body) {
return undefined;
}
const statements = ctor.body.statements;
if (!statements || index >= statements.length) {
return undefined;
}
const statement = statements[index];
if (statement.kind === SyntaxKind.ExpressionStatement) {
return isSuperCallExpression((<ExpressionStatement>statement).expression) ? <ExpressionStatement>statement : undefined;
}
}
@@ -5086,13 +5197,15 @@ const _super = (function (geti, seti) {
if (ctor) {
emitDefaultValueAssignments(ctor);
emitRestParameter(ctor);
if (baseTypeElement) {
superCall = findInitialSuperCall(ctor);
superCall = getSuperCallAtGivenIndex(ctor, startIndex);
if (superCall) {
writeLine();
emit(superCall);
}
}
emitParameterPropertyAssignments(ctor);
}
else {
@@ -6634,7 +6747,7 @@ const _super = (function (geti, seti) {
// when resolving exports local exported entries/indirect exported entries in the module
// should always win over entries with similar names that were added via star exports
// to support this we store names of local/indirect exported entries in a set.
// this set is used to filter names brought by star expors.
// this set is used to filter names brought by star exports.
if (!hasExportStarsToExportValues) {
// local names set is needed only in presence of star exports
return undefined;
@@ -7180,7 +7293,7 @@ const _super = (function (geti, seti) {
write(`], function(${exportFunctionForFile}, ${contextObjectForFile}) {`);
writeLine();
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict);
writeLine();
write(`var __moduleName = ${contextObjectForFile} && ${contextObjectForFile}.id;`);
writeLine();
@@ -7286,7 +7399,7 @@ const _super = (function (geti, seti) {
writeModuleName(node, emitRelativePathAsModuleName);
emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName);
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/!compilerOptions.noImplicitUseStrict);
emitExportStarHelper();
emitCaptureThisForNodeIfNecessary(node);
emitLinesStartingAt(node.statements, startIndex);
@@ -7298,7 +7411,7 @@ const _super = (function (geti, seti) {
}
function emitCommonJSModule(node: SourceFile) {
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict);
emitEmitHelpers(node);
collectExternalModuleInfo(node);
emitExportStarHelper();
@@ -7327,7 +7440,7 @@ const _super = (function (geti, seti) {
})(`);
emitAMDFactoryHeader(dependencyNames);
increaseIndent();
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict);
emitExportStarHelper();
emitCaptureThisForNodeIfNecessary(node);
emitLinesStartingAt(node.statements, startIndex);
@@ -7965,7 +8078,7 @@ const _super = (function (geti, seti) {
// declare var x;
// /// <reference-path ...>
// interface F {}
// The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted
// The first /// will NOT be removed while the second one will be removed even though both node will not be emitted
if (node.pos === 0) {
leadingComments = filter(getLeadingCommentsToEmit(node), isTripleSlashComment);
}
+68 -43
View File
@@ -577,7 +577,7 @@ namespace ts {
scanner.setText("");
scanner.setOnError(undefined);
// Clear any data. We don't want to accidently hold onto it for too long.
// Clear any data. We don't want to accidentally hold onto it for too long.
parseDiagnostics = undefined;
sourceFile = undefined;
identifiers = undefined;
@@ -1442,8 +1442,8 @@ namespace ts {
// We can only reuse a node if it was parsed under the same strict mode that we're
// currently in. i.e. if we originally parsed a node in non-strict mode, but then
// the user added 'using strict' at the top of the file, then we can't use that node
// again as the presense of strict mode may cause us to parse the tokens in the file
// differetly.
// again as the presence of strict mode may cause us to parse the tokens in the file
// differently.
//
// Note: we *can* reuse tokens when the strict mode changes. That's because tokens
// are unaffected by strict mode. It's just the parser will decide what to do with it
@@ -1456,7 +1456,7 @@ namespace ts {
}
// Ok, we have a node that looks like it could be reused. Now verify that it is valid
// in the currest list parsing context that we're currently at.
// in the current list parsing context that we're currently at.
if (!canReuseNode(node, parsingContext)) {
return undefined;
}
@@ -1937,7 +1937,7 @@ namespace ts {
return finishNode(node);
}
function parseTypePredicate(lhs: Identifier | ThisTypeNode): TypePredicateNode {
function parseThisTypePredicate(lhs: ThisTypeNode): TypePredicateNode {
nextToken();
const node = createNode(SyntaxKind.TypePredicate, lhs.pos) as TypePredicateNode;
node.parameterName = lhs;
@@ -2225,7 +2225,7 @@ namespace ts {
method.name = name;
method.questionToken = questionToken;
// Method signatues don't exist in expression contexts. So they have neither
// Method signatures don't exist in expression contexts. So they have neither
// [Yield] nor [Await]
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method);
parseTypeMemberSemicolon();
@@ -2366,7 +2366,7 @@ namespace ts {
case SyntaxKind.ThisKeyword: {
const thisKeyword = parseThisTypeNode();
if (token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
return parseTypePredicate(thisKeyword);
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
@@ -2454,10 +2454,27 @@ namespace ts {
if (token === SyntaxKind.LessThanToken) {
return true;
}
return token === SyntaxKind.OpenParenToken && lookAhead(isUnambiguouslyStartOfFunctionType);
}
function skipParameterStart(): boolean {
if (isModifierKind(token)) {
// Skip modifiers
parseModifiers();
}
if (isIdentifier() || token === SyntaxKind.ThisKeyword) {
nextToken();
return true;
}
if (token === SyntaxKind.OpenBracketToken || token === SyntaxKind.OpenBraceToken) {
// Return true if we can parse an array or object binding pattern with no errors
const previousErrorCount = parseDiagnostics.length;
parseIdentifierOrPattern();
return previousErrorCount === parseDiagnostics.length;
}
return false;
}
function isUnambiguouslyStartOfFunctionType() {
nextToken();
if (token === SyntaxKind.CloseParenToken || token === SyntaxKind.DotDotDotToken) {
@@ -2465,22 +2482,21 @@ namespace ts {
// ( ...
return true;
}
if (isIdentifier() || isModifierKind(token) || token === SyntaxKind.ThisKeyword) {
nextToken();
if (skipParameterStart()) {
// We successfully skipped modifiers (if any) and an identifier or binding pattern,
// now see if we have something that indicates a parameter declaration
if (token === SyntaxKind.ColonToken || token === SyntaxKind.CommaToken ||
token === SyntaxKind.QuestionToken || token === SyntaxKind.EqualsToken ||
isIdentifier() || isModifierKind(token)) {
// ( id :
// ( id ,
// ( id ?
// ( id =
// ( modifier id
token === SyntaxKind.QuestionToken || token === SyntaxKind.EqualsToken) {
// ( xxx :
// ( xxx ,
// ( xxx ?
// ( xxx =
return true;
}
if (token === SyntaxKind.CloseParenToken) {
nextToken();
if (token === SyntaxKind.EqualsGreaterThanToken) {
// ( id ) =>
// ( xxx ) =>
return true;
}
}
@@ -2707,7 +2723,7 @@ namespace ts {
function isYieldExpression(): boolean {
if (token === SyntaxKind.YieldKeyword) {
// If we have a 'yield' keyword, and htis is a context where yield expressions are
// If we have a 'yield' keyword, and this is a context where yield expressions are
// allowed, then definitely parse out a yield expression.
if (inYieldContext()) {
return true;
@@ -2726,7 +2742,7 @@ namespace ts {
//
// for now we just check if the next token is an identifier. More heuristics
// can be added here later as necessary. We just need to make sure that we
// don't accidently consume something legal.
// don't accidentally consume something legal.
return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine);
}
@@ -2755,7 +2771,7 @@ namespace ts {
}
else {
// if the next token is not on the same line as yield. or we don't have an '*' or
// the start of an expressin, then this is just a simple "yield" expression.
// the start of an expression, then this is just a simple "yield" expression.
return finishNode(node);
}
}
@@ -3048,7 +3064,7 @@ namespace ts {
// Check the precedence to see if we should "take" this operator
// - For left associative operator (all operator but **), consume the operator,
// recursively call the function below, and parse binaryExpression as a rightOperand
// of the caller if the new precendence of the operator is greater then or equal to the current precendence.
// of the caller if the new precedence of the operator is greater then or equal to the current precedence.
// For example:
// a - b - c;
// ^token; leftOperand = b. Return b to the caller as a rightOperand
@@ -3057,8 +3073,8 @@ namespace ts {
// a - b * c;
// ^token; leftOperand = b. Return b * c to the caller as a rightOperand
// - For right associative operator (**), consume the operator, recursively call the function
// and parse binaryExpression as a rightOperand of the caller if the new precendence of
// the operator is strictly grater than the current precendence
// and parse binaryExpression as a rightOperand of the caller if the new precedence of
// the operator is strictly grater than the current precedence
// For example:
// a ** b ** c;
// ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand
@@ -3299,7 +3315,7 @@ namespace ts {
*/
function isIncrementExpression(): boolean {
// This function is called inside parseUnaryExpression to decide
// whether to call parseSimpleUnaryExpression or call parseIncrmentExpression directly
// whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly
switch (token) {
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
@@ -3787,7 +3803,7 @@ namespace ts {
return undefined;
}
// If we have a '<', then only parse this as a arugment list if the type arguments
// If we have a '<', then only parse this as a argument list if the type arguments
// are complete and we have an open paren. if we don't, rewind and return nothing.
return typeArguments && canFollowTypeArgumentsInExpression()
? typeArguments
@@ -3964,7 +3980,7 @@ namespace ts {
shorthandDeclaration.equalsToken = equalsToken;
shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(shorthandDeclaration);
return addJSDocComment(finishNode(shorthandDeclaration));
}
else {
const propertyAssignment = <PropertyAssignment>createNode(SyntaxKind.PropertyAssignment, fullStart);
@@ -3973,7 +3989,7 @@ namespace ts {
propertyAssignment.questionToken = questionToken;
parseExpected(SyntaxKind.ColonToken);
propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
return finishNode(propertyAssignment);
return addJSDocComment(finishNode(propertyAssignment));
}
}
@@ -4780,8 +4796,8 @@ namespace ts {
// off. The grammar would look something like this:
//
// MemberVariableDeclaration[Yield]:
// AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initialiser_opt[In];
// AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initialiser_opt[In, ?Yield];
// AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initializer_opt[In];
// AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initializer_opt[In, ?Yield];
//
// The checker may still error in the static case to explicitly disallow the yield expression.
property.initializer = modifiers && modifiers.flags & NodeFlags.Static
@@ -5382,7 +5398,7 @@ namespace ts {
// ImportSpecifier:
// BindingIdentifier
// IdentifierName as BindingIdentifier
// ExportSpecififer:
// ExportSpecifier:
// IdentifierName
// IdentifierName as IdentifierName
let checkIdentifierIsKeyword = isKeyword(token) && !isIdentifier();
@@ -5731,6 +5747,9 @@ namespace ts {
function parseJSDocParameter(): ParameterDeclaration {
const parameter = <ParameterDeclaration>createNode(SyntaxKind.Parameter);
parameter.type = parseJSDocType();
if (parseOptional(SyntaxKind.EqualsToken)) {
parameter.questionToken = createNode(SyntaxKind.EqualsToken);
}
return finishNode(parameter);
}
@@ -5738,16 +5757,22 @@ namespace ts {
const result = <JSDocTypeReference>createNode(SyntaxKind.JSDocTypeReference);
result.name = parseSimplePropertyName();
while (parseOptional(SyntaxKind.DotToken)) {
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
break;
}
else {
result.name = parseQualifiedName(result.name);
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
}
else {
while (parseOptional(SyntaxKind.DotToken)) {
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
break;
}
else {
result.name = parseQualifiedName(result.name);
}
}
}
return finishNode(result);
}
@@ -6217,7 +6242,7 @@ namespace ts {
}
// Make sure we're not trying to incrementally update a source file more than once. Once
// we do an update the original source file is considered unusbale from that point onwards.
// we do an update the original source file is considered unusable from that point onwards.
//
// This is because we do incremental parsing in-place. i.e. we take nodes from the old
// tree and give them new positions and parents. From that point on, trusting the old
@@ -6348,7 +6373,7 @@ namespace ts {
// We have an element that intersects the change range in some way. It may have its
// start, or its end (or both) in the changed range. We want to adjust any part
// that intersects such that the final tree is in a consistent state. i.e. all
// chlidren have spans within the span of their parent, and all siblings are ordered
// children have spans within the span of their parent, and all siblings are ordered
// properly.
// We may need to update both the 'pos' and the 'end' of the element.
@@ -6370,7 +6395,7 @@ namespace ts {
// -------------------ZZZ-----------------
//
// In this case, any element that started in the 'X' range will keep its position.
// However any element htat started after that will have their pos adjusted to be
// However any element that started after that will have their pos adjusted to be
// at the end of the new range. i.e. any node that started in the 'Y' range will
// be adjusted to have their start at the end of the 'Z' range.
//
@@ -6395,7 +6420,7 @@ namespace ts {
// -------------------ZZZ-----------------
//
// In this case, any element that ended in the 'X' range will keep its position.
// However any element htat ended after that will have their pos adjusted to be
// However any element that ended after that will have their pos adjusted to be
// at the end of the new range. i.e. any node that ended in the 'Y' range will
// be adjusted to have their end at the end of the 'Z' range.
if (element.end >= changeRangeOldEnd) {
@@ -6725,7 +6750,7 @@ namespace ts {
// Position was within this node. Keep searching deeper to find the node.
forEachChild(node, visitNode, visitArray);
// don't procede any futher in the search.
// don't proceed any further in the search.
return true;
}
+33 -24
View File
@@ -100,7 +100,7 @@ namespace ts {
let moduleResolution = compilerOptions.moduleResolution;
if (moduleResolution === undefined) {
moduleResolution = compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
if (traceEnabled) {
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
}
@@ -141,7 +141,7 @@ namespace ts {
* 'typings' entry or file 'index' with some supported extension
* - Classic loader will only try to interpret '/a/b/c' as file.
*/
type ResolutionKindSpecificLoader = (candidate: string, extensions: string[], failedLookupLocations: string[], onlyRecordFalures: boolean, state: ModuleResolutionState) => string;
type ResolutionKindSpecificLoader = (candidate: string, extensions: string[], failedLookupLocations: string[], onlyRecordFailures: boolean, state: ModuleResolutionState) => string;
/**
* Any module resolution kind can be augmented with optional settings: 'baseUrl', 'paths' and 'rootDirs' - they are used to
@@ -151,7 +151,7 @@ namespace ts {
* fallback to standard resolution routine.
*
* - baseUrl - this setting controls how non-relative module names are resolved. If this setting is specified then non-relative
* names will be resolved relative to baseUrl: i.e. if baseUrl is '/a/b' then canditate location to resolve module name 'c/d' will
* names will be resolved relative to baseUrl: i.e. if baseUrl is '/a/b' then candidate location to resolve module name 'c/d' will
* be '/a/b/c/d'
* - paths - this setting can only be used when baseUrl is specified. allows to tune how non-relative module names
* will be resolved based on the content of the module name.
@@ -169,7 +169,7 @@ namespace ts {
* If module name can be matches with multiple patterns then pattern with the longest prefix will be picked.
* After selecting pattern we'll use list of substitutions to get candidate locations of the module and the try to load module
* from the candidate location.
* Substitiution is a string that can contain zero or one '*'. To get candidate location from substitution we'll pick every
* Substitution is a string that can contain zero or one '*'. To get candidate location from substitution we'll pick every
* substitution in the list and replace '*' with <MatchedStar> string. If candidate location is not rooted it
* will be converted to absolute using baseUrl.
* For example:
@@ -197,10 +197,10 @@ namespace ts {
* 'rootDirs' provides the way to tell compiler that in order to get the whole project it should behave as if content of all
* root dirs were merged together.
* I.e. for the example above 'rootDirs' will have two entries: [ '/local/src', '/shared/components/contracts/src' ].
* Compiler wil first convert './protocols/file2' into absolute path relative to the location of containing file:
* Compiler will first convert './protocols/file2' into absolute path relative to the location of containing file:
* '/local/src/content/protocols/file2' and try to load it - failure.
* Then it will search 'rootDirs' looking for a longest matching prefix of this absolute path and if such prefix is found - absolute path will
* be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remainining
* be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remaining
* entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location.
*/
function tryLoadModuleUsingOptionalResolutionSettings(moduleName: string, containingDirectory: string, loader: ResolutionKindSpecificLoader,
@@ -232,7 +232,7 @@ namespace ts {
for (const rootDir of state.compilerOptions.rootDirs) {
// rootDirs are expected to be absolute
// in case of tsconfig.json this will happen automatically - compiler will expand relative names
// using locaton of tsconfig.json as base location
// using location of tsconfig.json as base location
let normalizedRoot = normalizePath(rootDir);
if (!endsWith(normalizedRoot, directorySeparator)) {
normalizedRoot += directorySeparator;
@@ -329,7 +329,7 @@ namespace ts {
}
}
else if (pattern === moduleName) {
// pattern was matched as is - no need to seatch further
// pattern was matched as is - no need to search further
matchedPattern = pattern;
matchedStar = undefined;
break;
@@ -533,18 +533,25 @@ namespace ts {
}
let referencedSourceFile: string;
while (true) {
const searchName = normalizePath(combinePaths(containingDirectory, moduleName));
referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
if (referencedSourceFile) {
break;
if (moduleHasNonRelativeName(moduleName)) {
while (true) {
const searchName = normalizePath(combinePaths(containingDirectory, moduleName));
referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
if (referencedSourceFile) {
break;
}
const parentPath = getDirectoryPath(containingDirectory);
if (parentPath === containingDirectory) {
break;
}
containingDirectory = parentPath;
}
const parentPath = getDirectoryPath(containingDirectory);
if (parentPath === containingDirectory) {
break;
}
containingDirectory = parentPath;
}
else {
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
}
return referencedSourceFile
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations }
@@ -1025,7 +1032,7 @@ namespace ts {
// We were canceled while performing the operation. Because our type checker
// might be a bad state, we need to throw it away.
//
// Note: we are overly agressive here. We do not actually *have* to throw away
// Note: we are overly aggressive here. We do not actually *have* to throw away
// the "noDiagnosticsTypeChecker". However, for simplicity, i'd like to keep
// the lifetimes of these two TypeCheckers the same. Also, we generally only
// cancel when the user has made a change anyways. And, in that case, we (the
@@ -1169,7 +1176,9 @@ namespace ts {
diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return true;
case SyntaxKind.Decorator:
diagnostics.push(createDiagnosticForNode(node, Diagnostics.decorators_can_only_be_used_in_a_ts_file));
if (!options.experimentalDecorators) {
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
}
return true;
}
@@ -1477,7 +1486,7 @@ namespace ts {
const resolution = resolutions[i];
setResolvedModule(file, moduleNames[i], resolution);
// add file to program only if:
// - resolution was successfull
// - resolution was successful
// - noResolve is falsy
// - module name come from the list fo imports
const shouldAddFile = resolution &&
@@ -1652,7 +1661,7 @@ namespace ts {
const firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
if (options.isolatedModules) {
if (!options.module && languageVersion < ScriptTarget.ES6) {
if (options.module === ModuleKind.None && languageVersion < ScriptTarget.ES6) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));
}
@@ -1662,10 +1671,10 @@ namespace ts {
programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && options.module === ModuleKind.None) {
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
const span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file));
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file));
}
// Cannot specify module gen target of es6 when below es6
+2 -2
View File
@@ -511,7 +511,7 @@ namespace ts {
}
// All conflict markers consist of the same character repeated seven times. If it is
// a <<<<<<< or >>>>>>> marker then it is also followd by a space.
// a <<<<<<< or >>>>>>> marker then it is also followed by a space.
const mergeConflictMarkerLength = "<<<<<<<".length;
function isConflictMarkerTrivia(text: string, pos: number) {
@@ -551,7 +551,7 @@ namespace ts {
}
else {
Debug.assert(ch === CharacterCodes.equals);
// Consume everything from the start of the mid-conlict marker to the start of the next
// Consume everything from the start of the mid-conflict marker to the start of the next
// end-conflict marker.
while (pos < len) {
const ch = text.charCodeAt(pos);
+13 -9
View File
@@ -16,6 +16,14 @@ namespace ts {
}
let nullSourceMapWriter: SourceMapWriter;
// Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans
const defaultLastEncodedSourceMapSpan: SourceMapSpan = {
emittedLine: 1,
emittedColumn: 1,
sourceLine: 1,
sourceColumn: 1,
sourceIndex: 0
};
export function getNullSourceMapWriter(): SourceMapWriter {
if (nullSourceMapWriter === undefined) {
@@ -79,13 +87,7 @@ namespace ts {
// Last recorded and encoded spans
lastRecordedSourceMapSpan = undefined;
lastEncodedSourceMapSpan = {
emittedLine: 1,
emittedColumn: 1,
sourceLine: 1,
sourceColumn: 1,
sourceIndex: 0
};
lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;
lastEncodedNameIndex = 0;
// Initialize source map data
@@ -159,10 +161,12 @@ namespace ts {
// Pop sourceMapDecodedMappings to remove last entry
sourceMapData.sourceMapDecodedMappings.pop();
// Change the last encoded source map
// Point the lastEncodedSourceMapSpace to the previous encoded sourceMapSpan
// If the list is empty which indicates that we are at the beginning of the file,
// we have to reset it to default value (same value when we first initialize sourceMapWriter)
lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ?
sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] :
undefined;
defaultLastEncodedSourceMapSpan;
// TODO: Update lastEncodedNameIndex
// Since we dont support this any more, lets not worry about it right now.
+32 -9
View File
@@ -378,7 +378,8 @@ namespace ts {
const filePath = typeof relativeFileName !== "string"
? undefined
: toPath(relativeFileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
if (eventName === "change" && fileWatcherCallbacks.contains(filePath)) {
// Some applications save a working file via rename operations
if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks.contains(filePath)) {
for (const fileCallback of fileWatcherCallbacks.get(filePath)) {
fileCallback(filePath);
}
@@ -411,7 +412,7 @@ namespace ts {
const useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";
function readFile(fileName: string, encoding?: string): string {
if (!_fs.existsSync(fileName)) {
if (!fileExists(fileName)) {
return undefined;
}
const buffer = _fs.readFileSync(fileName);
@@ -462,6 +463,32 @@ namespace ts {
return useCaseSensitiveFileNames ? path : path.toLowerCase();
}
const enum FileSystemEntryKind {
File,
Directory
}
function fileSystemEntryExists(path: string, entryKind: FileSystemEntryKind): boolean {
try {
const stat = _fs.statSync(path);
switch (entryKind) {
case FileSystemEntryKind.File: return stat.isFile();
case FileSystemEntryKind.Directory: return stat.isDirectory();
}
}
catch (e) {
return false;
}
}
function fileExists(path: string): boolean {
return fileSystemEntryExists(path, FileSystemEntryKind.File);
}
function directoryExists(path: string): boolean {
return fileSystemEntryExists(path, FileSystemEntryKind.Directory);
}
function readDirectory(path: string, extension?: string, exclude?: string[]): string[] {
const result: string[] = [];
exclude = map(exclude, s => getCanonicalPath(combinePaths(path, s)));
@@ -500,7 +527,7 @@ namespace ts {
readFile,
writeFile,
watchFile: (filePath, callback) => {
// Node 4.0 stablized the `fs.watch` function on Windows which avoids polling
// Node 4.0 stabilized the `fs.watch` function on Windows which avoids polling
// and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649
// and https://github.com/Microsoft/TypeScript/issues/4643), therefore
// if the current node.js version is newer than 4, use `fs.watch` instead.
@@ -538,12 +565,8 @@ namespace ts {
resolvePath: function (path: string): string {
return _path.resolve(path);
},
fileExists(path: string): boolean {
return _fs.existsSync(path);
},
directoryExists(path: string) {
return _fs.existsSync(path) && _fs.statSync(path).isDirectory();
},
fileExists,
directoryExists,
createDirectory(directoryName: string) {
if (!this.directoryExists(directoryName)) {
_fs.mkdirSync(directoryName);
+6 -6
View File
@@ -115,7 +115,7 @@ namespace ts {
const gutterStyleSequence = "\u001b[100;30m";
const gutterSeparator = " ";
const resetEscapeSequence = "\u001b[0m";
const elipsis = "...";
const ellipsis = "...";
const categoryFormatMap: Map<string> = {
[DiagnosticCategory.Warning]: yellowForegroundEscapeSequence,
[DiagnosticCategory.Error]: redForegroundEscapeSequence,
@@ -139,7 +139,7 @@ namespace ts {
const hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
let gutterWidth = (lastLine + 1 + "").length;
if (hasMoreThanFiveLines) {
gutterWidth = Math.max(elipsis.length, gutterWidth);
gutterWidth = Math.max(ellipsis.length, gutterWidth);
}
output += sys.newLine;
@@ -147,7 +147,7 @@ namespace ts {
// If the error spans over 5 lines, we'll only show the first 2 and last 2 lines,
// so we'll skip ahead to the second-to-last line.
if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
output += formatAndReset(padLeft(elipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + sys.newLine;
output += formatAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + sys.newLine;
i = lastLine - 1;
}
@@ -341,7 +341,7 @@ namespace ts {
const directory = ts.getDirectoryPath(configFileName);
directoryWatcher = sys.watchDirectory(
// When the configFileName is just "tsconfig.json", the watched directory should be
// the current direcotry; if there is a given "project" parameter, then the configFileName
// the current directory; if there is a given "project" parameter, then the configFileName
// is an absolute file name.
directory == "" ? "." : directory,
watchedDirectoryChanged, /*recursive*/ true);
@@ -376,7 +376,7 @@ namespace ts {
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
return;
}
const configParseResult = parseJsonConfigFileContent(configObject, sys, getNormalizedAbsolutePath(getDirectoryPath(configFileName), sys.getCurrentDirectory()), commandLine.options);
const configParseResult = parseJsonConfigFileContent(configObject, sys, getNormalizedAbsolutePath(getDirectoryPath(configFileName), sys.getCurrentDirectory()), commandLine.options, configFileName);
if (configParseResult.errors.length > 0) {
reportDiagnostics(configParseResult.errors, /* compilerHost */ undefined);
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
@@ -486,7 +486,7 @@ namespace ts {
}
function watchedDirectoryChanged(fileName: string) {
if (fileName && !ts.isSupportedSourceFileName(fileName, commandLine.options)) {
if (fileName && !ts.isSupportedSourceFileName(fileName, compilerOptions)) {
return;
}
+1 -2
View File
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
@@ -8,9 +7,9 @@
"sourceMap": true
},
"files": [
"types.ts",
"core.ts",
"sys.ts",
"types.ts",
"diagnosticInformationMap.generated.ts",
"scanner.ts",
"parser.ts",
+24 -27
View File
@@ -422,15 +422,10 @@ namespace ts {
IntrinsicNamedElement = 1 << 0,
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
IntrinsicIndexedElement = 1 << 1,
/** An element backed by a class, class-like, or function value */
ValueElement = 1 << 2,
/** Element resolution failed */
UnknownElement = 1 << 4,
IntrinsicElement = IntrinsicNamedElement | IntrinsicIndexedElement,
}
/* @internal */
export const enum RelationComparisonResult {
Succeeded = 1, // Should be truthy
@@ -1559,7 +1554,7 @@ namespace ts {
/* @internal */ classifiableNames?: Map<string>;
// Stores a mapping 'external module reference text' -> 'resolved file name' | undefined
// It is used to resolve module names in the checker.
// Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
// Content of this field should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
/* @internal */ resolvedModules: Map<ResolvedModule>;
/* @internal */ imports: LiteralExpression[];
/* @internal */ moduleAugmentations: LiteralExpression[];
@@ -1753,7 +1748,8 @@ namespace ts {
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void;
buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
@@ -1818,22 +1814,24 @@ namespace ts {
Identifier
}
export interface TypePredicate {
export interface TypePredicateBase {
kind: TypePredicateKind;
type: Type;
}
// @kind (TypePredicateKind.This)
export interface ThisTypePredicate extends TypePredicate {
export interface ThisTypePredicate extends TypePredicateBase {
_thisTypePredicateBrand: any;
}
// @kind (TypePredicateKind.Identifier)
export interface IdentifierTypePredicate extends TypePredicate {
export interface IdentifierTypePredicate extends TypePredicateBase {
parameterName: string;
parameterIndex: number;
}
export type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
/* @internal */
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
@@ -1846,7 +1844,7 @@ namespace ts {
}
/* @internal */
export interface SymbolAccessiblityResult extends SymbolVisibilityResult {
export interface SymbolAccessibilityResult extends SymbolVisibilityResult {
errorModuleName?: string; // If the symbol is not visible from module, module's name
}
@@ -1888,7 +1886,7 @@ namespace ts {
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult;
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
@@ -2013,7 +2011,7 @@ namespace ts {
containingType?: UnionOrIntersectionType; // Containing union or intersection type for synthetic property
resolvedExports?: SymbolTable; // Resolved exports of module
exportsChecked?: boolean; // True if exports of external module have been checked
isDeclaratonWithCollidingName?: boolean; // True if symbol is block scoped redeclaration
isDeclarationWithCollidingName?: boolean; // True if symbol is block scoped redeclaration
bindingElement?: BindingElement; // Binding element associated with property symbol
exportsSomeValue?: boolean; // true if module exports some value (not just types)
}
@@ -2041,9 +2039,9 @@ namespace ts {
LoopWithCapturedBlockScopedBinding = 0x00010000, // Loop that contains block scoped variable captured in closure
CapturedBlockScopedBinding = 0x00020000, // Block-scoped binding that is captured in some function
BlockScopedBindingInLoop = 0x00040000, // Block-scoped binding with declaration nested inside iteration statement
HasSeenSuperCall = 0x00080000, // Set during the binding when encounter 'super'
ClassWithBodyScopedClassBinding = 0x00100000, // Decorated class that contains a binding to itself inside of the class body.
BodyScopedClassBinding = 0x00200000, // Binding to a decorated class inside of the class's body.
ClassWithBodyScopedClassBinding = 0x00080000, // Decorated class that contains a binding to itself inside of the class body.
BodyScopedClassBinding = 0x00100000, // Binding to a decorated class inside of the class's body.
NeedsLoopOutParameter = 0x00200000, // Block scoped binding whose value should be explicitly copied outside of the converted loop
}
/* @internal */
@@ -2061,8 +2059,10 @@ namespace ts {
assignmentChecks?: Map<boolean>; // Cache of assignment checks
hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context
importOnRightSide?: Symbol; // for import declarations - import that appear on the right side
jsxFlags?: JsxFlags; // flags for knowning what kind of element/attributes we're dealing with
jsxFlags?: JsxFlags; // flags for knowing what kind of element/attributes we're dealing with
resolvedJsxType?: Type; // resolved element attributes type of a JSX openinglike element
hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt.
superCall?: ExpressionStatement; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
}
export const enum TypeFlags {
@@ -2098,7 +2098,6 @@ namespace ts {
ESSymbol = 0x01000000, // Type of symbol primitive introduced in ES6
ThisType = 0x02000000, // This type
ObjectLiteralPatternWithComputedProperties = 0x04000000, // Object literal type implied by binding pattern has computed properties
PredicateType = 0x08000000, // Predicate types are also Boolean types, but should not be considered Intrinsics - there's no way to capture this with flags
/* @internal */
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null,
@@ -2110,7 +2109,7 @@ namespace ts {
UnionOrIntersection = Union | Intersection,
StructuredType = ObjectType | Union | Intersection,
/* @internal */
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral | PredicateType,
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral,
/* @internal */
PropagatingFlags = ContainsUndefinedOrNull | ContainsObjectLiteral | ContainsAnyFunctionType
}
@@ -2131,11 +2130,6 @@ namespace ts {
intrinsicName: string; // Name of intrinsic type
}
// Predicate types (TypeFlags.Predicate)
export interface PredicateType extends Type {
predicate: ThisTypePredicate | IdentifierTypePredicate;
}
// String literal types (TypeFlags.StringLiteral)
export interface StringLiteralType extends Type {
text: string; // Text of string literal
@@ -2166,7 +2160,7 @@ namespace ts {
// Type references (TypeFlags.Reference). When a class or interface has type parameters or
// a "this" type, references to the class or interface are made using type references. The
// typeArguments property specififes the types to substitute for the type parameters of the
// typeArguments property specifies the types to substitute for the type parameters of the
// class or interface and optionally includes an extra element that specifies the type to
// substitute for "this" in the resulting instantiation. When no extra argument is present,
// the type reference itself is substituted for "this". The typeArguments property is undefined
@@ -2271,6 +2265,8 @@ namespace ts {
erasedSignatureCache?: Signature; // Erased version of signature (deferred)
/* @internal */
isolatedSignatureType?: ObjectType; // A manufactured type that just contains the signature for purposes of signature comparison
/* @internal */
typePredicate?: TypePredicate;
}
export const enum IndexKind {
@@ -2424,6 +2420,7 @@ namespace ts {
traceModuleResolution?: boolean;
allowSyntheticDefaultImports?: boolean;
allowJs?: boolean;
noImplicitUseStrict?: boolean;
/* @internal */ stripInternal?: boolean;
// Skip checking lib.d.ts to help speed up tests.
@@ -2694,7 +2691,7 @@ namespace ts {
/*
* CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of
* module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler
* will appply built-in module resolution logic and use members of ModuleResolutionHost to ask host specific questions).
* will apply built-in module resolution logic and use members of ModuleResolutionHost to ask host specific questions).
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
* 'throw new Error("NotImplemented")'
*/
@@ -2720,7 +2717,7 @@ namespace ts {
getGlobalDiagnostics(): Diagnostic[];
// If fileName is provided, gets all the diagnostics associated with that file name.
// Otherwise, returns all the diagnostics (global and file associated) in this colletion.
// Otherwise, returns all the diagnostics (global and file associated) in this collection.
getDiagnostics(fileName?: string): Diagnostic[];
// Gets a count of how many times this collection has been modified. This value changes
+45 -15
View File
@@ -137,7 +137,7 @@ namespace ts {
node.flags |= NodeFlags.ThisNodeOrAnySubNodesHasError;
}
// Also mark that we've propogated the child information to this node. This way we can
// Also mark that we've propagated the child information to this node. This way we can
// always consult the bit directly on this node without needing to check its children
// again.
node.flags |= NodeFlags.HasAggregatedChildData;
@@ -387,6 +387,8 @@ namespace ts {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.TypeAliasDeclaration:
errorNode = (<Declaration>node).name;
break;
@@ -464,6 +466,10 @@ namespace ts {
return !!(getCombinedNodeFlags(node) & NodeFlags.Let);
}
export function isSuperCallExpression(n: Node): boolean {
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
}
export function isPrologueDirective(node: Node): boolean {
return node.kind === SyntaxKind.ExpressionStatement && (<ExpressionStatement>node).expression.kind === SyntaxKind.StringLiteral;
}
@@ -742,6 +748,10 @@ namespace ts {
return predicate && predicate.kind === TypePredicateKind.Identifier;
}
export function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate {
return predicate && predicate.kind === TypePredicateKind.This;
}
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
while (true) {
node = node.parent;
@@ -1212,13 +1222,19 @@ namespace ts {
}
// Also recognize when the node is the RHS of an assignment expression
const parent = node.parent;
const isSourceOfAssignmentExpressionStatement =
node.parent && node.parent.parent &&
node.parent.kind === SyntaxKind.BinaryExpression &&
(node.parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken &&
node.parent.parent.kind === SyntaxKind.ExpressionStatement;
parent && parent.parent &&
parent.kind === SyntaxKind.BinaryExpression &&
(parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken &&
parent.parent.kind === SyntaxKind.ExpressionStatement;
if (isSourceOfAssignmentExpressionStatement) {
return node.parent.parent.jsDocComment;
return parent.parent.jsDocComment;
}
const isPropertyAssignmentExpression = parent && parent.kind === SyntaxKind.PropertyAssignment;
if (isPropertyAssignmentExpression) {
return parent.jsDocComment;
}
}
@@ -2001,9 +2017,9 @@ namespace ts {
}
export function getEmitModuleKind(compilerOptions: CompilerOptions) {
return compilerOptions.module ?
return typeof compilerOptions.module === "number" ?
compilerOptions.module :
getEmitScriptTarget(compilerOptions) === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None;
getEmitScriptTarget(compilerOptions) === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.CommonJS;
}
export interface EmitFileNames {
@@ -2030,8 +2046,22 @@ namespace ts {
}
function onSingleFileEmit(host: EmitHost, sourceFile: SourceFile) {
const jsFilePath = getOwnEmitOutputFilePath(sourceFile, host,
sourceFile.languageVariant === LanguageVariant.JSX && options.jsx === JsxEmit.Preserve ? ".jsx" : ".js");
// JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
// So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.
// For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve
let extension = ".js";
if (options.jsx === JsxEmit.Preserve) {
if (isSourceFileJavaScript(sourceFile)) {
if (fileExtensionIs(sourceFile.fileName, ".jsx")) {
extension = ".jsx";
}
}
else if (sourceFile.languageVariant === LanguageVariant.JSX) {
// TypeScript source file preserving JSX syntax
extension = ".jsx";
}
}
const jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);
const emitFileNames: EmitFileNames = {
jsFilePath,
sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),
@@ -2562,7 +2592,7 @@ namespace ts {
byte4 = 64;
}
// Write to the ouput
// Write to the output
result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
i += 3;
@@ -2757,9 +2787,9 @@ namespace ts {
// . | \
// ----------------------------------------------------------------------*--------------------------------
//
// (Note the dots represent the newly inferrred start.
// (Note the dots represent the newly inferred start.
// Determining the new and old end is also pretty simple. Basically it boils down to paying attention to the
// absolute positions at the asterixes, and the relative change between the dollar signs. Basically, we see
// absolute positions at the asterisks, and the relative change between the dollar signs. Basically, we see
// which if the two $'s precedes the other, and we move that one forward until they line up. in this case that
// means:
//
@@ -2782,8 +2812,8 @@ namespace ts {
// ended with a delta of 20 characters (60 - 40). Thus, if we go back in time to where the first edit started
// that's the same as if we started at char 80 instead of 60.
//
// As it so happens, the same logic applies if the second edit precedes the first edit. In that case rahter
// than pusing the first edit forward to match the second, we'll push the second edit forward to match the
// As it so happens, the same logic applies if the second edit precedes the first edit. In that case rather
// than pushing the first edit forward to match the second, we'll push the second edit forward to match the
// first.
//
// In this case that means we have { oldStart: 10, oldEnd: 80, newEnd: 70 } or, in TextChangeRange
+3 -3
View File
@@ -746,7 +746,7 @@ namespace Harness {
namespace Harness {
export const libFolder = "built/local/";
const tcServicesFileName = ts.combinePaths(libFolder, "typescriptServices.js");
const tcServicesFileName = ts.combinePaths(libFolder, Utils.getExecutionEnvironment() === Utils.ExecutionEnvironment.Browser ? "typescriptServicesInBrowserTest.js" : "typescriptServices.js");
export const tcServicesFile = IO.readFile(tcServicesFileName);
export interface SourceMapEmitterCallback {
@@ -895,7 +895,8 @@ namespace Harness {
{ name: "includeBuiltFile", type: "string" },
{ name: "fileName", type: "string" },
{ name: "libFiles", type: "string" },
{ name: "noErrorTruncation", type: "boolean" }
{ name: "noErrorTruncation", type: "boolean" },
{ name: "suppressOutputPathCheck", type: "boolean" }
];
let optionsIndex: ts.Map<ts.CommandLineOption>;
@@ -965,7 +966,6 @@ namespace Harness {
const options: ts.CompilerOptions & HarnessOptions = compilerOptions ? ts.clone(compilerOptions) : { noResolve: false };
options.target = options.target || ts.ScriptTarget.ES3;
options.module = options.module || ts.ModuleKind.None;
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
options.noErrorTruncation = true;
options.skipDefaultLibCheck = true;
+12 -1
View File
@@ -223,7 +223,18 @@ namespace Playback {
recordLog.directoriesRead.push(logEntry);
return result;
},
(path, extension, exclude) => findResultByPath(wrapper, replayLog.directoriesRead.filter(d => d.extension === extension && ts.arrayIsEqualTo(d.exclude, exclude)), path));
(path, extension, exclude) => findResultByPath(wrapper,
replayLog.directoriesRead.filter(
d => {
if (d.extension === extension) {
if (d.exclude) {
return ts.arrayIsEqualTo(d.exclude, exclude);
}
return true;
}
return false;
}
), path));
wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)(
(path: string, contents: string) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path, contents, bom: false }),
+1 -6
View File
@@ -1116,12 +1116,7 @@ interface Array<T> {
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat<U extends T[]>(...items: U[]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: T[]): T[];
concat(...items: (T | T[])[]): T[];
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
-1
View File
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
+28 -20
View File
@@ -502,7 +502,7 @@ namespace ts {
spacesToRemoveAfterAsterisk = 0;
}
// Analyse text on this line
// Analyze text on this line
while (pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) {
const ch = sourceFile.text.charAt(pos);
if (ch === "@") {
@@ -641,7 +641,7 @@ namespace ts {
paramHelpStringMargin = undefined;
}
// If this is the start of another tag, continue with the loop in seach of param tag with symbol name
// If this is the start of another tag, continue with the loop in search of param tag with symbol name
if (sourceFile.text.charCodeAt(pos) === CharacterCodes.at) {
continue;
}
@@ -1714,7 +1714,6 @@ namespace ts {
// Always default to "ScriptTarget.ES5" for the language service
return {
target: ScriptTarget.ES5,
module: ModuleKind.None,
jsx: JsxEmit.Preserve
};
}
@@ -2823,7 +2822,7 @@ namespace ts {
}
// Check if the language version has changed since we last created a program; if they are the same,
// it is safe to reuse the souceFiles; if not, then the shape of the AST can change, and the oldSourceFile
// it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile
// can not be reused. we have to dump all syntax trees and create new ones.
if (!changesInCompilationSettingsAffectSyntax) {
// Check if the old program had this file already
@@ -2917,7 +2916,7 @@ namespace ts {
}
/**
* getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors
* getSemanticDiagnostics return array of Diagnostics. If '-d' is not enabled, only report semantic errors
* If '-d' enabled, report both semantic and emitter errors
*/
function getSemanticDiagnostics(fileName: string): Diagnostic[] {
@@ -3726,7 +3725,7 @@ namespace ts {
* do not occur at the current position and have not otherwise been typed.
*/
function filterNamedImportOrExportCompletionItems(exportsOfModule: Symbol[], namedImportsOrExports: ImportOrExportSpecifier[]): Symbol[] {
const exisingImportsOrExports: Map<boolean> = {};
const existingImportsOrExports: Map<boolean> = {};
for (const element of namedImportsOrExports) {
// If this is the current item we are editing right now, do not filter it out
@@ -3735,14 +3734,14 @@ namespace ts {
}
const name = element.propertyName || element.name;
exisingImportsOrExports[name.text] = true;
existingImportsOrExports[name.text] = true;
}
if (isEmpty(exisingImportsOrExports)) {
if (isEmpty(existingImportsOrExports)) {
return exportsOfModule;
}
return filter(exportsOfModule, e => !lookUp(exisingImportsOrExports, e.name));
return filter(exportsOfModule, e => !lookUp(existingImportsOrExports, e.name));
}
/**
@@ -3824,7 +3823,7 @@ namespace ts {
return undefined;
}
const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot, isJsDocTagName } = completionData;
const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isJsDocTagName } = completionData;
if (isJsDocTagName) {
// If the current position is a jsDoc tag name, only tag names should be provided for completion
@@ -3835,7 +3834,7 @@ namespace ts {
const entries: CompletionEntry[] = [];
if (isRightOfDot && isSourceFileJavaScript(sourceFile)) {
if (isSourceFileJavaScript(sourceFile)) {
const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries);
addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
}
@@ -4652,7 +4651,16 @@ namespace ts {
// to jump to the implementation directly.
if (symbol.flags & SymbolFlags.Alias) {
const declaration = symbol.declarations[0];
if (node.kind === SyntaxKind.Identifier && node.parent === declaration) {
// Go to the original declaration for cases:
//
// (1) when the aliased symbol was declared in the location(parent).
// (2) when the aliased symbol is originating from a named import.
//
if (node.kind === SyntaxKind.Identifier &&
(node.parent === declaration ||
(declaration.kind === SyntaxKind.ImportSpecifier && declaration.parent && declaration.parent.kind === SyntaxKind.NamedImports))) {
symbol = typeChecker.getAliasedSymbol(symbol);
}
}
@@ -5578,7 +5586,7 @@ namespace ts {
}
// 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.
// So consider it visible outside its declaration scope.
if (symbol.flags & SymbolFlags.Alias) {
return undefined;
}
@@ -5978,12 +5986,12 @@ namespace ts {
// The search set contains at least the current symbol
let result = [symbol];
// If the symbol is an alias, add what it alaises to the list
// If the symbol is an alias, add what it aliases to the list
if (isImportSpecifierSymbol(symbol)) {
result.push(typeChecker.getAliasedSymbol(symbol));
}
// For export specifiers, the exported name can be refering to a local symbol, e.g.:
// For export specifiers, the exported name can be referring to a local symbol, e.g.:
// import {a} from "mod";
// export {a as somethingElse}
// We want the *local* declaration of 'a' as declared in the import,
@@ -6019,7 +6027,7 @@ namespace ts {
// If the symbol.valueDeclaration is a property parameter declaration,
// we should include both parameter declaration symbol and property declaration symbol
// Parameter Declaration symbol is only visible within function scope, so the symbol is stored in contructor.locals.
// Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals.
// Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members
if (symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.Parameter &&
isParameterPropertyDeclaration(<ParameterDeclaration>symbol.valueDeclaration)) {
@@ -6045,9 +6053,9 @@ namespace ts {
/**
* Find symbol of the given property-name and add the symbol to the given result array
* @param symbol a symbol to start searching for the given propertyName
* @param propertyName a name of property to serach for
* @param propertyName a name of property to search for
* @param result an array of symbol of found property symbols
* @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisitng of the same symbol.
* @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol.
* The value of previousIterationSymbol is undefined when the function is first called.
*/
function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[],
@@ -7390,12 +7398,12 @@ namespace ts {
// comment portion.
const singleLineCommentStart = /(?:\/\/+\s*)/.source;
const multiLineCommentStart = /(?:\/\*+\s*)/.source;
const anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
// Match any of the above three TODO comment start regexps.
// Note that the outermost group *is* a capture group. We want to capture the preamble
// so that we can determine the starting position of the TODO comment match.
const preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
// Takes the descriptors and forms a regexp that matches them as if they were literals.
// For example, if the descriptors are "TODO(jason)" and "HACK", then this will be:
-1
View File
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
@@ -1,12 +1,9 @@
tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'.
==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ====
==== tests/cases/compiler/ExportAssignment7.ts (2 errors) ====
export class C {
~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
}
export = B;
@@ -1,13 +1,10 @@
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'.
==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ====
==== tests/cases/compiler/ExportAssignment8.ts (2 errors) ====
export = B;
~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
~
!!! error TS2304: Cannot find name 'B'.
@@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element.
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (1 errors) ====
protected class C {
~~~~~~~~~
!!! error TS1044: 'protected' modifier cannot appear on a module element.
!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element.
}
@@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element.
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (1 errors) ====
protected module M {
~~~~~~~~~
!!! error TS1044: 'protected' modifier cannot appear on a module element.
!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element.
}
@@ -1,13 +1,10 @@
tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'.
==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ====
==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (0 errors) ====
export module A {
~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
export interface Point {
x: number;
y: number;
@@ -1,28 +0,0 @@
tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
==== tests/cases/conformance/ambient/consumer.ts (1 errors) ====
/// <reference path="decls.ts" />
import imp1 = require('equ');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
import imp3 = require('equ2');
var n = imp3.x;
var n: number;
==== tests/cases/conformance/ambient/decls.ts (0 errors) ====
// Ambient external module with export assignment
declare module 'equ' {
var x;
export = x;
}
declare module 'equ2' {
var x: number;
}
// Ambient external import declaration referencing ambient external module using top level module name
@@ -0,0 +1,36 @@
=== tests/cases/conformance/ambient/consumer.ts ===
/// <reference path="decls.ts" />
import imp1 = require('equ');
>imp1 : Symbol(imp1, Decl(consumer.ts, 0, 0))
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
import imp3 = require('equ2');
>imp3 : Symbol(imp3, Decl(consumer.ts, 1, 29))
var n = imp3.x;
>n : Symbol(n, Decl(consumer.ts, 6, 3), Decl(consumer.ts, 7, 3))
>imp3.x : Symbol(imp3.x, Decl(decls.ts, 8, 7))
>imp3 : Symbol(imp3, Decl(consumer.ts, 1, 29))
>x : Symbol(imp3.x, Decl(decls.ts, 8, 7))
var n: number;
>n : Symbol(n, Decl(consumer.ts, 6, 3), Decl(consumer.ts, 7, 3))
=== tests/cases/conformance/ambient/decls.ts ===
// Ambient external module with export assignment
declare module 'equ' {
var x;
>x : Symbol(x, Decl(decls.ts, 3, 7))
export = x;
>x : Symbol(x, Decl(decls.ts, 3, 7))
}
declare module 'equ2' {
var x: number;
>x : Symbol(x, Decl(decls.ts, 8, 7))
}
// Ambient external import declaration referencing ambient external module using top level module name
@@ -0,0 +1,36 @@
=== tests/cases/conformance/ambient/consumer.ts ===
/// <reference path="decls.ts" />
import imp1 = require('equ');
>imp1 : any
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
import imp3 = require('equ2');
>imp3 : typeof imp3
var n = imp3.x;
>n : number
>imp3.x : number
>imp3 : typeof imp3
>x : number
var n: number;
>n : number
=== tests/cases/conformance/ambient/decls.ts ===
// Ambient external module with export assignment
declare module 'equ' {
var x;
>x : any
export = x;
>x : any
}
declare module 'equ2' {
var x: number;
>x : number
}
// Ambient external import declaration referencing ambient external module using top level module name
@@ -4,7 +4,7 @@ var obj: Object;
>Object : Object
if (ArrayBuffer.isView(obj)) {
>ArrayBuffer.isView(obj) : arg is ArrayBufferView
>ArrayBuffer.isView(obj) : boolean
>ArrayBuffer.isView : (arg: any) => arg is ArrayBufferView
>ArrayBuffer : ArrayBufferConstructor
>isView : (arg: any) => arg is ArrayBufferView
@@ -3,21 +3,21 @@ var a: string[] = [];
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
a.concat("hello", 'world');
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
a.concat('Hello');
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
var b = new Array<string>();
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
b.concat('hello');
>b.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>b.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
+6 -6
View File
@@ -5,17 +5,17 @@ var a: string[] = [];
a.concat("hello", 'world');
>a.concat("hello", 'world') : string[]
>a.concat : { <U extends string[]>(...items: U[]): string[]; (...items: string[]): string[]; }
>a.concat : (...items: (string | string[])[]) => string[]
>a : string[]
>concat : { <U extends string[]>(...items: U[]): string[]; (...items: string[]): string[]; }
>concat : (...items: (string | string[])[]) => string[]
>"hello" : string
>'world' : string
a.concat('Hello');
>a.concat('Hello') : string[]
>a.concat : { <U extends string[]>(...items: U[]): string[]; (...items: string[]): string[]; }
>a.concat : (...items: (string | string[])[]) => string[]
>a : string[]
>concat : { <U extends string[]>(...items: U[]): string[]; (...items: string[]): string[]; }
>concat : (...items: (string | string[])[]) => string[]
>'Hello' : string
var b = new Array<string>();
@@ -25,8 +25,8 @@ var b = new Array<string>();
b.concat('hello');
>b.concat('hello') : string[]
>b.concat : { <U extends string[]>(...items: U[]): string[]; (...items: string[]): string[]; }
>b.concat : (...items: (string | string[])[]) => string[]
>b : string[]
>concat : { <U extends string[]>(...items: U[]): string[]; (...items: string[]): string[]; }
>concat : (...items: (string | string[])[]) => string[]
>'hello' : string
@@ -2,8 +2,8 @@
var x = [].concat([{ a: 1 }], [{ a: 2 }])
>x : Symbol(x, Decl(arrayConcatMap.ts, 0, 3))
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>[].concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>[].concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 20))
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 32))
@@ -4,9 +4,9 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])
>[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[]
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>[].concat([{ a: 1 }], [{ a: 2 }]) : any[]
>[].concat : { <U extends any[]>(...items: U[]): any[]; (...items: any[]): any[]; }
>[].concat : (...items: any[]) => any[]
>[] : undefined[]
>concat : { <U extends any[]>(...items: U[]): any[]; (...items: any[]): any[]; }
>concat : (...items: any[]) => any[]
>[{ a: 1 }] : { a: number; }[]
>{ a: 1 } : { a: number; }
>a : number
@@ -0,0 +1,22 @@
//// [blockScopedBindingsReassignedInLoop1.ts]
declare function use(n: number): void;
(function () {
'use strict'
for (let i = 0; i < 9; ++i) {
(() => use(++i))();
}
})();
//// [blockScopedBindingsReassignedInLoop1.js]
(function () {
'use strict';
var _loop_1 = function(i) {
(function () { return use(++i); })();
out_i_1 = i;
};
var out_i_1;
for (var i = 0; i < 9; ++i) {
_loop_1(i);
i = out_i_1;
}
})();
@@ -0,0 +1,17 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts ===
declare function use(n: number): void;
>use : Symbol(use, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 0))
>n : Symbol(n, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 21))
(function () {
'use strict'
for (let i = 0; i < 9; ++i) {
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
(() => use(++i))();
>use : Symbol(use, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 0))
>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10))
}
})();
@@ -0,0 +1,32 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts ===
declare function use(n: number): void;
>use : (n: number) => void
>n : number
(function () {
>(function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }})() : void
>(function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }}) : () => void
>function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }} : () => void
'use strict'
>'use strict' : string
for (let i = 0; i < 9; ++i) {
>i : number
>0 : number
>i < 9 : boolean
>i : number
>9 : number
>++i : number
>i : number
(() => use(++i))();
>(() => use(++i))() : void
>(() => use(++i)) : () => void
>() => use(++i) : () => void
>use(++i) : void
>use : (n: number) => void
>++i : number
>i : number
}
})();
@@ -0,0 +1,120 @@
//// [blockScopedBindingsReassignedInLoop2.ts]
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break;
}
else {
y = 5;
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue;
}
else {
y = 5;
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break loop;
}
else {
y = 5;
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue loop;
}
else {
y = 5;
}
}
//// [blockScopedBindingsReassignedInLoop2.js]
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_1 = x, out_y_1 = y, "break";
}
else {
y = 5;
}
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (state_1 === "break") break;
}
var _loop_2 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_2 = x, out_y_2 = y, "continue";
}
else {
y = 5;
}
out_x_2 = x;
out_y_2 = y;
};
var out_x_2, out_y_2;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_2 = _loop_2(x, y);
x = out_x_2;
y = out_y_2;
if (state_2 === "continue") continue;
}
var _loop_3 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_3 = x, out_y_3 = y, "break-loop";
}
else {
y = 5;
}
out_x_3 = x;
out_y_3 = y;
};
var out_x_3, out_y_3;
loop: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_3 = _loop_3(x, y);
x = out_x_3;
y = out_y_3;
switch(state_3) {
case "break-loop": break loop;
}
}
var _loop_4 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_4 = x, out_y_4 = y, "continue-loop";
}
else {
y = 5;
}
out_x_4 = x;
out_y_4 = y;
};
var out_x_4, out_y_4;
loop: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_4 = _loop_4(x, y);
x = out_x_4;
y = out_y_4;
switch(state_4) {
case "continue-loop": continue loop;
}
}
@@ -0,0 +1,98 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 1, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8))
break;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15))
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 11, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8))
continue;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15))
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 22, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8))
break loop;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15))
}
}
loop:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 33, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8))
continue loop;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15))
}
}
@@ -0,0 +1,160 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break;
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue;
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop:
>loop : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break loop;
>loop : any
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop:
>loop : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue loop;
>loop : any
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
@@ -0,0 +1,247 @@
//// [blockScopedBindingsReassignedInLoop3.ts]
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break;
}
else {
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
break;
}
else {
y++;
}
}
y = 5;
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue;
}
else {
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
continue;
}
else {
y++;
}
}
y = 5;
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
break loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
break loop1;
}
else {
y++;
break loop2
}
}
y = 5;
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
continue loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
let f = () => a;
if (a) {
a = x;
continue loop1;
}
else {
y++;
continue loop2
}
}
y = 5;
}
}
//// [blockScopedBindingsReassignedInLoop3.js]
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_1 = x, out_y_1 = y, "break";
}
else {
var _loop_2 = function(a_1) {
var f = function () { return a_1; };
if (a_1) {
a_1 = x;
return out_a_1_1 = a_1, "break";
}
else {
y++;
}
out_a_1_1 = a_1;
};
var out_a_1_1;
for (var a_1 = 1; a_1 < 5; --a_1) {
var state_1 = _loop_2(a_1);
a_1 = out_a_1_1;
if (state_1 === "break") break;
}
y = 5;
}
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_2 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (state_2 === "break") break;
}
var _loop_3 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_2 = x, out_y_2 = y, "continue";
}
else {
var _loop_4 = function(a_2) {
var f = function () { return a_2; };
if (a_2) {
a_2 = x;
return out_a_2_1 = a_2, "continue";
}
else {
y++;
}
out_a_2_1 = a_2;
};
var out_a_2_1;
for (var a_2 = 1; a_2 < 5; --a_2) {
var state_3 = _loop_4(a_2);
a_2 = out_a_2_1;
if (state_3 === "continue") continue;
}
y = 5;
}
out_x_2 = x;
out_y_2 = y;
};
var out_x_2, out_y_2;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_4 = _loop_3(x, y);
x = out_x_2;
y = out_y_2;
if (state_4 === "continue") continue;
}
var _loop_5 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_3 = x, out_y_3 = y, "break-loop2";
}
else {
var _loop_6 = function(a_3) {
var f = function () { return a_3; };
if (a_3) {
a_3 = x;
return out_a_3_1 = a_3, "break-loop1";
}
else {
y++;
return out_a_3_1 = a_3, "break-loop2";
}
out_a_3_1 = a_3;
};
var out_a_3_1;
loop1: for (var a_3 = 1; a_3 < 5; --a_3) {
var state_5 = _loop_6(a_3);
a_3 = out_a_3_1;
switch(state_5) {
case "break-loop1": break loop1;
case "break-loop2": return state_5;
}
}
y = 5;
}
out_x_3 = x;
out_y_3 = y;
};
var out_x_3, out_y_3;
loop2: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_6 = _loop_5(x, y);
x = out_x_3;
y = out_y_3;
switch(state_6) {
case "break-loop2": break loop2;
}
}
var _loop_7 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return out_x_4 = x, out_y_4 = y, "continue-loop2";
}
else {
var _loop_8 = function(a_4) {
var f = function () { return a_4; };
if (a_4) {
a_4 = x;
return out_a_4_1 = a_4, "continue-loop1";
}
else {
y++;
return out_a_4_1 = a_4, "continue-loop2";
}
out_a_4_1 = a_4;
};
var out_a_4_1;
loop1: for (var a_4 = 1; a_4 < 5; --a_4) {
var state_7 = _loop_8(a_4);
a_4 = out_a_4_1;
switch(state_7) {
case "continue-loop1": continue loop1;
case "continue-loop2": return state_7;
}
}
y = 5;
}
out_x_4 = x;
out_y_4 = y;
};
var out_x_4, out_y_4;
loop2: for (var x = 1, y = 2; x < y; ++x, --y) {
var state_8 = _loop_7(x, y);
x = out_x_4;
y = out_y_4;
switch(state_8) {
case "continue-loop2": continue loop2;
}
}
@@ -0,0 +1,203 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 2, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
break;
}
else {
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 8, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8))
break;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15))
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 24, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
continue;
}
else {
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 30, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8))
continue;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15))
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 46, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
break loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 53, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8))
break loop1;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
break loop2
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15))
}
}
loop2:
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 70, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
continue loop2;
}
else {
loop1:
for (let a = 1; a < 5; --a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
let f = () => a;
>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 77, 15))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
if (a) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
a = x;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8))
continue loop1;
}
else {
y++;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
continue loop2
}
}
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15))
}
}
@@ -0,0 +1,301 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break;
}
else {
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
break;
}
else {
y++;
>y++ : number
>y : number
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue;
}
else {
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
continue;
}
else {
y++;
>y++ : number
>y : number
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop2:
>loop2 : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
break loop2;
>loop2 : any
}
else {
loop1:
>loop1 : any
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
break loop1;
>loop1 : any
}
else {
y++;
>y++ : number
>y : number
break loop2
>loop2 : any
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
loop2:
>loop2 : any
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
continue loop2;
>loop2 : any
}
else {
loop1:
>loop1 : any
for (let a = 1; a < 5; --a) {
>a : number
>1 : number
>a < 5 : boolean
>a : number
>5 : number
>--a : number
>a : number
let f = () => a;
>f : () => number
>() => a : () => number
>a : number
if (a) {
>a : number
a = x;
>a = x : number
>a : number
>x : number
continue loop1;
>loop1 : any
}
else {
y++;
>y++ : number
>y : number
continue loop2
>loop2 : any
}
}
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
@@ -0,0 +1,34 @@
//// [blockScopedBindingsReassignedInLoop4.ts]
function f1() {
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1) {
return 1;
}
else {
y = 5;
}
}
}
//// [blockScopedBindingsReassignedInLoop4.js]
function f1() {
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1) {
return { value: 1 };
}
else {
y = 5;
}
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (typeof state_1 === "object") return state_1.value;
}
}
@@ -0,0 +1,28 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts ===
function f1() {
>f1 : Symbol(f1, Decl(blockScopedBindingsReassignedInLoop4.ts, 0, 0))
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop4.ts, 2, 11))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
if (x == 1) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12))
return 1;
}
else {
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19))
}
}
}
@@ -0,0 +1,43 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts ===
function f1() {
>f1 : () => number
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
return 1;
>1 : number
}
else {
y = 5;
>y = 5 : number
>y : number
>5 : number
}
}
}
@@ -0,0 +1,27 @@
//// [blockScopedBindingsReassignedInLoop5.ts]
for (let x = 1, y = 2; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1)
break;
else
y = 5;
}
//// [blockScopedBindingsReassignedInLoop5.js]
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1)
return out_x_1 = x, out_y_1 = y, "break";
else
y = 5;
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var x = 1, y = 2; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (state_1 === "break") break;
}
@@ -0,0 +1,23 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop5.ts, 1, 7))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
if (x == 1)
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8))
break;
else
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15))
}
@@ -0,0 +1,37 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts ===
for (let x = 1, y = 2; x < y; ++x, --y) {
>x : number
>1 : number
>y : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
break;
else
y = 5;
>y = 5 : number
>y : number
>5 : number
}
@@ -0,0 +1,74 @@
//// [blockScopedBindingsReassignedInLoop6.ts]
function f1() {
for (let [x, y] = [1, 2]; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1)
break;
else if (y == 2)
y = 5;
else
return;
}
}
function f2() {
for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) {
let a = () => x++ + y++;
if (x == 1)
break;
else if (y == 2)
y = 5;
else
return;
}
}
//// [blockScopedBindingsReassignedInLoop6.js]
function f1() {
var _loop_1 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1)
return out_x_1 = x, out_y_1 = y, "break";
else if (y == 2)
y = 5;
else
return { value: void 0 };
out_x_1 = x;
out_y_1 = y;
};
var out_x_1, out_y_1;
for (var _a = [1, 2], x = _a[0], y = _a[1]; x < y; ++x, --y) {
var state_1 = _loop_1(x, y);
x = out_x_1;
y = out_y_1;
if (typeof state_1 === "object") return state_1.value;
if (state_1 === "break") break;
}
}
function f2() {
var _loop_2 = function(x, y) {
var a = function () { return x++ + y++; };
if (x == 1)
return out_x_2 = x, out_y_2 = y, "break";
else if (y == 2)
y = 5;
else
return { value: void 0 };
out_x_2 = x;
out_y_2 = y;
};
var out_x_2, out_y_2;
for (var _a = [{ a: 1, b: { c: 2 } }][0], x = _a.a, y = _a.b.c; x < y; ++x, --y) {
var state_2 = _loop_2(x, y);
x = out_x_2;
y = out_y_2;
if (typeof state_2 === "object") return state_2.value;
if (state_2 === "break") break;
}
}
@@ -0,0 +1,74 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts ===
function f1() {
>f1 : Symbol(f1, Decl(blockScopedBindingsReassignedInLoop6.ts, 0, 0))
for (let [x, y] = [1, 2]; x < y; ++x, --y) {
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 2, 11))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
if (x == 1)
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14))
break;
else if (y == 2)
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16))
else
return;
}
}
function f2() {
>f2 : Symbol(f2, Decl(blockScopedBindingsReassignedInLoop6.ts, 10, 1))
for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) {
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 37))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>b : Symbol(b, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 42))
>c : Symbol(c, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 47))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 37))
>b : Symbol(b, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 42))
>c : Symbol(c, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 47))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
let a = () => x++ + y++;
>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 14, 11))
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
if (x == 1)
>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15))
break;
else if (y == 2)
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
y = 5;
>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25))
else
return;
}
}
@@ -0,0 +1,110 @@
=== tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts ===
function f1() {
>f1 : () => void
for (let [x, y] = [1, 2]; x < y; ++x, --y) {
>x : number
>y : number
>[1, 2] : [number, number]
>1 : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
break;
else if (y == 2)
>y == 2 : boolean
>y : number
>2 : number
y = 5;
>y = 5 : number
>y : number
>5 : number
else
return;
}
}
function f2() {
>f2 : () => void
for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) {
>a : any
>x : number
>b : any
>c : any
>y : number
>[{a: 1, b: {c: 2}}] : [{ a: number; b: { c: number; }; }]
>{a: 1, b: {c: 2}} : { a: number; b: { c: number; }; }
>a : number
>1 : number
>b : { c: number; }
>{c: 2} : { c: number; }
>c : number
>2 : number
>x < y : boolean
>x : number
>y : number
>++x, --y : number
>++x : number
>x : number
>--y : number
>y : number
let a = () => x++ + y++;
>a : () => number
>() => x++ + y++ : () => number
>x++ + y++ : number
>x++ : number
>x : number
>y++ : number
>y : number
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
break;
else if (y == 2)
>y == 2 : boolean
>y : number
>2 : number
y = 5;
>y = 5 : number
>y : number
>5 : number
else
return;
}
}
@@ -1,4 +1,3 @@
tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/conformance/externalModules/foo1.ts(9,12): error TS2339: Property 'x' does not exist on type 'C1'.
tests/cases/conformance/externalModules/foo2.ts(8,12): error TS2339: Property 'y' does not exist on type 'C1'.
tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x' does not exist on type 'C1'.
@@ -26,10 +25,8 @@ tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x
}
}
==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ====
==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ====
import foo2 = require('./foo2');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
export module M1 {
export class C1 {
m1: foo2.M1.C1;
@@ -1,13 +1,10 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,25): error TS1005: ';' expected.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(3,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(4,17): error TS1005: '=' expected.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts (4 errors) ====
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts (3 errors) ====
export default abstract class A {}
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
~~~~~
!!! error TS1005: ';' expected.
export abstract class B {}
@@ -1,17 +1,14 @@
tests/cases/compiler/classExtendsNull.ts(2,5): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'
tests/cases/compiler/classExtendsNull.ts(3,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'
==== tests/cases/compiler/classExtendsNull.ts (1 errors) ====
class C extends null {
constructor() {
~~~~~~~~~~~~~~~
super();
~~~~~~~~~~~~~~~~
return Object.create(null);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
~~~~~~~
!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'
return Object.create(null);
}
}
class D extends null {
@@ -1,17 +1,14 @@
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor.
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ====
var field1: string;
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (2 errors) ====
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ====
declare var console: {
log(msg?: any): void;
};
export class Test1 {
~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
constructor(private field1: string) {
}
messageHandler = () => {
@@ -1,11 +1,8 @@
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'.
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (1 errors) ====
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ====
export var field1: string;
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ====
declare var console: {
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (1 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,
// Computed properties
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
set ["set1"](p: Foo2) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts (1 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,
// Computed properties
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
set ["set1"](p: Foo2) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,9): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (1 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,
// Computed properties
get [1 << 6]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
set [1 << 6](p: Foo2) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,9): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts (1 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,
// Computed properties
get [1 << 6]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
set [1 << 6](p: Foo2) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,9): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (1 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,
// Computed properties
get [1 << 6]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
set [1 << 6](p: Foo2) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,9): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts (1 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,
// Computed properties
get [1 << 6]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
set [1 << 6](p: Foo2) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (1 errors) ====
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10
class D extends C {
// Computed properties
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
set ["set1"](p: Foo2) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts (1 errors) ====
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10
class D extends C {
// Computed properties
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
set ["set1"](p: Foo2) { }
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (2 errors) ====
@@ -9,12 +9,12 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10
class C {
[s: string]: Foo2;
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
class D extends C {
set ["set1"](p: Foo) { }
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts (2 errors) ====
@@ -9,12 +9,12 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10
class C {
[s: string]: Foo2;
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
class D extends C {
set ["set1"](p: Foo) { }
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (2 errors) ====
@@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11
class C {
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
@@ -16,6 +16,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11
// No error when the indexer is in a class more derived than the computed property
[s: string]: Foo2;
set ["set1"](p: Foo) { }
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(5,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(5,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts (2 errors) ====
@@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11
class C {
get ["get1"]() { return new Foo }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
@@ -16,6 +16,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11
// No error when the indexer is in a class more derived than the computed property
[s: string]: Foo2;
set ["set1"](p: Foo) { }
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
@@ -14,15 +14,15 @@ var fa: number[];
fa = fa.concat([0]);
>fa : Symbol(fa, Decl(concatError.ts, 8, 3))
>fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
>fa : Symbol(fa, Decl(concatError.ts, 8, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
fa = fa.concat(0);
>fa : Symbol(fa, Decl(concatError.ts, 8, 3))
>fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
>fa : Symbol(fa, Decl(concatError.ts, 8, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
+4 -4
View File
@@ -16,9 +16,9 @@ fa = fa.concat([0]);
>fa = fa.concat([0]) : number[]
>fa : number[]
>fa.concat([0]) : number[]
>fa.concat : { <U extends number[]>(...items: U[]): number[]; (...items: number[]): number[]; }
>fa.concat : (...items: (number | number[])[]) => number[]
>fa : number[]
>concat : { <U extends number[]>(...items: U[]): number[]; (...items: number[]): number[]; }
>concat : (...items: (number | number[])[]) => number[]
>[0] : number[]
>0 : number
@@ -26,9 +26,9 @@ fa = fa.concat(0);
>fa = fa.concat(0) : number[]
>fa : number[]
>fa.concat(0) : number[]
>fa.concat : { <U extends number[]>(...items: U[]): number[]; (...items: number[]): number[]; }
>fa.concat : (...items: (number | number[])[]) => number[]
>fa : number[]
>concat : { <U extends number[]>(...items: U[]): number[]; (...items: number[]): number[]; }
>concat : (...items: (number | number[])[]) => number[]
>0 : number
@@ -0,0 +1,16 @@
//// [declarationEmitIdentifierPredicates01.ts]
export function f(x: any): x is number {
return typeof x === "number";
}
//// [declarationEmitIdentifierPredicates01.js]
"use strict";
function f(x) {
return typeof x === "number";
}
exports.f = f;
//// [declarationEmitIdentifierPredicates01.d.ts]
export declare function f(x: any): x is number;
@@ -0,0 +1,10 @@
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts ===
export function f(x: any): x is number {
>f : Symbol(f, Decl(declarationEmitIdentifierPredicates01.ts, 0, 0))
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
return typeof x === "number";
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
}
@@ -0,0 +1,13 @@
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts ===
export function f(x: any): x is number {
>f : (x: any) => x is number
>x : any
>x : any
return typeof x === "number";
>typeof x === "number" : boolean
>typeof x : string
>x : any
>"number" : string
}
@@ -0,0 +1,14 @@
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts(6,33): error TS4060: Return type of exported function has or is using private name 'I'.
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts (1 errors) ====
interface I {
a: number;
}
export function f(x: any): x is I {
~
!!! error TS4060: Return type of exported function has or is using private name 'I'.
return typeof x.a === "number";
}
@@ -0,0 +1,16 @@
//// [declarationEmitIdentifierPredicatesWithPrivateName01.ts]
interface I {
a: number;
}
export function f(x: any): x is I {
return typeof x.a === "number";
}
//// [declarationEmitIdentifierPredicatesWithPrivateName01.js]
"use strict";
function f(x) {
return typeof x.a === "number";
}
exports.f = f;
@@ -0,0 +1,43 @@
//// [declarationEmitThisPredicates01.ts]
export class C {
m(): this is D {
return this instanceof D;
}
}
export class D extends C {
}
//// [declarationEmitThisPredicates01.js]
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var C = (function () {
function C() {
}
C.prototype.m = function () {
return this instanceof D;
};
return C;
}());
exports.C = C;
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
}
return D;
}(C));
exports.D = D;
//// [declarationEmitThisPredicates01.d.ts]
export declare class C {
m(): this is D;
}
export declare class D extends C {
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts ===
export class C {
>C : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0))
m(): this is D {
>m : Symbol(m, Decl(declarationEmitThisPredicates01.ts, 1, 16))
>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1))
return this instanceof D;
>this : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0))
>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1))
}
}
export class D extends C {
>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1))
>C : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0))
}
@@ -0,0 +1,20 @@
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts ===
export class C {
>C : C
m(): this is D {
>m : () => this is D
>D : D
return this instanceof D;
>this instanceof D : boolean
>this : this
>D : typeof D
}
}
export class D extends C {
>D : D
>C : C
}
@@ -0,0 +1,19 @@
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts (1 errors) ====
export interface Foo {
a: string;
b: number;
c: boolean;
}
export const obj = {
m(): this is Foo {
~~~~
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
let dis = this as Foo;
return dis.a != null && dis.b != null && dis.c != null;
}
}
@@ -0,0 +1,34 @@
//// [declarationEmitThisPredicates02.ts]
export interface Foo {
a: string;
b: number;
c: boolean;
}
export const obj = {
m(): this is Foo {
let dis = this as Foo;
return dis.a != null && dis.b != null && dis.c != null;
}
}
//// [declarationEmitThisPredicates02.js]
"use strict";
exports.obj = {
m: function () {
var dis = this;
return dis.a != null && dis.b != null && dis.c != null;
}
};
//// [declarationEmitThisPredicates02.d.ts]
export interface Foo {
a: string;
b: number;
c: boolean;
}
export declare const obj: {
m(): this is Foo;
};
@@ -0,0 +1,15 @@
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts(3,18): error TS4055: Return type of public method from exported class has or is using private name 'D'.
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts (1 errors) ====
export class C {
m(): this is D {
~
!!! error TS4055: Return type of public method from exported class has or is using private name 'D'.
return this instanceof D;
}
}
class D extends C {
}
@@ -0,0 +1,34 @@
//// [declarationEmitThisPredicatesWithPrivateName01.ts]
export class C {
m(): this is D {
return this instanceof D;
}
}
class D extends C {
}
//// [declarationEmitThisPredicatesWithPrivateName01.js]
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var C = (function () {
function C() {
}
C.prototype.m = function () {
return this instanceof D;
};
return C;
}());
exports.C = C;
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
}
return D;
}(C));
@@ -0,0 +1,22 @@
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(8,14): error TS4025: Exported variable 'obj' has or is using private name 'Foo'.
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts (2 errors) ====
interface Foo {
a: string;
b: number;
c: boolean;
}
export const obj = {
~~~
!!! error TS4025: Exported variable 'obj' has or is using private name 'Foo'.
m(): this is Foo {
~~~~
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
let dis = this as Foo;
return dis.a != null && dis.b != null && dis.c != null;
}
}
@@ -0,0 +1,23 @@
//// [declarationEmitThisPredicatesWithPrivateName02.ts]
interface Foo {
a: string;
b: number;
c: boolean;
}
export const obj = {
m(): this is Foo {
let dis = this as Foo;
return dis.a != null && dis.b != null && dis.c != null;
}
}
//// [declarationEmitThisPredicatesWithPrivateName02.js]
"use strict";
exports.obj = {
m: function () {
var dis = this;
return dis.a != null && dis.b != null && dis.c != null;
}
};
@@ -0,0 +1,61 @@
//// [destructuringInFunctionType.ts]
interface a { a }
interface b { b }
interface c { c }
type T1 = ([a, b, c]);
type F1 = ([a, b, c]) => void;
type T2 = ({ a });
type F2 = ({ a }) => void;
type T3 = ([{ a: b }, { b: a }]);
type F3 = ([{ a: b }, { b: a }]) => void;
type T4 = ([{ a: [b, c] }]);
type F4 = ([{ a: [b, c] }]) => void;
type C1 = new ([{ a: [b, c] }]) => void;
var v1 = ([a, b, c]) => "hello";
var v2: ([a, b, c]) => string;
//// [destructuringInFunctionType.js]
var v1 = function (_a) {
var a = _a[0], b = _a[1], c = _a[2];
return "hello";
};
var v2;
//// [destructuringInFunctionType.d.ts]
interface a {
a: any;
}
interface b {
b: any;
}
interface c {
c: any;
}
declare type T1 = ([a, b, c]);
declare type F1 = ([a, b, c]) => void;
declare type T2 = ({
a;
});
declare type F2 = ({a}) => void;
declare type T3 = ([{
a: b;
}, {
b: a;
}]);
declare type F3 = ([{a: b}, {b: a}]) => void;
declare type T4 = ([{
a: [b, c];
}]);
declare type F4 = ([{a: [b, c]}]) => void;
declare type C1 = new ([{a: [b, c]}]) => void;
declare var v1: ([a, b, c]: [any, any, any]) => string;
declare var v2: ([a, b, c]) => string;
@@ -0,0 +1,78 @@
=== tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts ===
interface a { a }
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 1, 13))
interface b { b }
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 2, 13))
interface c { c }
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 3, 13))
type T1 = ([a, b, c]);
>T1 : Symbol(T1, Decl(destructuringInFunctionType.ts, 3, 17))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17))
type F1 = ([a, b, c]) => void;
>F1 : Symbol(F1, Decl(destructuringInFunctionType.ts, 5, 22))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 6, 12))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 6, 14))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 6, 17))
type T2 = ({ a });
>T2 : Symbol(T2, Decl(destructuringInFunctionType.ts, 6, 30))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 8, 12))
type F2 = ({ a }) => void;
>F2 : Symbol(F2, Decl(destructuringInFunctionType.ts, 8, 18))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 9, 12))
type T3 = ([{ a: b }, { b: a }]);
>T3 : Symbol(T3, Decl(destructuringInFunctionType.ts, 9, 26))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 11, 13))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 11, 23))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0))
type F3 = ([{ a: b }, { b: a }]) => void;
>F3 : Symbol(F3, Decl(destructuringInFunctionType.ts, 11, 33))
>a : Symbol(a)
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 12, 13))
>b : Symbol(b)
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 12, 23))
type T4 = ([{ a: [b, c] }]);
>T4 : Symbol(T4, Decl(destructuringInFunctionType.ts, 12, 41))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 14, 13))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17))
type F4 = ([{ a: [b, c] }]) => void;
>F4 : Symbol(F4, Decl(destructuringInFunctionType.ts, 14, 28))
>a : Symbol(a)
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 15, 18))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 15, 20))
type C1 = new ([{ a: [b, c] }]) => void;
>C1 : Symbol(C1, Decl(destructuringInFunctionType.ts, 15, 36))
>a : Symbol(a)
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 17, 22))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 17, 24))
var v1 = ([a, b, c]) => "hello";
>v1 : Symbol(v1, Decl(destructuringInFunctionType.ts, 19, 3))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 19, 11))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 19, 13))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 19, 16))
var v2: ([a, b, c]) => string;
>v2 : Symbol(v2, Decl(destructuringInFunctionType.ts, 20, 3))
>a : Symbol(a, Decl(destructuringInFunctionType.ts, 20, 10))
>b : Symbol(b, Decl(destructuringInFunctionType.ts, 20, 12))
>c : Symbol(c, Decl(destructuringInFunctionType.ts, 20, 15))
@@ -0,0 +1,80 @@
=== tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts ===
interface a { a }
>a : a
>a : any
interface b { b }
>b : b
>b : any
interface c { c }
>c : c
>c : any
type T1 = ([a, b, c]);
>T1 : [a, b, c]
>a : a
>b : b
>c : c
type F1 = ([a, b, c]) => void;
>F1 : ([a, b, c]: [any, any, any]) => void
>a : any
>b : any
>c : any
type T2 = ({ a });
>T2 : { a: any; }
>a : any
type F2 = ({ a }) => void;
>F2 : ({ a }: { a: any; }) => void
>a : any
type T3 = ([{ a: b }, { b: a }]);
>T3 : [{ a: b; }, { b: a; }]
>a : b
>b : b
>b : a
>a : a
type F3 = ([{ a: b }, { b: a }]) => void;
>F3 : ([{ a: b }, { b: a }]: [{ a: any; }, { b: any; }]) => void
>a : any
>b : any
>b : any
>a : any
type T4 = ([{ a: [b, c] }]);
>T4 : [{ a: [b, c]; }]
>a : [b, c]
>b : b
>c : c
type F4 = ([{ a: [b, c] }]) => void;
>F4 : ([{ a: [b, c] }]: [{ a: [any, any]; }]) => void
>a : any
>b : any
>c : any
type C1 = new ([{ a: [b, c] }]) => void;
>C1 : new ([{ a: [b, c] }]: [{ a: [any, any]; }]) => void
>a : any
>b : any
>c : any
var v1 = ([a, b, c]) => "hello";
>v1 : ([a, b, c]: [any, any, any]) => string
>([a, b, c]) => "hello" : ([a, b, c]: [any, any, any]) => string
>a : any
>b : any
>c : any
>"hello" : string
var v2: ([a, b, c]) => string;
>v2 : ([a, b, c]: [any, any, any]) => string
>a : any
>b : any
>c : any
@@ -1,4 +1,3 @@
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2300: Duplicate identifier 'export='.
@@ -12,13 +11,11 @@ tests/cases/conformance/externalModules/foo5.ts(5,1): error TS2300: Duplicate id
tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate identifier 'export='.
==== tests/cases/conformance/externalModules/foo1.ts (3 errors) ====
==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ====
var x = 10;
var y = 20;
export = x;
~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'export='.
export = y;
~~~~~~~~~~~
@@ -1,13 +1,12 @@
tests/cases/compiler/duplicateLocalVariable1.ts(2,4): error TS1005: ';' expected.
tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected.
tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'.
tests/cases/compiler/duplicateLocalVariable1.ts(12,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
==== tests/cases/compiler/duplicateLocalVariable1.ts (7 errors) ====
==== tests/cases/compiler/duplicateLocalVariable1.ts (6 errors) ====
/ /@module: commonjs
~
@@ -26,8 +25,6 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithm
var TestFileDir = ".\\TempTestFiles";
export class TestCase {
~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) {
}
}
@@ -0,0 +1,37 @@
//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts]
class A {
blub = 6;
}
class B extends A {
constructor(public x: number) {
"use strict";
'someStringForEgngInject';
super()
}
}
//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A() {
this.blub = 6;
}
return A;
}());
var B = (function (_super) {
__extends(B, _super);
function B(x) {
"use strict";
'someStringForEgngInject';
_super.call(this);
this.x = x;
}
return B;
}(A));
@@ -0,0 +1,23 @@
=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts ===
class A {
>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0))
blub = 6;
>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 9))
}
class B extends A {
>B : Symbol(B, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 2, 1))
>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0))
constructor(public x: number) {
>x : Symbol(x, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 6, 16))
"use strict";
'someStringForEgngInject';
super()
>super : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0))
}
}

Some files were not shown because too many files have changed in this diff Show More