mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-21 13:14:43 -06:00
merge with master
This commit is contained in:
commit
622b7613f7
1
.gitignore
vendored
1
.gitignore
vendored
@ -37,4 +37,5 @@ tests/*.d.ts
|
||||
scripts/debug.bat
|
||||
scripts/run.bat
|
||||
scripts/word2md.js
|
||||
scripts/ior.js
|
||||
coverage/
|
||||
|
||||
@ -9,7 +9,7 @@ Design changes will not be accepted at this time. If you have a design change pr
|
||||
## Legal
|
||||
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
|
||||
|
||||
Please submit a Contributor License Agreement (CLA) before submitting a pull request. Download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190)), sign, scan, and email it back to <cla@microsoft.com>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features.
|
||||
Please submit a Contributor License Agreement (CLA) before submitting a pull request. Download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to <cla@microsoft.com>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features.
|
||||
|
||||
## Housekeeping
|
||||
Your pull request should:
|
||||
@ -26,6 +26,7 @@ Your pull request should:
|
||||
* Include baseline changes with your change
|
||||
* All changed code must have 100% code coverage
|
||||
* Follow the code conventions descriped in [Coding guidlines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidlines)
|
||||
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
|
||||
|
||||
## Running the Tests
|
||||
To run all tests, invoke the runtests target using jake:
|
||||
|
||||
14
Jakefile
14
Jakefile
@ -10,6 +10,7 @@ var servicesDirectory = "src/services/";
|
||||
var harnessDirectory = "src/harness/";
|
||||
var libraryDirectory = "src/lib/";
|
||||
var scriptsDirectory = "scripts/";
|
||||
var unittestsDirectory = "tests/cases/unittests/";
|
||||
var docDirectory = "doc/";
|
||||
|
||||
var builtDirectory = "built/";
|
||||
@ -54,6 +55,7 @@ var servicesSources = [
|
||||
].map(function (f) {
|
||||
return path.join(compilerDirectory, f);
|
||||
}).concat([
|
||||
"breakpoints.ts",
|
||||
"services.ts",
|
||||
"shims.ts",
|
||||
"signatureHelp.ts",
|
||||
@ -74,13 +76,17 @@ var harnessSources = [
|
||||
"typeWriter.ts",
|
||||
"fourslashRunner.ts",
|
||||
"projectsRunner.ts",
|
||||
"unittestrunner.ts",
|
||||
"loggedIO.ts",
|
||||
"rwcRunner.ts",
|
||||
"runner.ts"
|
||||
].map(function (f) {
|
||||
return path.join(harnessDirectory, f);
|
||||
});
|
||||
}).concat([
|
||||
"services/colorization.ts",
|
||||
"services/documentRegistry.ts"
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
}));
|
||||
|
||||
var librarySourceMap = [
|
||||
{ target: "lib.core.d.ts", sources: ["core.d.ts"] },
|
||||
@ -279,7 +285,6 @@ var word2mdJs = path.join(scriptsDirectory, "word2md.js");
|
||||
var word2mdTs = path.join(scriptsDirectory, "word2md.ts");
|
||||
var specWord = path.join(docDirectory, "TypeScript Language Specification.docx");
|
||||
var specMd = path.join(docDirectory, "spec.md");
|
||||
var headerMd = path.join(docDirectory, "header.md");
|
||||
|
||||
file(word2mdTs);
|
||||
|
||||
@ -292,9 +297,8 @@ compileFile(word2mdJs,
|
||||
|
||||
// The generated spec.md; built for the 'generate-spec' task
|
||||
file(specMd, [word2mdJs, specWord], function () {
|
||||
jake.cpR(headerMd, specMd, {silent: true});
|
||||
var specWordFullPath = path.resolve(specWord);
|
||||
var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" >>' + specMd;
|
||||
var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" ' + specMd;
|
||||
console.log(cmd);
|
||||
child_process.exec(cmd, function () {
|
||||
complete();
|
||||
|
||||
4038
bin/tsc.js
4038
bin/tsc.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
# TypeScript Language Specification
|
||||
|
||||
1003
doc/spec.md
1003
doc/spec.md
File diff suppressed because it is too large
Load Diff
123
scripts/ior.ts
Normal file
123
scripts/ior.ts
Normal file
@ -0,0 +1,123 @@
|
||||
/// <reference path="../src/harness/external/node.d.ts" />
|
||||
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
|
||||
interface IOLog {
|
||||
filesRead: {
|
||||
path: string;
|
||||
result: { contents: string; };
|
||||
}[];
|
||||
arguments: string[];
|
||||
}
|
||||
|
||||
module Commands {
|
||||
export function dir(obj: IOLog) {
|
||||
obj.filesRead.filter(f => f.result !== undefined).forEach(f => {
|
||||
console.log(f.path);
|
||||
});
|
||||
}
|
||||
dir['description'] = ': displays a list of files';
|
||||
|
||||
export function find(obj: IOLog, str: string) {
|
||||
obj.filesRead.filter(f => f.result !== undefined).forEach(f => {
|
||||
var lines = f.result.contents.split('\n');
|
||||
var printedHeader = false;
|
||||
lines.forEach(line => {
|
||||
if (line.indexOf(str) >= 0) {
|
||||
if (!printedHeader) {
|
||||
console.log(' === ' + f.path + ' ===');
|
||||
printedHeader = true;
|
||||
}
|
||||
console.log(line);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
find['description'] = ' string: finds text in files';
|
||||
|
||||
export function grab(obj: IOLog, filename: string) {
|
||||
obj.filesRead.filter(f => f.result !== undefined).forEach(f => {
|
||||
if (path.basename(f.path) === filename) {
|
||||
fs.writeFile(filename, f.result.contents);
|
||||
}
|
||||
});
|
||||
}
|
||||
grab['description'] = ' filename.ts: writes out the specified file to disk';
|
||||
|
||||
export function extract(obj: IOLog, outputFolder: string) {
|
||||
var directorySeparator = "/";
|
||||
function directoryExists(path: string): boolean {
|
||||
return fs.existsSync(path) && fs.statSync(path).isDirectory();
|
||||
}
|
||||
function getDirectoryPath(path: string) {
|
||||
return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(directorySeparator)));
|
||||
}
|
||||
function getRootLength(path: string): number {
|
||||
if (path.charAt(0) === directorySeparator) {
|
||||
if (path.charAt(1) !== directorySeparator) return 1;
|
||||
var p1 = path.indexOf(directorySeparator, 2);
|
||||
if (p1 < 0) return 2;
|
||||
var p2 = path.indexOf(directorySeparator, p1 + 1);
|
||||
if (p2 < 0) return p1 + 1;
|
||||
return p2 + 1;
|
||||
}
|
||||
if (path.charAt(1) === ":") {
|
||||
if (path.charAt(2) === directorySeparator) return 3;
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
function ensureDirectoriesExist(directoryPath: string) {
|
||||
if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
|
||||
var parentDirectory = getDirectoryPath(directoryPath);
|
||||
ensureDirectoriesExist(parentDirectory);
|
||||
console.log("creating directory: " + directoryPath);
|
||||
fs.mkdirSync(directoryPath);
|
||||
}
|
||||
}
|
||||
function transalatePath(outputFolder:string, path: string): string {
|
||||
return outputFolder + directorySeparator + path.replace(":", "");
|
||||
}
|
||||
function fileExists(path: string): boolean {
|
||||
return fs.existsSync(path);
|
||||
}
|
||||
obj.filesRead.forEach(f => {
|
||||
var filename = transalatePath(outputFolder, f.path);
|
||||
ensureDirectoriesExist(getDirectoryPath(filename));
|
||||
console.log("writing filename: " + filename);
|
||||
fs.writeFile(filename, f.result.contents, (err) => { });
|
||||
});
|
||||
|
||||
console.log("Command: tsc ");
|
||||
obj.arguments.forEach(a => {
|
||||
if (getRootLength(a) > 0) {
|
||||
console.log(transalatePath(outputFolder, a));
|
||||
}
|
||||
else {
|
||||
console.log(a);
|
||||
}
|
||||
console.log(" ");
|
||||
});
|
||||
}
|
||||
extract['description'] = ' outputFolder: extract all input files to <outputFolder>';
|
||||
}
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
if (args.length < 2) {
|
||||
console.log('Usage: node ior.js path_to_file.json [command]');
|
||||
console.log('List of commands: ');
|
||||
Object.keys(Commands).forEach(k => console.log(' ' + k + Commands[k]['description']));
|
||||
} else {
|
||||
var cmd: Function = Commands[args[1]];
|
||||
if (cmd === undefined) {
|
||||
console.log('Unknown command ' + args[1]);
|
||||
} else {
|
||||
fs.readFile(args[0], 'utf-8', (err, data) => {
|
||||
if (err) throw err;
|
||||
var json = JSON.parse(data);
|
||||
cmd.apply(undefined, [json].concat(args.slice(2)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
interface DiagnosticDetails {
|
||||
category: string;
|
||||
code: number;
|
||||
isEarly?: boolean;
|
||||
}
|
||||
|
||||
interface InputDiagnosticMessageTable {
|
||||
@ -63,8 +64,9 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap:
|
||||
' ' + convertPropertyName(nameMap[name]) +
|
||||
': { code: ' + diagnosticDetails.code +
|
||||
', category: DiagnosticCategory.' + diagnosticDetails.category +
|
||||
', key: "' + name.replace('"', '\\"') +
|
||||
'" },\r\n';
|
||||
', key: "' + name.replace('"', '\\"') + '"' +
|
||||
(diagnosticDetails.isEarly ? ', isEarly: true' : '') +
|
||||
' },\r\n';
|
||||
}
|
||||
|
||||
result += ' };\r\n}';
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
var sys = (function () {
|
||||
var fileStream = new ActiveXObject("ADODB.Stream");
|
||||
fileStream.Type = 2;
|
||||
var binaryStream = new ActiveXObject("ADODB.Stream");
|
||||
binaryStream.Type = 1;
|
||||
var args = [];
|
||||
for (var i = 0; i < WScript.Arguments.length; i++) {
|
||||
args[i] = WScript.Arguments.Item(i);
|
||||
@ -6,7 +10,24 @@ var sys = (function () {
|
||||
return {
|
||||
args: args,
|
||||
createObject: function (typeName) { return new ActiveXObject(typeName); },
|
||||
write: function (s) { return WScript.StdOut.Write(s); }
|
||||
write: function (s) {
|
||||
WScript.StdOut.Write(s);
|
||||
},
|
||||
writeFile: function (fileName, data) {
|
||||
fileStream.Open();
|
||||
binaryStream.Open();
|
||||
try {
|
||||
fileStream.Charset = "utf-8";
|
||||
fileStream.WriteText(data);
|
||||
fileStream.Position = 3;
|
||||
fileStream.CopyTo(binaryStream);
|
||||
binaryStream.SaveToFile(fileName, 2);
|
||||
}
|
||||
finally {
|
||||
binaryStream.Close();
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
function convertDocumentToMarkdown(doc) {
|
||||
@ -149,6 +170,10 @@ function convertDocumentToMarkdown(doc) {
|
||||
lastInTable = inTable;
|
||||
}
|
||||
function writeDocument() {
|
||||
var title = doc.builtInDocumentProperties.item(1) + "";
|
||||
if (title.length) {
|
||||
write("# " + title + "\n\n");
|
||||
}
|
||||
for (var p = doc.paragraphs.first; p; p = p.next()) {
|
||||
writeParagraph(p);
|
||||
}
|
||||
@ -168,16 +193,19 @@ function convertDocumentToMarkdown(doc) {
|
||||
findReplace("^19 REF", {}, "[^&](#^&)", {});
|
||||
doc.fields.toggleShowCodes();
|
||||
writeDocument();
|
||||
result = result.replace(/\x85/g, "\u2026");
|
||||
result = result.replace(/\x96/g, "\u2013");
|
||||
result = result.replace(/\x97/g, "\u2014");
|
||||
return result;
|
||||
}
|
||||
function main(args) {
|
||||
if (args.length !== 1) {
|
||||
sys.write("Syntax: word2md <filename>\n");
|
||||
if (args.length !== 2) {
|
||||
sys.write("Syntax: word2md <inputfile> <outputfile>\n");
|
||||
return;
|
||||
}
|
||||
var app = sys.createObject("Word.Application");
|
||||
var doc = app.documents.open(args[0]);
|
||||
sys.write(convertDocumentToMarkdown(doc));
|
||||
sys.writeFile(args[1], convertDocumentToMarkdown(doc));
|
||||
doc.close(false);
|
||||
app.quit();
|
||||
}
|
||||
|
||||
@ -103,6 +103,7 @@ module Word {
|
||||
export interface Document {
|
||||
fields: Fields;
|
||||
paragraphs: Paragraphs;
|
||||
builtInDocumentProperties: Collection<any>;
|
||||
close(saveChanges: boolean): void;
|
||||
range(): Range;
|
||||
}
|
||||
@ -118,6 +119,10 @@ module Word {
|
||||
}
|
||||
|
||||
var sys = (function () {
|
||||
var fileStream = new ActiveXObject("ADODB.Stream");
|
||||
fileStream.Type = 2 /*text*/;
|
||||
var binaryStream = new ActiveXObject("ADODB.Stream");
|
||||
binaryStream.Type = 1 /*binary*/;
|
||||
var args: string[] = [];
|
||||
for (var i = 0; i < WScript.Arguments.length; i++) {
|
||||
args[i] = WScript.Arguments.Item(i);
|
||||
@ -125,7 +130,26 @@ var sys = (function () {
|
||||
return {
|
||||
args: args,
|
||||
createObject: (typeName: string) => new ActiveXObject(typeName),
|
||||
write: (s: string) => WScript.StdOut.Write(s)
|
||||
write(s: string): void {
|
||||
WScript.StdOut.Write(s);
|
||||
},
|
||||
writeFile: (fileName: string, data: string): void => {
|
||||
fileStream.Open();
|
||||
binaryStream.Open();
|
||||
try {
|
||||
// Write characters in UTF-8 encoding
|
||||
fileStream.Charset = "utf-8";
|
||||
fileStream.WriteText(data);
|
||||
// We don't want the BOM, skip it by setting the starting location to 3 (size of BOM).
|
||||
fileStream.Position = 3;
|
||||
fileStream.CopyTo(binaryStream);
|
||||
binaryStream.SaveToFile(fileName, 2 /*overwrite*/);
|
||||
}
|
||||
finally {
|
||||
binaryStream.Close();
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -298,6 +322,10 @@ function convertDocumentToMarkdown(doc: Word.Document): string {
|
||||
}
|
||||
|
||||
function writeDocument() {
|
||||
var title = doc.builtInDocumentProperties.item(1) + "";
|
||||
if (title.length) {
|
||||
write("# " + title + "\n\n");
|
||||
}
|
||||
for (var p = doc.paragraphs.first; p; p = p.next()) {
|
||||
writeParagraph(p);
|
||||
}
|
||||
@ -321,17 +349,21 @@ function convertDocumentToMarkdown(doc: Word.Document): string {
|
||||
|
||||
writeDocument();
|
||||
|
||||
result = result.replace(/\x85/g, "\u2026");
|
||||
result = result.replace(/\x96/g, "\u2013");
|
||||
result = result.replace(/\x97/g, "\u2014");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function main(args: string[]) {
|
||||
if (args.length !== 1) {
|
||||
sys.write("Syntax: word2md <filename>\n");
|
||||
if (args.length !== 2) {
|
||||
sys.write("Syntax: word2md <inputfile> <outputfile>\n");
|
||||
return;
|
||||
}
|
||||
var app: Word.Application = sys.createObject("Word.Application");
|
||||
var doc = app.documents.open(args[0]);
|
||||
sys.write(convertDocumentToMarkdown(doc));
|
||||
sys.writeFile(args[1], convertDocumentToMarkdown(doc));
|
||||
doc.close(false);
|
||||
app.quit();
|
||||
}
|
||||
|
||||
@ -31,13 +31,14 @@ module ts {
|
||||
|
||||
var parent: Node;
|
||||
var container: Declaration;
|
||||
var blockScopeContainer: Node;
|
||||
var lastContainer: Declaration;
|
||||
var symbolCount = 0;
|
||||
var Symbol = objectAllocator.getSymbolConstructor();
|
||||
|
||||
if (!file.locals) {
|
||||
file.locals = {};
|
||||
container = file;
|
||||
container = blockScopeContainer = file;
|
||||
bind(file);
|
||||
file.symbolCount = symbolCount;
|
||||
}
|
||||
@ -86,10 +87,11 @@ module ts {
|
||||
}
|
||||
// Report errors every position with duplicate declaration
|
||||
// Report errors on previous encountered declarations
|
||||
var message = symbol.flags & SymbolFlags.BlockScopedVariable ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0;
|
||||
forEach(symbol.declarations, (declaration) => {
|
||||
file.semanticErrors.push(createDiagnosticForNode(declaration.name, Diagnostics.Duplicate_identifier_0, getDisplayName(declaration)));
|
||||
file.semanticErrors.push(createDiagnosticForNode(declaration.name, message, getDisplayName(declaration)));
|
||||
});
|
||||
file.semanticErrors.push(createDiagnosticForNode(node.name, Diagnostics.Duplicate_identifier_0, getDisplayName(node)));
|
||||
file.semanticErrors.push(createDiagnosticForNode(node.name, message, getDisplayName(node)));
|
||||
|
||||
symbol = createSymbol(0, name);
|
||||
}
|
||||
@ -167,12 +169,13 @@ module ts {
|
||||
|
||||
// All container nodes are kept on a linked list in declaration order. This list is used by the getLocalNameOfContainer function
|
||||
// in the type checker to validate that the local name used for a container is unique.
|
||||
function bindChildren(node: Declaration, symbolKind: SymbolFlags) {
|
||||
function bindChildren(node: Declaration, symbolKind: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
if (symbolKind & SymbolFlags.HasLocals) {
|
||||
node.locals = {};
|
||||
}
|
||||
var saveParent = parent;
|
||||
var saveContainer = container;
|
||||
var savedBlockScopeContainer = blockScopeContainer;
|
||||
parent = node;
|
||||
if (symbolKind & SymbolFlags.IsContainer) {
|
||||
container = node;
|
||||
@ -184,12 +187,16 @@ module ts {
|
||||
lastContainer = container;
|
||||
}
|
||||
}
|
||||
if (isBlockScopeContainer) {
|
||||
blockScopeContainer = node;
|
||||
}
|
||||
forEachChild(node, bind);
|
||||
container = saveContainer;
|
||||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
|
||||
function bindDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
function bindDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
switch (container.kind) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
declareModuleMember(node, symbolKind, symbolExcludes);
|
||||
@ -225,121 +232,159 @@ module ts {
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
}
|
||||
bindChildren(node, symbolKind);
|
||||
bindChildren(node, symbolKind, isBlockScopeContainer);
|
||||
}
|
||||
|
||||
function bindConstructorDeclaration(node: ConstructorDeclaration) {
|
||||
bindDeclaration(node, SymbolFlags.Constructor, 0);
|
||||
bindDeclaration(node, SymbolFlags.Constructor, 0, /*isBlockScopeContainer*/ true);
|
||||
forEach(node.parameters, p => {
|
||||
if (p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)) {
|
||||
bindDeclaration(p, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
bindDeclaration(p, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bindModuleDeclaration(node: ModuleDeclaration) {
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
}
|
||||
else if (isInstantiated(node)) {
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);
|
||||
bindDeclaration(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
function bindAnonymousDeclaration(node: Node, symbolKind: SymbolFlags, name: string) {
|
||||
function bindAnonymousDeclaration(node: Node, symbolKind: SymbolFlags, name: string, isBlockScopeContainer: boolean) {
|
||||
var symbol = createSymbol(symbolKind, name);
|
||||
addDeclarationToSymbol(symbol, node, symbolKind);
|
||||
bindChildren(node, symbolKind);
|
||||
bindChildren(node, symbolKind, isBlockScopeContainer);
|
||||
}
|
||||
|
||||
function bindCatchVariableDeclaration(node: CatchBlock) {
|
||||
var symbol = createSymbol(SymbolFlags.Variable, node.variable.text || "__missing");
|
||||
addDeclarationToSymbol(symbol, node, SymbolFlags.Variable);
|
||||
var symbol = createSymbol(SymbolFlags.FunctionScopedVariable, node.variable.text || "__missing");
|
||||
addDeclarationToSymbol(symbol, node, SymbolFlags.FunctionScopedVariable);
|
||||
var saveParent = parent;
|
||||
parent = node;
|
||||
var savedBlockScopeContainer = blockScopeContainer;
|
||||
parent = blockScopeContainer = node;
|
||||
forEachChild(node, bind);
|
||||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
|
||||
function bindBlockScopedVariableDeclaration(node: Declaration) {
|
||||
switch (blockScopeContainer.kind) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
declareModuleMember(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes);
|
||||
break;
|
||||
case SyntaxKind.SourceFile:
|
||||
if (isExternalModule(<SourceFile>container)) {
|
||||
declareModuleMember(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes);
|
||||
}
|
||||
|
||||
bindChildren(node, SymbolFlags.BlockScopedVariable, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
|
||||
function bind(node: Node) {
|
||||
node.parent = parent;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Variable, SymbolFlags.ParameterExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Variable, SymbolFlags.VariableExcludes);
|
||||
if (node.flags & NodeFlags.BlockScoped) {
|
||||
bindBlockScopedVariableDeclaration(<Declaration>node);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, SymbolFlags.FunctionScopedVariableExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.EnumMember:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.CallSignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.CallSignature, 0);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.CallSignature, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Method, SymbolFlags.MethodExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Method, SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.ConstructSignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.ConstructSignature, 0);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.ConstructSignature, 0, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.IndexSignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.IndexSignature, 0);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.IndexSignature, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.Constructor:
|
||||
bindConstructorDeclaration(<ConstructorDeclaration>node);
|
||||
break;
|
||||
case SyntaxKind.GetAccessor:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.SetAccessor:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.TypeLiteral:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.TypeLiteral, "__type");
|
||||
bindAnonymousDeclaration(node, SymbolFlags.TypeLiteral, "__type", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.ObjectLiteral, "__object");
|
||||
bindAnonymousDeclaration(node, SymbolFlags.ObjectLiteral, "__object", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.Function, "__function");
|
||||
bindAnonymousDeclaration(node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.CatchBlock:
|
||||
bindCatchVariableDeclaration(<CatchBlock>node);
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Enum, SymbolFlags.EnumExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Enum, SymbolFlags.EnumExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
bindModuleDeclaration(<ModuleDeclaration>node);
|
||||
break;
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Import, SymbolFlags.ImportExcludes);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Import, SymbolFlags.ImportExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.SourceFile:
|
||||
if (isExternalModule(<SourceFile>node)) {
|
||||
bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).filename) + '"');
|
||||
bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).filename) + '"', /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
}
|
||||
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
bindChildren(node, 0 , true);
|
||||
break;
|
||||
|
||||
default:
|
||||
var saveParent = parent;
|
||||
parent = node;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -102,10 +102,10 @@ module ts {
|
||||
{
|
||||
name: "target",
|
||||
shortName: "t",
|
||||
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5 },
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_or_ES5,
|
||||
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5 , "es6": ScriptTarget.ES6 },
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: Diagnostics.VERSION,
|
||||
error: Diagnostics.Argument_for_target_option_must_be_es3_or_es5
|
||||
error: Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
|
||||
@ -232,7 +232,8 @@ module ts {
|
||||
|
||||
messageText: text,
|
||||
category: message.category,
|
||||
code: message.code
|
||||
code: message.code,
|
||||
isEarly: message.isEarly
|
||||
};
|
||||
}
|
||||
|
||||
@ -251,7 +252,8 @@ module ts {
|
||||
|
||||
messageText: text,
|
||||
category: message.category,
|
||||
code: message.code
|
||||
code: message.code,
|
||||
isEarly: message.isEarly
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,12 @@ module ts {
|
||||
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." },
|
||||
Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" },
|
||||
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
|
||||
An_enum_member_cannot_have_a_numeric_name: { code: 1151, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." },
|
||||
var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." },
|
||||
let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." },
|
||||
const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." },
|
||||
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
|
||||
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
|
||||
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
@ -261,6 +266,11 @@ module ts {
|
||||
Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." },
|
||||
Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." },
|
||||
The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: DiagnosticCategory.Error, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." },
|
||||
Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: DiagnosticCategory.Error, key: "Block-scoped variable '{0}' used before its declaration.", isEarly: true },
|
||||
The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator cannot be a constant.", isEarly: true },
|
||||
Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true },
|
||||
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true },
|
||||
An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
@ -355,7 +365,7 @@ module ts {
|
||||
Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_or_ES5: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), or 'ES5'" },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
@ -377,7 +387,7 @@ module ts {
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
|
||||
Argument_for_target_option_must_be_es3_or_es5: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3' or 'es5'." },
|
||||
Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." },
|
||||
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
|
||||
@ -447,9 +447,29 @@
|
||||
"category": "Error",
|
||||
"code": 1150
|
||||
},
|
||||
"An enum member cannot have a numeric name.": {
|
||||
"'var', 'let' or 'const' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1151
|
||||
"code": 1152
|
||||
},
|
||||
"'let' declarations are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1153
|
||||
},
|
||||
"'const' declarations are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1154
|
||||
},
|
||||
"'const' declarations must be initialized": {
|
||||
"category": "Error",
|
||||
"code": 1155
|
||||
},
|
||||
"'const' declarations can only be declared inside a block.": {
|
||||
"category": "Error",
|
||||
"code": 1156
|
||||
},
|
||||
"'let' declarations can only be declared inside a block.": {
|
||||
"category": "Error",
|
||||
"code": 1157
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
@ -1036,6 +1056,30 @@
|
||||
"category": "Error",
|
||||
"code": 2447
|
||||
},
|
||||
"Block-scoped variable '{0}' used before its declaration.": {
|
||||
"category": "Error",
|
||||
"code": 2448,
|
||||
"isEarly": true
|
||||
},
|
||||
"The operand of an increment or decrement operator cannot be a constant.": {
|
||||
"category": "Error",
|
||||
"code": 2449,
|
||||
"isEarly": true
|
||||
},
|
||||
"Left-hand side of assignment expression cannot be a constant.": {
|
||||
"category": "Error",
|
||||
"code": 2450,
|
||||
"isEarly": true
|
||||
},
|
||||
"Cannot redeclare block-scoped variable '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2451,
|
||||
"isEarly": true
|
||||
},
|
||||
"An enum member cannot have a numeric name.": {
|
||||
"category": "Error",
|
||||
"code": 2452
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@ -1416,7 +1460,7 @@
|
||||
"category": "Message",
|
||||
"code": 6009
|
||||
},
|
||||
"Specify ECMAScript target version: 'ES3' (default), or 'ES5'": {
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
@ -1504,7 +1548,7 @@
|
||||
"category": "Error",
|
||||
"code": 6046
|
||||
},
|
||||
"Argument for '--target' option must be 'es3' or 'es5'.": {
|
||||
"Argument for '--target' option must be 'es3', 'es5', or 'es6'.": {
|
||||
"category": "Error",
|
||||
"code": 6047
|
||||
},
|
||||
|
||||
@ -4,8 +4,11 @@
|
||||
/// <reference path="parser.ts"/>
|
||||
|
||||
module ts {
|
||||
interface EmitTextWriter extends SymbolWriter {
|
||||
interface EmitTextWriter {
|
||||
write(s: string): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
decreaseIndent(): void;
|
||||
getText(): string;
|
||||
rawWrite(s: string): void;
|
||||
writeLiteral(s: string): void;
|
||||
@ -15,6 +18,9 @@ module ts {
|
||||
getIndent(): number;
|
||||
}
|
||||
|
||||
interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter{
|
||||
}
|
||||
|
||||
var indentStrings: string[] = ["", " "];
|
||||
export function getIndentString(level: number) {
|
||||
if (indentStrings[level] === undefined) {
|
||||
@ -103,7 +109,7 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
function createTextWriter(trackSymbol: (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags)=> void): EmitTextWriter {
|
||||
function createTextWriter(): EmitTextWriter {
|
||||
var output = "";
|
||||
var indent = 0;
|
||||
var lineStart = true;
|
||||
@ -149,17 +155,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function writeKind(text: string, kind: SymbolDisplayPartKind) {
|
||||
write(text);
|
||||
}
|
||||
function writeSymbol(text: string, symbol: Symbol) {
|
||||
write(text);
|
||||
}
|
||||
return {
|
||||
write: write,
|
||||
trackSymbol: trackSymbol,
|
||||
writeKind: writeKind,
|
||||
writeSymbol: writeSymbol,
|
||||
rawWrite: rawWrite,
|
||||
writeLiteral: writeLiteral,
|
||||
writeLine: writeLine,
|
||||
@ -170,7 +167,6 @@ module ts {
|
||||
getLine: () => lineCount + 1,
|
||||
getColumn: () => lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1,
|
||||
getText: () => output,
|
||||
clear: () => { }
|
||||
};
|
||||
}
|
||||
|
||||
@ -318,7 +314,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitJavaScript(jsFilePath: string, root?: SourceFile) {
|
||||
var writer = createTextWriter(trackSymbol);
|
||||
var writer = createTextWriter();
|
||||
var write = writer.write;
|
||||
var writeLine = writer.writeLine;
|
||||
var increaseIndent = writer.increaseIndent;
|
||||
@ -374,8 +370,6 @@ module ts {
|
||||
/** Sourcemap data that will get encoded */
|
||||
var sourceMapData: SourceMapData;
|
||||
|
||||
function trackSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) { }
|
||||
|
||||
function initializeEmitterWithSourceMaps() {
|
||||
var sourceMapDir: string; // The directory in which sourcemap will be
|
||||
|
||||
@ -1149,7 +1143,15 @@ module ts {
|
||||
write(" ");
|
||||
endPos = emitToken(SyntaxKind.OpenParenToken, endPos);
|
||||
if (node.declarations) {
|
||||
emitToken(SyntaxKind.VarKeyword, endPos);
|
||||
if (node.declarations[0] && node.declarations[0].flags & NodeFlags.Let) {
|
||||
emitToken(SyntaxKind.LetKeyword, endPos);
|
||||
}
|
||||
else if (node.declarations[0] && node.declarations[0].flags & NodeFlags.Const) {
|
||||
emitToken(SyntaxKind.ConstKeyword, endPos);
|
||||
}
|
||||
else {
|
||||
emitToken(SyntaxKind.VarKeyword, endPos);
|
||||
}
|
||||
write(" ");
|
||||
emitCommaList(node.declarations, /*includeTrailingComma*/ false);
|
||||
}
|
||||
@ -1169,7 +1171,12 @@ module ts {
|
||||
write(" ");
|
||||
endPos = emitToken(SyntaxKind.OpenParenToken, endPos);
|
||||
if (node.declaration) {
|
||||
emitToken(SyntaxKind.VarKeyword, endPos);
|
||||
if (node.declaration.flags & NodeFlags.Let) {
|
||||
emitToken(SyntaxKind.LetKeyword, endPos);
|
||||
}
|
||||
else {
|
||||
emitToken(SyntaxKind.VarKeyword, endPos);
|
||||
}
|
||||
write(" ");
|
||||
emit(node.declaration);
|
||||
}
|
||||
@ -1298,7 +1305,17 @@ module ts {
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
emitLeadingComments(node);
|
||||
if (!(node.flags & NodeFlags.Export)) write("var ");
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
if (node.flags & NodeFlags.Let) {
|
||||
write("let ");
|
||||
}
|
||||
else if (node.flags & NodeFlags.Const) {
|
||||
write("const ");
|
||||
}
|
||||
else {
|
||||
write("var ");
|
||||
}
|
||||
}
|
||||
emitCommaList(node.declarations, /*includeTrailingComma*/ false);
|
||||
write(";");
|
||||
emitTrailingComments(node);
|
||||
@ -2314,7 +2331,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitDeclarations(jsFilePath: string, root?: SourceFile) {
|
||||
var writer = createTextWriter(trackSymbol);
|
||||
var writer = createTextWriterWithSymbolWriter();
|
||||
var write = writer.write;
|
||||
var writeLine = writer.writeLine;
|
||||
var increaseIndent = writer.increaseIndent;
|
||||
@ -2338,11 +2355,24 @@ module ts {
|
||||
typeName?: Identifier
|
||||
}
|
||||
|
||||
function createTextWriterWithSymbolWriter(): EmitTextWriterWithSymbolWriter {
|
||||
var writer = <EmitTextWriterWithSymbolWriter>createTextWriter();
|
||||
writer.trackSymbol = trackSymbol;
|
||||
writer.writeKeyword = writer.write;
|
||||
writer.writeOperator = writer.write;
|
||||
writer.writePunctuation = writer.write;
|
||||
writer.writeSpace = writer.write;
|
||||
writer.writeStringLiteral = writer.writeLiteral;
|
||||
writer.writeParameter = writer.write;
|
||||
writer.writeSymbol = writer.write;
|
||||
return writer;
|
||||
}
|
||||
|
||||
function writeAsychronousImportDeclarations(importDeclarations: ImportDeclaration[]) {
|
||||
var oldWriter = writer;
|
||||
forEach(importDeclarations, aliasToWrite => {
|
||||
var aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined);
|
||||
writer = createTextWriter(trackSymbol);
|
||||
writer = createTextWriterWithSymbolWriter();
|
||||
for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) {
|
||||
writer.increaseIndent();
|
||||
}
|
||||
@ -2822,7 +2852,15 @@ module ts {
|
||||
if (hasDeclarationWithEmit) {
|
||||
emitJsDocComments(node);
|
||||
emitDeclarationFlags(node);
|
||||
write("var ");
|
||||
if (node.flags & NodeFlags.Let) {
|
||||
write("let ");
|
||||
}
|
||||
else if (node.flags & NodeFlags.Const) {
|
||||
write("const ");
|
||||
}
|
||||
else {
|
||||
write("var ");
|
||||
}
|
||||
emitCommaList(node.declarations, emitVariableDeclaration);
|
||||
write(";");
|
||||
writeLine();
|
||||
@ -2861,7 +2899,7 @@ module ts {
|
||||
}
|
||||
return {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node.parameters[0],
|
||||
errorNode: <Node>node.parameters[0],
|
||||
typeName: node.name
|
||||
};
|
||||
}
|
||||
@ -2882,7 +2920,7 @@ module ts {
|
||||
}
|
||||
return {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node.name,
|
||||
errorNode: <Node>node.name,
|
||||
typeName: undefined
|
||||
};
|
||||
}
|
||||
@ -3233,11 +3271,14 @@ module ts {
|
||||
}
|
||||
|
||||
var hasSemanticErrors = resolver.hasSemanticErrors();
|
||||
var hasEarlyErrors = resolver.hasEarlyErrors(targetSourceFile);
|
||||
|
||||
function emitFile(jsFilePath: string, sourceFile?: SourceFile) {
|
||||
emitJavaScript(jsFilePath, sourceFile);
|
||||
if (!hasSemanticErrors && compilerOptions.declaration) {
|
||||
emitDeclarations(jsFilePath, sourceFile);
|
||||
if (!hasEarlyErrors) {
|
||||
emitJavaScript(jsFilePath, sourceFile);
|
||||
if (!hasSemanticErrors && compilerOptions.declaration) {
|
||||
emitDeclarations(jsFilePath, sourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3277,7 +3318,9 @@ module ts {
|
||||
|
||||
// Check and update returnCode for syntactic and semantic
|
||||
var returnCode: EmitReturnStatus;
|
||||
if (hasEmitterError) {
|
||||
if (hasEarlyErrors) {
|
||||
returnCode = EmitReturnStatus.AllOutputGenerationSkipped;
|
||||
} else if (hasEmitterError) {
|
||||
returnCode = EmitReturnStatus.EmitErrorsEncountered;
|
||||
} else if (hasSemanticErrors && compilerOptions.declaration) {
|
||||
returnCode = EmitReturnStatus.DeclarationGenerationSkipped;
|
||||
|
||||
@ -67,6 +67,77 @@ module ts {
|
||||
return identifier.kind === SyntaxKind.Missing ? "(Missing)" : getTextOfNode(identifier);
|
||||
}
|
||||
|
||||
export function isExpression(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.IndexedAccess:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.PrefixOperator:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.OmittedExpression:
|
||||
return true;
|
||||
case SyntaxKind.QualifiedName:
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) node = node.parent;
|
||||
return node.parent.kind === SyntaxKind.TypeQuery;
|
||||
case SyntaxKind.Identifier:
|
||||
if (node.parent.kind === SyntaxKind.TypeQuery) {
|
||||
return true;
|
||||
}
|
||||
// Fall through
|
||||
case SyntaxKind.NumericLiteral:
|
||||
case SyntaxKind.StringLiteral:
|
||||
var parent = node.parent;
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return (<VariableDeclaration>parent).initializer === node;
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.WithStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.ThrowStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return (<ExpressionStatement>parent).expression === node;
|
||||
case SyntaxKind.ForStatement:
|
||||
return (<ForStatement>parent).initializer === node ||
|
||||
(<ForStatement>parent).condition === node ||
|
||||
(<ForStatement>parent).iterator === node;
|
||||
case SyntaxKind.ForInStatement:
|
||||
return (<ForInStatement>parent).variable === node ||
|
||||
(<ForInStatement>parent).expression === node;
|
||||
case SyntaxKind.TypeAssertion:
|
||||
return node === (<TypeAssertion>parent).operand;
|
||||
default:
|
||||
if (isExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
@ -227,6 +298,8 @@ module ts {
|
||||
return children((<TupleTypeNode>node).elementTypes);
|
||||
case SyntaxKind.UnionType:
|
||||
return children((<UnionTypeNode>node).types);
|
||||
case SyntaxKind.ParenType:
|
||||
return child((<ParenTypeNode>node).type);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return children((<ArrayLiteral>node).elements);
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
@ -1076,7 +1149,7 @@ module ts {
|
||||
return isParameter();
|
||||
case ParsingContext.TypeArguments:
|
||||
case ParsingContext.TupleElementTypes:
|
||||
return isType();
|
||||
return token === SyntaxKind.CommaToken || isType();
|
||||
}
|
||||
|
||||
Debug.fail("Non-exhaustive case in 'isListElement'.");
|
||||
@ -1658,6 +1731,14 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseParenType(): ParenTypeNode {
|
||||
var node = <ParenTypeNode>createNode(SyntaxKind.ParenType);
|
||||
parseExpected(SyntaxKind.OpenParenToken);
|
||||
node.type = parseType();
|
||||
parseExpected(SyntaxKind.CloseParenToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseFunctionType(signatureKind: SyntaxKind): TypeLiteralNode {
|
||||
var node = <TypeLiteralNode>createNode(SyntaxKind.TypeLiteral);
|
||||
var member = <SignatureDeclaration>createNode(signatureKind);
|
||||
@ -1691,10 +1772,7 @@ module ts {
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return parseTupleType();
|
||||
case SyntaxKind.OpenParenToken:
|
||||
case SyntaxKind.LessThanToken:
|
||||
return parseFunctionType(SyntaxKind.CallSignature);
|
||||
case SyntaxKind.NewKeyword:
|
||||
return parseFunctionType(SyntaxKind.ConstructSignature);
|
||||
return parseParenType();
|
||||
default:
|
||||
if (isIdentifier()) {
|
||||
return parseTypeReference();
|
||||
@ -1718,18 +1796,18 @@ module ts {
|
||||
case SyntaxKind.NewKeyword:
|
||||
return true;
|
||||
case SyntaxKind.OpenParenToken:
|
||||
// Only consider an ( as the start of a type if we have () or (id
|
||||
// We don't want to consider things like (1) as a function type.
|
||||
// Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier,
|
||||
// or something that starts a type. We don't want to consider things like '(1)' a type.
|
||||
return lookAhead(() => {
|
||||
nextToken();
|
||||
return token === SyntaxKind.CloseParenToken || isParameter();
|
||||
return token === SyntaxKind.CloseParenToken || isParameter() || isType();
|
||||
});
|
||||
default:
|
||||
return isIdentifier();
|
||||
}
|
||||
}
|
||||
|
||||
function parseNonUnionType(): TypeNode {
|
||||
function parsePrimaryType(): TypeNode {
|
||||
var type = parseNonArrayType();
|
||||
while (!scanner.hasPrecedingLineBreak() && parseOptional(SyntaxKind.OpenBracketToken)) {
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
@ -1740,13 +1818,13 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function parseType(): TypeNode {
|
||||
var type = parseNonUnionType();
|
||||
function parseUnionType(): TypeNode {
|
||||
var type = parsePrimaryType();
|
||||
if (token === SyntaxKind.BarToken) {
|
||||
var types = <NodeArray<TypeNode>>[type];
|
||||
types.pos = type.pos;
|
||||
while (parseOptional(SyntaxKind.BarToken)) {
|
||||
types.push(parseNonUnionType());
|
||||
types.push(parsePrimaryType());
|
||||
}
|
||||
types.end = getNodeEnd();
|
||||
var node = <UnionTypeNode>createNode(SyntaxKind.UnionType, type.pos);
|
||||
@ -1756,6 +1834,48 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function isFunctionType(): boolean {
|
||||
return token === SyntaxKind.LessThanToken || token === SyntaxKind.OpenParenToken && lookAhead(() => {
|
||||
nextToken();
|
||||
if (token === SyntaxKind.CloseParenToken || token === SyntaxKind.DotDotDotToken) {
|
||||
// ( )
|
||||
// ( ...
|
||||
return true;
|
||||
}
|
||||
if (isIdentifier() || isModifier(token)) {
|
||||
nextToken();
|
||||
if (token === SyntaxKind.ColonToken || token === SyntaxKind.CommaToken ||
|
||||
token === SyntaxKind.QuestionToken || token === SyntaxKind.EqualsToken ||
|
||||
isIdentifier() || isModifier(token)) {
|
||||
// ( id :
|
||||
// ( id ,
|
||||
// ( id ?
|
||||
// ( id =
|
||||
// ( modifier id
|
||||
return true;
|
||||
}
|
||||
if (token === SyntaxKind.CloseParenToken) {
|
||||
nextToken();
|
||||
if (token === SyntaxKind.EqualsGreaterThanToken) {
|
||||
// ( id ) =>
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function parseType(): TypeNode {
|
||||
if (isFunctionType()) {
|
||||
return parseFunctionType(SyntaxKind.CallSignature);
|
||||
}
|
||||
if (token === SyntaxKind.NewKeyword) {
|
||||
return parseFunctionType(SyntaxKind.ConstructSignature);
|
||||
}
|
||||
return parseUnionType();
|
||||
}
|
||||
|
||||
function parseTypeAnnotation(): TypeNode {
|
||||
return parseOptional(SyntaxKind.ColonToken) ? parseType() : undefined;
|
||||
}
|
||||
@ -2342,13 +2462,29 @@ module ts {
|
||||
function parseTypeArguments(): NodeArray<TypeNode> {
|
||||
var typeArgumentListStart = scanner.getTokenPos();
|
||||
var errorCountBeforeTypeParameterList = file.syntacticErrors.length;
|
||||
var result = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
|
||||
// We pass parseSingleTypeArgument instead of parseType as the element parser
|
||||
// because parseSingleTypeArgument knows how to parse a missing type argument.
|
||||
// This is useful for signature help. parseType has the disadvantage that when
|
||||
// it sees a missing type, it changes the LookAheadMode to Error, and the result
|
||||
// is a broken binary expression, which breaks signature help.
|
||||
var result = parseBracketedList(ParsingContext.TypeArguments, parseSingleTypeArgument, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
|
||||
if (!result.length && file.syntacticErrors.length === errorCountBeforeTypeParameterList) {
|
||||
grammarErrorAtPos(typeArgumentListStart, scanner.getStartPos() - typeArgumentListStart, Diagnostics.Type_argument_list_cannot_be_empty);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseSingleTypeArgument(): TypeNode {
|
||||
if (token === SyntaxKind.CommaToken) {
|
||||
var errorStart = scanner.getTokenPos();
|
||||
var errorLength = scanner.getTextPos() - errorStart;
|
||||
grammarErrorAtPos(errorStart, errorLength, Diagnostics.Type_expected);
|
||||
return createNode(SyntaxKind.Missing);
|
||||
}
|
||||
|
||||
return parseType();
|
||||
}
|
||||
|
||||
function parsePrimaryExpression(): Expression {
|
||||
switch (token) {
|
||||
case SyntaxKind.ThisKeyword:
|
||||
@ -2558,11 +2694,14 @@ module ts {
|
||||
}
|
||||
|
||||
// STATEMENTS
|
||||
function parseStatementAllowingLetDeclaration() {
|
||||
return parseStatement(/*allowLetAndConstDeclarations*/ true);
|
||||
}
|
||||
|
||||
function parseBlock(ignoreMissingOpenBrace: boolean, checkForStrictMode: boolean): Block {
|
||||
var node = <Block>createNode(SyntaxKind.Block);
|
||||
if (parseExpected(SyntaxKind.OpenBraceToken) || ignoreMissingOpenBrace) {
|
||||
node.statements = parseList(ParsingContext.BlockStatements,checkForStrictMode, parseStatement);
|
||||
node.statements = parseList(ParsingContext.BlockStatements, checkForStrictMode, parseStatementAllowingLetDeclaration);
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
}
|
||||
else {
|
||||
@ -2608,8 +2747,8 @@ module ts {
|
||||
parseExpected(SyntaxKind.OpenParenToken);
|
||||
node.expression = parseExpression();
|
||||
parseExpected(SyntaxKind.CloseParenToken);
|
||||
node.thenStatement = parseStatement();
|
||||
node.elseStatement = parseOptional(SyntaxKind.ElseKeyword) ? parseStatement() : undefined;
|
||||
node.thenStatement = parseStatement(/*allowLetAndConstDeclarations*/ false);
|
||||
node.elseStatement = parseOptional(SyntaxKind.ElseKeyword) ? parseStatement(/*allowLetAndConstDeclarations*/ false) : undefined;
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@ -2619,7 +2758,7 @@ module ts {
|
||||
|
||||
var saveInIterationStatement = inIterationStatement;
|
||||
inIterationStatement = ControlBlockContext.Nested;
|
||||
node.statement = parseStatement();
|
||||
node.statement = parseStatement(/*allowLetAndConstDeclarations*/ false);
|
||||
inIterationStatement = saveInIterationStatement;
|
||||
|
||||
parseExpected(SyntaxKind.WhileKeyword);
|
||||
@ -2644,7 +2783,7 @@ module ts {
|
||||
|
||||
var saveInIterationStatement = inIterationStatement;
|
||||
inIterationStatement = ControlBlockContext.Nested;
|
||||
node.statement = parseStatement();
|
||||
node.statement = parseStatement(/*allowLetAndConstDeclarations*/ false);
|
||||
inIterationStatement = saveInIterationStatement;
|
||||
|
||||
return finishNode(node);
|
||||
@ -2656,11 +2795,29 @@ module ts {
|
||||
parseExpected(SyntaxKind.OpenParenToken);
|
||||
if (token !== SyntaxKind.SemicolonToken) {
|
||||
if (parseOptional(SyntaxKind.VarKeyword)) {
|
||||
var declarations = parseVariableDeclarationList(0, true);
|
||||
var declarations = parseVariableDeclarationList(0, /*noIn*/ true);
|
||||
if (!declarations.length) {
|
||||
error(Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
}
|
||||
}
|
||||
else if (parseOptional(SyntaxKind.LetKeyword)) {
|
||||
var declarations = parseVariableDeclarationList(NodeFlags.Let, /*noIn*/ true);
|
||||
if (!declarations.length) {
|
||||
error(Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
}
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
grammarErrorAtPos(declarations.pos, declarations.end - declarations.pos, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
}
|
||||
else if (parseOptional(SyntaxKind.ConstKeyword)) {
|
||||
var declarations = parseVariableDeclarationList(NodeFlags.Const, /*noIn*/ true);
|
||||
if (!declarations.length) {
|
||||
error(Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
}
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
grammarErrorAtPos(declarations.pos, declarations.end - declarations.pos, Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var varOrInit = parseExpression(true);
|
||||
}
|
||||
@ -2699,7 +2856,7 @@ module ts {
|
||||
|
||||
var saveInIterationStatement = inIterationStatement;
|
||||
inIterationStatement = ControlBlockContext.Nested;
|
||||
forOrForInStatement.statement = parseStatement();
|
||||
forOrForInStatement.statement = parseStatement(/*allowLetAndConstDeclarations*/ false);
|
||||
inIterationStatement = saveInIterationStatement;
|
||||
|
||||
return finishNode(forOrForInStatement);
|
||||
@ -2810,7 +2967,7 @@ module ts {
|
||||
parseExpected(SyntaxKind.OpenParenToken);
|
||||
node.expression = parseExpression();
|
||||
parseExpected(SyntaxKind.CloseParenToken);
|
||||
node.statement = parseStatement();
|
||||
node.statement = parseStatement(/*allowLetAndConstDeclarations*/ false);
|
||||
node = finishNode(node);
|
||||
if (isInStrictMode) {
|
||||
// Strict mode code may not include a WithStatement. The occurrence of a WithStatement in such
|
||||
@ -2825,7 +2982,7 @@ module ts {
|
||||
parseExpected(SyntaxKind.CaseKeyword);
|
||||
node.expression = parseExpression();
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
node.statements = parseList(ParsingContext.SwitchClauseStatements, /*checkForStrictMode*/ false, parseStatement);
|
||||
node.statements = parseList(ParsingContext.SwitchClauseStatements, /*checkForStrictMode*/ false, parseStatementAllowingLetDeclaration);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@ -2833,7 +2990,7 @@ module ts {
|
||||
var node = <CaseOrDefaultClause>createNode(SyntaxKind.DefaultClause);
|
||||
parseExpected(SyntaxKind.DefaultKeyword);
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
node.statements = parseList(ParsingContext.SwitchClauseStatements, /*checkForStrictMode*/ false, parseStatement);
|
||||
node.statements = parseList(ParsingContext.SwitchClauseStatements, /*checkForStrictMode*/ false, parseStatementAllowingLetDeclaration);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@ -2940,9 +3097,9 @@ module ts {
|
||||
return token === SyntaxKind.WhileKeyword || token === SyntaxKind.DoKeyword || token === SyntaxKind.ForKeyword;
|
||||
}
|
||||
|
||||
function parseStatementWithLabelSet(): Statement {
|
||||
function parseStatementWithLabelSet(allowLetAndConstDeclarations: boolean): Statement {
|
||||
labelledStatementInfo.pushCurrentLabelSet(isIterationStatementStart());
|
||||
var statement = parseStatement();
|
||||
var statement = parseStatement(allowLetAndConstDeclarations);
|
||||
labelledStatementInfo.pop();
|
||||
return statement;
|
||||
}
|
||||
@ -2951,7 +3108,7 @@ module ts {
|
||||
return isIdentifier() && lookAhead(() => nextToken() === SyntaxKind.ColonToken);
|
||||
}
|
||||
|
||||
function parseLabelledStatement(): LabeledStatement {
|
||||
function parseLabeledStatement(allowLetAndConstDeclarations: boolean): LabeledStatement {
|
||||
var node = <LabeledStatement>createNode(SyntaxKind.LabeledStatement);
|
||||
node.label = parseIdentifier();
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
@ -2963,7 +3120,7 @@ module ts {
|
||||
|
||||
// We only want to call parseStatementWithLabelSet when the label set is complete
|
||||
// Therefore, keep parsing labels until we know we're done.
|
||||
node.statement = isLabel() ? parseLabelledStatement() : parseStatementWithLabelSet();
|
||||
node.statement = isLabel() ? parseLabeledStatement(allowLetAndConstDeclarations) : parseStatementWithLabelSet(allowLetAndConstDeclarations);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@ -2986,6 +3143,8 @@ module ts {
|
||||
return !inErrorRecovery;
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
case SyntaxKind.VarKeyword:
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
case SyntaxKind.IfKeyword:
|
||||
case SyntaxKind.DoKeyword:
|
||||
@ -3027,12 +3186,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function parseStatement(): Statement {
|
||||
function parseStatement(allowLetAndConstDeclarations: boolean): Statement {
|
||||
switch (token) {
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return parseBlock(/* ignoreMissingOpenBrace */ false, /*checkForStrictMode*/ false);
|
||||
case SyntaxKind.VarKeyword:
|
||||
return parseVariableStatement();
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
return parseVariableStatement(allowLetAndConstDeclarations);
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return parseFunctionDeclaration();
|
||||
case SyntaxKind.SemicolonToken:
|
||||
@ -3066,16 +3227,12 @@ module ts {
|
||||
return parseDebuggerStatement();
|
||||
default:
|
||||
if (isLabel()) {
|
||||
return parseLabelledStatement();
|
||||
return parseLabeledStatement(allowLetAndConstDeclarations);
|
||||
}
|
||||
return parseExpressionStatement();
|
||||
}
|
||||
}
|
||||
|
||||
function parseStatementOrFunction(): Statement {
|
||||
return token === SyntaxKind.FunctionKeyword ? parseFunctionDeclaration() : parseStatement();
|
||||
}
|
||||
|
||||
function parseAndCheckFunctionBody(isConstructor: boolean): Block {
|
||||
var initialPosition = scanner.getTokenPos();
|
||||
var errorCountBeforeBody = file.syntacticErrors.length;
|
||||
@ -3111,6 +3268,9 @@ module ts {
|
||||
if (inAmbientContext && node.initializer && errorCountBeforeVariableDeclaration === file.syntacticErrors.length) {
|
||||
grammarErrorAtPos(initializerStart, initializerFirstTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
}
|
||||
if (!inAmbientContext && !node.initializer && flags & NodeFlags.Const) {
|
||||
grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized);
|
||||
}
|
||||
if (isInStrictMode && isEvalOrArgumentsIdentifier(node.name)) {
|
||||
// It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code
|
||||
// and its Identifier is eval or arguments
|
||||
@ -3124,17 +3284,42 @@ module ts {
|
||||
() => parseVariableDeclaration(flags, noIn), /*allowTrailingComma*/ false);
|
||||
}
|
||||
|
||||
function parseVariableStatement(pos?: number, flags?: NodeFlags): VariableStatement {
|
||||
function parseVariableStatement(allowLetAndConstDeclarations: boolean, pos?: number, flags?: NodeFlags): VariableStatement {
|
||||
var node = <VariableStatement>createNode(SyntaxKind.VariableStatement, pos);
|
||||
if (flags) node.flags = flags;
|
||||
var errorCountBeforeVarStatement = file.syntacticErrors.length;
|
||||
parseExpected(SyntaxKind.VarKeyword);
|
||||
node.declarations = parseVariableDeclarationList(flags, /*noIn*/false);
|
||||
if (token === SyntaxKind.LetKeyword) {
|
||||
node.flags |= NodeFlags.Let;
|
||||
}
|
||||
else if (token === SyntaxKind.ConstKeyword) {
|
||||
node.flags |= NodeFlags.Const;
|
||||
}
|
||||
else if (token !== SyntaxKind.VarKeyword) {
|
||||
error(Diagnostics.var_let_or_const_expected);
|
||||
}
|
||||
nextToken();
|
||||
node.declarations = parseVariableDeclarationList(node.flags, /*noIn*/false);
|
||||
parseSemicolon();
|
||||
finishNode(node);
|
||||
if (!node.declarations.length && file.syntacticErrors.length === errorCountBeforeVarStatement) {
|
||||
grammarErrorOnNode(node, Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
}
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
if (node.flags & NodeFlags.Let) {
|
||||
grammarErrorOnNode(node, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
else if (node.flags & NodeFlags.Const) {
|
||||
grammarErrorOnNode(node, Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
}
|
||||
else if (!allowLetAndConstDeclarations) {
|
||||
if (node.flags & NodeFlags.Let) {
|
||||
grammarErrorOnNode(node, Diagnostics.let_declarations_can_only_be_declared_inside_a_block);
|
||||
}
|
||||
else if (node.flags & NodeFlags.Const) {
|
||||
grammarErrorOnNode(node, Diagnostics.const_declarations_can_only_be_declared_inside_a_block);
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -3713,6 +3898,8 @@ module ts {
|
||||
function isDeclaration(): boolean {
|
||||
switch (token) {
|
||||
case SyntaxKind.VarKeyword:
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return true;
|
||||
case SyntaxKind.ClassKeyword:
|
||||
@ -3763,7 +3950,9 @@ module ts {
|
||||
var result: Declaration;
|
||||
switch (token) {
|
||||
case SyntaxKind.VarKeyword:
|
||||
result = parseVariableStatement(pos, flags);
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
result = parseVariableStatement(/*allowLetAndConstDeclarations*/ true, pos, flags);
|
||||
break;
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
result = parseFunctionDeclaration(pos, flags);
|
||||
@ -3811,7 +4000,7 @@ module ts {
|
||||
var statementStart = scanner.getTokenPos();
|
||||
var statementFirstTokenLength = scanner.getTextPos() - statementStart;
|
||||
var errorCountBeforeStatement = file.syntacticErrors.length;
|
||||
var statement = parseStatement();
|
||||
var statement = parseStatement(/*allowLetAndConstDeclarations*/ true);
|
||||
|
||||
if (inAmbientContext && file.syntacticErrors.length === errorCountBeforeStatement) {
|
||||
grammarErrorAtPos(statementStart, statementFirstTokenLength, Diagnostics.Statements_are_not_allowed_in_ambient_contexts);
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/// <reference path="diagnosticInformationMap.generated.ts"/>
|
||||
|
||||
interface System {
|
||||
args: string[];
|
||||
@ -68,7 +67,7 @@ var sys: System = (function () {
|
||||
return fileStream.ReadText();
|
||||
}
|
||||
catch (e) {
|
||||
throw e.number === -2147024809 ? new Error(ts.Diagnostics.Unsupported_file_encoding.key) : e;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
fileStream.Close();
|
||||
|
||||
@ -142,14 +142,19 @@ module ts {
|
||||
// otherwise use toLowerCase as a canonical form.
|
||||
return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
// returned by CScript sys environment
|
||||
var unsupportedFileEncodingErrorCode = -2147024809;
|
||||
|
||||
function getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile {
|
||||
try {
|
||||
var text = sys.readFile(filename, options.charset);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
onError(e.message);
|
||||
onError(e.number === unsupportedFileEncodingErrorCode ?
|
||||
getDiagnosticText(Diagnostics.Unsupported_file_encoding) :
|
||||
e.message);
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
@ -356,13 +361,18 @@ module ts {
|
||||
else {
|
||||
var checker = program.getTypeChecker(/*fullTypeCheckMode*/ true);
|
||||
var checkStart = new Date().getTime();
|
||||
var semanticErrors = checker.getDiagnostics();
|
||||
var emitStart = new Date().getTime();
|
||||
var emitOutput = checker.emitFiles();
|
||||
var emitErrors = emitOutput.errors;
|
||||
exitStatus = emitOutput.emitResultStatus;
|
||||
var reportStart = new Date().getTime();
|
||||
errors = concatenate(semanticErrors, emitErrors);
|
||||
errors = checker.getDiagnostics();
|
||||
if (!checker.hasEarlyErrors()) {
|
||||
var emitStart = new Date().getTime();
|
||||
var emitOutput = checker.emitFiles();
|
||||
var emitErrors = emitOutput.errors;
|
||||
exitStatus = emitOutput.emitResultStatus;
|
||||
var reportStart = new Date().getTime();
|
||||
errors = concatenate(errors, emitErrors);
|
||||
}
|
||||
else {
|
||||
exitStatus = EmitReturnStatus.AllOutputGenerationSkipped;
|
||||
}
|
||||
}
|
||||
|
||||
reportDiagnostics(errors);
|
||||
|
||||
@ -155,6 +155,7 @@ module ts {
|
||||
ArrayType,
|
||||
TupleType,
|
||||
UnionType,
|
||||
ParenType,
|
||||
// Expression
|
||||
ArrayLiteral,
|
||||
ObjectLiteral,
|
||||
@ -225,7 +226,7 @@ module ts {
|
||||
FirstFutureReservedWord = ImplementsKeyword,
|
||||
LastFutureReservedWord = YieldKeyword,
|
||||
FirstTypeNode = TypeReference,
|
||||
LastTypeNode = UnionType,
|
||||
LastTypeNode = ParenType,
|
||||
FirstPunctuation = OpenBraceToken,
|
||||
LastPunctuation = CaretEqualsToken,
|
||||
FirstToken = EndOfFileToken,
|
||||
@ -250,9 +251,12 @@ module ts {
|
||||
MultiLine = 0x00000100, // Multi-line array or object literal
|
||||
Synthetic = 0x00000200, // Synthetic node (for full fidelity)
|
||||
DeclarationFile = 0x00000400, // Node is a .d.ts file
|
||||
Let = 0x00000800, // Variable declaration
|
||||
Const = 0x00001000, // Variable declaration
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static,
|
||||
AccessibilityModifier = Public | Private | Protected
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
BlockScoped = Let | Const
|
||||
}
|
||||
|
||||
export interface Node extends TextRange {
|
||||
@ -346,6 +350,10 @@ module ts {
|
||||
types: NodeArray<TypeNode>;
|
||||
}
|
||||
|
||||
export interface ParenTypeNode extends TypeNode {
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
export interface StringLiteralTypeNode extends TypeNode {
|
||||
text: string;
|
||||
}
|
||||
@ -644,30 +652,26 @@ module ts {
|
||||
getParentOfSymbol(symbol: Symbol): Symbol;
|
||||
getTypeOfSymbol(symbol: Symbol): Type;
|
||||
getPropertiesOfType(type: Type): Symbol[];
|
||||
getPropertyOfType(type: Type, propetyName: string): Symbol;
|
||||
getPropertyOfType(type: Type, propertyName: string): Symbol;
|
||||
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
getSymbolInfo(node: Node): Symbol;
|
||||
getTypeOfNode(node: Node): Type;
|
||||
getApparentType(type: Type): ApparentType;
|
||||
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
||||
writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
||||
writeSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
|
||||
getSymbolDisplayBuilder(): SymbolDisplayBuilder;
|
||||
getFullyQualifiedName(symbol: Symbol): string;
|
||||
getAugmentedPropertiesOfApparentType(type: Type): Symbol[];
|
||||
getAugmentedPropertiesOfType(type: Type): Symbol[];
|
||||
getRootSymbols(symbol: Symbol): Symbol[];
|
||||
getContextualType(node: Node): Type;
|
||||
getResolvedSignature(node: CallExpression, candidatesOutArray?: Signature[]): Signature;
|
||||
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
|
||||
writeSignature(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
writeTypeParameter(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
writeTypeParametersOfSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void;
|
||||
isImplementationOfOverload(node: FunctionDeclaration): boolean;
|
||||
isUndefinedSymbol(symbol: Symbol): boolean;
|
||||
isArgumentsSymbol(symbol: Symbol): boolean;
|
||||
hasEarlyErrors(sourceFile?: SourceFile): boolean;
|
||||
|
||||
// Returns the constant value of this enum member, or 'undefined' if the enum member has a
|
||||
// computed value.
|
||||
@ -677,8 +681,25 @@ module ts {
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
}
|
||||
|
||||
export interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
|
||||
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): 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;
|
||||
buildDisplayForParametersAndDelimiters(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;
|
||||
}
|
||||
|
||||
export interface SymbolWriter {
|
||||
writeKind(text: string, kind: SymbolDisplayPartKind): void;
|
||||
writeKeyword(text: string): void;
|
||||
writeOperator(text: string): void;
|
||||
writePunctuation(text: string): void;
|
||||
writeSpace(text: string): void;
|
||||
writeStringLiteral(text: string): void;
|
||||
writeParameter(text: string): void;
|
||||
writeSymbol(text: string, symbol: Symbol): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
@ -699,6 +720,7 @@ module ts {
|
||||
WriteArrowStyleSignature = 0x00000008, // Write arrow style signature
|
||||
WriteOwnNameForAnyLike = 0x00000010, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc)
|
||||
WriteTypeArgumentsOfSignature = 0x00000020, // Write the type arguments instead of type parameters of the signature
|
||||
InElementType = 0x00000040, // Writing an array or union element type
|
||||
}
|
||||
|
||||
export enum SymbolFormatFlags {
|
||||
@ -745,52 +767,62 @@ module ts {
|
||||
// Returns the constant value this property access resolves to, or 'undefined' if it does
|
||||
// resolve to a constant.
|
||||
getConstantValue(node: PropertyAccess): number;
|
||||
hasEarlyErrors(sourceFile?: SourceFile): boolean;
|
||||
}
|
||||
|
||||
export enum SymbolFlags {
|
||||
Variable = 0x00000001, // Variable or parameter
|
||||
Property = 0x00000002, // Property or enum member
|
||||
EnumMember = 0x00000004, // Enum member
|
||||
Function = 0x00000008, // Function
|
||||
Class = 0x00000010, // Class
|
||||
Interface = 0x00000020, // Interface
|
||||
Enum = 0x00000040, // Enum
|
||||
ValueModule = 0x00000080, // Instantiated module
|
||||
NamespaceModule = 0x00000100, // Uninstantiated module
|
||||
TypeLiteral = 0x00000200, // Type Literal
|
||||
ObjectLiteral = 0x00000400, // Object Literal
|
||||
Method = 0x00000800, // Method
|
||||
Constructor = 0x00001000, // Constructor
|
||||
GetAccessor = 0x00002000, // Get accessor
|
||||
SetAccessor = 0x00004000, // Set accessor
|
||||
CallSignature = 0x00008000, // Call signature
|
||||
ConstructSignature = 0x00010000, // Construct signature
|
||||
IndexSignature = 0x00020000, // Index signature
|
||||
TypeParameter = 0x00040000, // Type parameter
|
||||
UnionProperty = 0x00080000, // Property in union type
|
||||
FunctionScopedVariable = 0x00000001, // Variable (var) or parameter
|
||||
Property = 0x00000002, // Property or enum member
|
||||
EnumMember = 0x00000004, // Enum member
|
||||
Function = 0x00000008, // Function
|
||||
Class = 0x00000010, // Class
|
||||
Interface = 0x00000020, // Interface
|
||||
Enum = 0x00000040, // Enum
|
||||
ValueModule = 0x00000080, // Instantiated module
|
||||
NamespaceModule = 0x00000100, // Uninstantiated module
|
||||
TypeLiteral = 0x00000200, // Type Literal
|
||||
ObjectLiteral = 0x00000400, // Object Literal
|
||||
Method = 0x00000800, // Method
|
||||
Constructor = 0x00001000, // Constructor
|
||||
GetAccessor = 0x00002000, // Get accessor
|
||||
SetAccessor = 0x00004000, // Set accessor
|
||||
CallSignature = 0x00008000, // Call signature
|
||||
ConstructSignature = 0x00010000, // Construct signature
|
||||
IndexSignature = 0x00020000, // Index signature
|
||||
TypeParameter = 0x00040000, // Type parameter
|
||||
|
||||
// Export markers (see comment in declareModuleMember in binder)
|
||||
ExportValue = 0x00100000, // Exported value marker
|
||||
ExportType = 0x00200000, // Exported type marker
|
||||
ExportNamespace = 0x00400000, // Exported namespace marker
|
||||
ExportValue = 0x00080000, // Exported value marker
|
||||
ExportType = 0x00100000, // Exported type marker
|
||||
ExportNamespace = 0x00200000, // Exported namespace marker
|
||||
|
||||
Import = 0x00800000, // Import
|
||||
Instantiated = 0x01000000, // Instantiated symbol
|
||||
Merged = 0x02000000, // Merged symbol (created during program binding)
|
||||
Transient = 0x04000000, // Transient symbol (created during type check)
|
||||
Prototype = 0x08000000, // Prototype property (no source representation)
|
||||
Undefined = 0x10000000, // Symbol for the undefined
|
||||
Import = 0x00400000, // Import
|
||||
Instantiated = 0x00800000, // Instantiated symbol
|
||||
Merged = 0x01000000, // Merged symbol (created during program binding)
|
||||
Transient = 0x02000000, // Transient symbol (created during type check)
|
||||
Prototype = 0x04000000, // Prototype property (no source representation)
|
||||
UnionProperty = 0x08000000, // Property in union type
|
||||
|
||||
Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor | UnionProperty,
|
||||
|
||||
BlockScopedVariable = 0x10000000, // A block-scoped variable (let ot const)
|
||||
|
||||
Variable = FunctionScopedVariable | BlockScopedVariable,
|
||||
Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor,
|
||||
Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter,
|
||||
Namespace = ValueModule | NamespaceModule,
|
||||
Module = ValueModule | NamespaceModule,
|
||||
Accessor = GetAccessor | SetAccessor,
|
||||
Signature = CallSignature | ConstructSignature | IndexSignature,
|
||||
|
||||
|
||||
// Variables can be redeclared, but can not redeclare a block-scoped declaration with the
|
||||
// same name, or any other value that is not a variable, e.g. ValueModule or Class
|
||||
FunctionScopedVariableExcludes = Value & ~FunctionScopedVariable,
|
||||
|
||||
// Block-scoped declarations are not allowed to be re-declared
|
||||
// they can not merge with anything in the value space
|
||||
BlockScopedVariableExcludes = Value,
|
||||
|
||||
ParameterExcludes = Value,
|
||||
VariableExcludes = Value & ~Variable,
|
||||
PropertyExcludes = Value,
|
||||
EnumMemberExcludes = Value,
|
||||
FunctionExcludes = Value & ~(Function | ValueModule),
|
||||
@ -804,8 +836,9 @@ module ts {
|
||||
SetAccessorExcludes = Value & ~GetAccessor,
|
||||
TypeParameterExcludes = Type & ~TypeParameter,
|
||||
|
||||
|
||||
// Imports collide with all other imports with the same name.
|
||||
ImportExcludes = Import,
|
||||
ImportExcludes = Import,
|
||||
|
||||
ModuleMember = Variable | Function | Class | Interface | Enum | Module | Import,
|
||||
|
||||
@ -896,7 +929,8 @@ module ts {
|
||||
Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null,
|
||||
StringLike = String | StringLiteral,
|
||||
NumberLike = Number | Enum,
|
||||
ObjectType = Class | Interface | Reference | Tuple | Union | Anonymous,
|
||||
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
|
||||
Structured = Any | ObjectType | Union | TypeParameter
|
||||
}
|
||||
|
||||
// Properties common to all types
|
||||
@ -919,12 +953,6 @@ module ts {
|
||||
// Object types (TypeFlags.ObjectType)
|
||||
export interface ObjectType extends Type { }
|
||||
|
||||
export interface ApparentType extends Type {
|
||||
// This property is not used. It is just to make the type system think ApparentType
|
||||
// is a strict subtype of Type.
|
||||
_apparentTypeBrand: any;
|
||||
}
|
||||
|
||||
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
||||
export interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
@ -954,12 +982,13 @@ module ts {
|
||||
baseArrayType: TypeReference; // Array<T> where T is best common type of element types
|
||||
}
|
||||
|
||||
export interface UnionType extends ObjectType {
|
||||
types: Type[]; // Constituent types
|
||||
export interface UnionType extends Type {
|
||||
types: Type[]; // Constituent types
|
||||
resolvedProperties: SymbolTable; // Cache of resolved properties
|
||||
}
|
||||
|
||||
// Resolved object type
|
||||
export interface ResolvedObjectType extends ObjectType {
|
||||
// Resolved object or union type
|
||||
export interface ResolvedType extends ObjectType, UnionType {
|
||||
members: SymbolTable; // Properties by name
|
||||
properties: Symbol[]; // Properties
|
||||
callSignatures: Signature[]; // Call signatures of type
|
||||
@ -1006,6 +1035,7 @@ module ts {
|
||||
|
||||
export interface InferenceContext {
|
||||
typeParameters: TypeParameter[]; // Type parameters for which inferences are made
|
||||
inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType)
|
||||
inferenceCount: number; // Incremented for every inference made (whether new or not)
|
||||
inferences: Type[][]; // Inferences made for each type parameter
|
||||
inferredTypes: Type[]; // Inferred type for each type parameter
|
||||
@ -1015,6 +1045,7 @@ module ts {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
code: number;
|
||||
isEarly?: boolean;
|
||||
}
|
||||
|
||||
// A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
@ -1035,6 +1066,7 @@ module ts {
|
||||
messageText: string;
|
||||
category: DiagnosticCategory;
|
||||
code: number;
|
||||
isEarly?: boolean;
|
||||
}
|
||||
|
||||
export enum DiagnosticCategory {
|
||||
@ -1087,6 +1119,8 @@ module ts {
|
||||
export enum ScriptTarget {
|
||||
ES3,
|
||||
ES5,
|
||||
ES6,
|
||||
Latest = ES6,
|
||||
}
|
||||
|
||||
export interface ParsedCommandLine {
|
||||
@ -1237,32 +1271,7 @@ module ts {
|
||||
tab = 0x09, // \t
|
||||
verticalTab = 0x0B, // \v
|
||||
}
|
||||
|
||||
export enum SymbolDisplayPartKind {
|
||||
aliasName,
|
||||
className,
|
||||
enumName,
|
||||
fieldName,
|
||||
interfaceName,
|
||||
keyword,
|
||||
lineBreak,
|
||||
numericLiteral,
|
||||
stringLiteral,
|
||||
localName,
|
||||
methodName,
|
||||
moduleName,
|
||||
operator,
|
||||
parameterName,
|
||||
propertyName,
|
||||
punctuation,
|
||||
space,
|
||||
text,
|
||||
typeParameterName,
|
||||
enumMemberName,
|
||||
functionName,
|
||||
regularExpressionLiteral,
|
||||
}
|
||||
|
||||
|
||||
export interface CancellationToken {
|
||||
isCancellationRequested(): boolean;
|
||||
}
|
||||
|
||||
@ -61,9 +61,11 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
var otherFiles: { unitName: string; content: string }[];
|
||||
var harnessCompiler: Harness.Compiler.HarnessCompiler;
|
||||
|
||||
var declToBeCompiled: { unitName: string; content: string }[] = [];
|
||||
var declOtherFiles: { unitName: string; content: string }[] = [];
|
||||
var declResult: Harness.Compiler.CompilerResult;
|
||||
var declFileCompilationResult: {
|
||||
declInputFiles: { unitName: string; content: string }[];
|
||||
declOtherFiles: { unitName: string; content: string }[];
|
||||
declResult: Harness.Compiler.CompilerResult;
|
||||
};
|
||||
|
||||
var createNewInstance = false;
|
||||
|
||||
@ -147,9 +149,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
toBeCompiled = undefined;
|
||||
otherFiles = undefined;
|
||||
harnessCompiler = undefined;
|
||||
declToBeCompiled = undefined;
|
||||
declOtherFiles = undefined;
|
||||
declResult = undefined;
|
||||
declFileCompilationResult = undefined;
|
||||
});
|
||||
|
||||
function getByteOrderMarkText(file: Harness.Compiler.GeneratedFile): string {
|
||||
@ -173,61 +173,18 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
// Source maps?
|
||||
it('Correct sourcemap content for ' + fileName, () => {
|
||||
if (result.sourceMapRecord) {
|
||||
if (options.sourceMap) {
|
||||
Harness.Baseline.runBaseline('Correct sourcemap content for ' + fileName, justName.replace(/\.ts$/, '.sourcemap.txt'), () => {
|
||||
return result.sourceMapRecord;
|
||||
return result.getSourceMapRecord();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Compile .d.ts files
|
||||
it('Correct compiler generated.d.ts for ' + fileName, () => {
|
||||
if (options.declaration && result.errors.length === 0 && result.declFilesCode.length !== result.files.length) {
|
||||
throw new Error('There were no errors and declFiles generated did not match number of js files generated');
|
||||
}
|
||||
|
||||
// if the .d.ts is non-empty, confirm it compiles correctly as well
|
||||
if (options.declaration && result.errors.length === 0 && result.declFilesCode.length > 0) {
|
||||
function addDtsFile(file: { unitName: string; content: string }, dtsFiles: { unitName: string; content: string }[]) {
|
||||
if (Harness.Compiler.isDTS(file.unitName)) {
|
||||
dtsFiles.push(file);
|
||||
}
|
||||
else {
|
||||
var declFile = findResultCodeFile(file.unitName);
|
||||
// Look if there is --out file corresponding to this ts file
|
||||
if (!declFile && options.out) {
|
||||
declFile = findResultCodeFile(options.out);
|
||||
if (!declFile || findUnit(declFile.fileName, declToBeCompiled) ||
|
||||
findUnit(declFile.fileName, declOtherFiles)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (declFile) {
|
||||
dtsFiles.push({ unitName: declFile.fileName, content: declFile.code });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function findResultCodeFile(fileName: string) {
|
||||
return ts.forEach(result.declFilesCode,
|
||||
declFile => declFile.fileName === (fileName.substr(0, fileName.length - ".ts".length) + ".d.ts")
|
||||
? declFile : undefined);
|
||||
}
|
||||
|
||||
function findUnit(fileName: string, units: { unitName: string; content: string }[]) {
|
||||
return ts.forEach(units, unit => unit.unitName === fileName ? unit : undefined);
|
||||
}
|
||||
}
|
||||
|
||||
ts.forEach(toBeCompiled, file => addDtsFile(file, declToBeCompiled));
|
||||
ts.forEach(otherFiles, file => addDtsFile(file, declOtherFiles));
|
||||
harnessCompiler.compileFiles(declToBeCompiled, declOtherFiles, function (compileResult) {
|
||||
declResult = compileResult;
|
||||
}, function (settings) {
|
||||
harnessCompiler.setCompilerSettings(tcSettings);
|
||||
});
|
||||
}
|
||||
declFileCompilationResult = harnessCompiler.compileDeclarationFiles(toBeCompiled, otherFiles, result, function (settings) {
|
||||
harnessCompiler.setCompilerSettings(tcSettings);
|
||||
}, options);
|
||||
});
|
||||
|
||||
|
||||
@ -267,10 +224,10 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (declResult && declResult.errors.length) {
|
||||
if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) {
|
||||
jsCode += '\r\n\r\n//// [DtsFileErrors]\r\n';
|
||||
jsCode += '\r\n\r\n';
|
||||
jsCode += getErrorBaseline(declToBeCompiled, declOtherFiles, declResult);
|
||||
jsCode += getErrorBaseline(declFileCompilationResult.declInputFiles, declFileCompilationResult.declOtherFiles, declFileCompilationResult.declResult);
|
||||
}
|
||||
|
||||
if (jsCode.length > 0) {
|
||||
|
||||
@ -146,7 +146,7 @@ module FourSlash {
|
||||
|
||||
function convertGlobalOptionsToCompilationSettings(globalOptions: { [idx: string]: string }): ts.CompilationSettings {
|
||||
var settings: ts.CompilationSettings = {};
|
||||
// Convert all property in globalOptions into ts.CompilationSettings
|
||||
// Convert all property in globalOptions into ts.CompilationSettings
|
||||
for (var prop in globalOptions) {
|
||||
if (globalOptions.hasOwnProperty(prop)) {
|
||||
switch (prop) {
|
||||
@ -985,15 +985,85 @@ module FourSlash {
|
||||
return item.parameters[currentParam];
|
||||
}
|
||||
|
||||
private alignmentForExtraInfo = 50;
|
||||
|
||||
private spanInfoToString(pos: number, spanInfo: TypeScript.TextSpan, prefixString: string) {
|
||||
var resultString = "SpanInfo: " + JSON.stringify(spanInfo);
|
||||
if (spanInfo) {
|
||||
var spanString = this.activeFile.content.substr(spanInfo.start(), spanInfo.length());
|
||||
var spanLineMap = ts.computeLineStarts(spanString);
|
||||
for (var i = 0; i < spanLineMap.length; i++) {
|
||||
if (!i) {
|
||||
resultString += "\n";
|
||||
}
|
||||
resultString += prefixString + spanString.substring(spanLineMap[i], spanLineMap[i + 1]);
|
||||
}
|
||||
resultString += "\n" + prefixString + ":=> (" + this.getLineColStringAtPosition(spanInfo.start()) + ") to (" + this.getLineColStringAtPosition(spanInfo.end()) + ")";
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
|
||||
private baselineCurrentFileLocations(getSpanAtPos: (pos: number) => TypeScript.TextSpan): string {
|
||||
var fileLineMap = ts.computeLineStarts(this.activeFile.content);
|
||||
var nextLine = 0;
|
||||
var resultString = "";
|
||||
var currentLine: string;
|
||||
var previousSpanInfo: string;
|
||||
var startColumn: number;
|
||||
var length: number;
|
||||
var prefixString = " >";
|
||||
|
||||
var addSpanInfoString = () => {
|
||||
if (previousSpanInfo) {
|
||||
resultString += currentLine;
|
||||
var thisLineMarker = repeatString(startColumn, " ") + repeatString(length, "~");
|
||||
thisLineMarker += repeatString(this.alignmentForExtraInfo - thisLineMarker.length - prefixString.length + 1, " ");
|
||||
resultString += thisLineMarker;
|
||||
resultString += "=> Pos: (" + (pos - length) + " to " + (pos - 1) + ") ";
|
||||
resultString += " " + previousSpanInfo;
|
||||
previousSpanInfo = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
for (var pos = 0; pos < this.activeFile.content.length; pos++) {
|
||||
if (pos === 0 || pos === fileLineMap[nextLine]) {
|
||||
nextLine++;
|
||||
addSpanInfoString();
|
||||
if (resultString.length) {
|
||||
resultString += "\n--------------------------------";
|
||||
}
|
||||
currentLine = "\n" + nextLine.toString() + repeatString(3 - nextLine.toString().length, " ") + ">" + this.activeFile.content.substring(pos, fileLineMap[nextLine]) + "\n ";
|
||||
startColumn = 0;
|
||||
length = 0;
|
||||
}
|
||||
var spanInfo = this.spanInfoToString(pos, getSpanAtPos(pos), prefixString);
|
||||
if (previousSpanInfo && previousSpanInfo !== spanInfo) {
|
||||
addSpanInfoString();
|
||||
previousSpanInfo = spanInfo;
|
||||
startColumn = startColumn + length;
|
||||
length = 1;
|
||||
}
|
||||
else {
|
||||
previousSpanInfo = spanInfo;
|
||||
length++;
|
||||
}
|
||||
}
|
||||
addSpanInfoString();
|
||||
return resultString;
|
||||
|
||||
function repeatString(count: number, char: string) {
|
||||
var result = "";
|
||||
for (var i = 0; i < count; i++) {
|
||||
result += char;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public getBreakpointStatementLocation(pos: number) {
|
||||
this.taoInvalidReason = 'getBreakpointStatementLocation NYI';
|
||||
|
||||
var spanInfo = this.languageService.getBreakpointStatementAtPosition(this.activeFile.fileName, pos);
|
||||
var resultString = "\n**Pos: " + pos + " SpanInfo: " + JSON.stringify(spanInfo) + "\n** Statement: ";
|
||||
if (spanInfo !== null) {
|
||||
resultString = resultString + this.activeFile.content.substr(spanInfo.start(), spanInfo.length());
|
||||
}
|
||||
return resultString;
|
||||
return this.languageService.getBreakpointStatementAtPosition(this.activeFile.fileName, pos);
|
||||
}
|
||||
|
||||
public baselineCurrentFileBreakpointLocations() {
|
||||
@ -1003,12 +1073,7 @@ module FourSlash {
|
||||
"Breakpoint Locations for " + this.activeFile.fileName,
|
||||
this.testData.globalOptions[testOptMetadataNames.baselineFile],
|
||||
() => {
|
||||
var fileLength = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getLength();
|
||||
var resultString = "";
|
||||
for (var pos = 0; pos < fileLength; pos++) {
|
||||
resultString = resultString + this.getBreakpointStatementLocation(pos);
|
||||
}
|
||||
return resultString;
|
||||
return this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos));
|
||||
},
|
||||
true /* run immediately */);
|
||||
}
|
||||
@ -1056,7 +1121,7 @@ module FourSlash {
|
||||
}
|
||||
|
||||
public printBreakpointLocation(pos: number) {
|
||||
Harness.IO.log(this.getBreakpointStatementLocation(pos));
|
||||
Harness.IO.log("\n**Pos: " + pos + " " + this.spanInfoToString(pos, this.getBreakpointStatementLocation(pos), " "));
|
||||
}
|
||||
|
||||
public printBreakpointAtCurrentLocation() {
|
||||
@ -1502,7 +1567,7 @@ module FourSlash {
|
||||
throw new Error('verifyCaretAtMarker failed - expected to be in file "' + pos.fileName + '", but was in file "' + this.activeFile.fileName + '"');
|
||||
}
|
||||
if (pos.position !== this.currentCaretPosition) {
|
||||
throw new Error('verifyCaretAtMarker failed - expected to be at marker "/*' + markerName + '*/, but was at position ' + this.currentCaretPosition + '(' + this.getLineColStringAtCaret() + ')');
|
||||
throw new Error('verifyCaretAtMarker failed - expected to be at marker "/*' + markerName + '*/, but was at position ' + this.currentCaretPosition + '(' + this.getLineColStringAtPosition(this.currentCaretPosition) + ')');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1566,10 +1631,10 @@ module FourSlash {
|
||||
this.taoInvalidReason = 'verifyCurrentNameOrDottedNameSpanText NYI';
|
||||
|
||||
var span = this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, this.currentCaretPosition, this.currentCaretPosition);
|
||||
if (span === null) {
|
||||
if (!span) {
|
||||
this.raiseError('verifyCurrentNameOrDottedNameSpanText\n' +
|
||||
'\tExpected: "' + text + '"\n' +
|
||||
'\t Actual: null');
|
||||
'\t Actual: undefined');
|
||||
}
|
||||
|
||||
var actual = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getText(span.start(), span.end());
|
||||
@ -1581,12 +1646,8 @@ module FourSlash {
|
||||
}
|
||||
|
||||
private getNameOrDottedNameSpan(pos: number) {
|
||||
var spanInfo = this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, pos, pos);
|
||||
var resultString = "\n**Pos: " + pos + " SpanInfo: " + JSON.stringify(spanInfo) + "\n** Statement: ";
|
||||
if (spanInfo !== null) {
|
||||
resultString = resultString + this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getText(spanInfo.start(), spanInfo.end());
|
||||
}
|
||||
return resultString;
|
||||
this.taoInvalidReason = 'getNameOrDottedNameSpan NYI';
|
||||
return this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, pos, pos);
|
||||
}
|
||||
|
||||
public baselineCurrentFileNameOrDottedNameSpans() {
|
||||
@ -1596,23 +1657,21 @@ module FourSlash {
|
||||
"Name OrDottedNameSpans for " + this.activeFile.fileName,
|
||||
this.testData.globalOptions[testOptMetadataNames.baselineFile],
|
||||
() => {
|
||||
var fileLength = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getLength();
|
||||
var resultString = "";
|
||||
for (var pos = 0; pos < fileLength; pos++) {
|
||||
resultString = resultString + this.getNameOrDottedNameSpan(pos);
|
||||
}
|
||||
return resultString;
|
||||
return this.baselineCurrentFileLocations(pos =>
|
||||
this.getNameOrDottedNameSpan(pos));
|
||||
},
|
||||
true /* run immediately */);
|
||||
}
|
||||
|
||||
public printNameOrDottedNameSpans(pos: number) {
|
||||
Harness.IO.log(this.getNameOrDottedNameSpan(pos));
|
||||
Harness.IO.log(this.spanInfoToString(pos, this.getNameOrDottedNameSpan(pos), "**"));
|
||||
}
|
||||
|
||||
private verifyClassifications(expected: { classificationType: string; text: string }[], actual: ts.ClassifiedSpan[]) {
|
||||
private verifyClassifications(expected: { classificationType: string; text: string; textSpan?: TextSpan }[], actual: ts.ClassifiedSpan[]) {
|
||||
if (actual.length !== expected.length) {
|
||||
this.raiseError('verifyClassifications failed - expected total classifications to be ' + expected.length + ', but was ' + actual.length);
|
||||
this.raiseError('verifyClassifications failed - expected total classifications to be ' + expected.length +
|
||||
', but was ' + actual.length +
|
||||
jsonMismatchString());
|
||||
}
|
||||
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
@ -1623,17 +1682,38 @@ module FourSlash {
|
||||
if (expectedType !== actualClassification.classificationType) {
|
||||
this.raiseError('verifyClassifications failed - expected classifications type to be ' +
|
||||
expectedType + ', but was ' +
|
||||
actualClassification.classificationType);
|
||||
actualClassification.classificationType +
|
||||
jsonMismatchString());
|
||||
}
|
||||
|
||||
var expectedSpan = expectedClassification.textSpan;
|
||||
var actualSpan = actualClassification.textSpan;
|
||||
|
||||
if (expectedSpan) {
|
||||
var expectedLength = expectedSpan.end - expectedSpan.start;
|
||||
|
||||
if (expectedSpan.start !== actualSpan.start() || expectedLength !== actualSpan.length()) {
|
||||
this.raiseError("verifyClassifications failed - expected span of text to be " +
|
||||
"{start=" + expectedSpan.start + ", length=" + expectedLength + "}, but was " +
|
||||
"{start=" + actualSpan.start() + ", length=" + actualSpan.length() + "}" +
|
||||
jsonMismatchString());
|
||||
}
|
||||
}
|
||||
|
||||
var actualText = this.activeFile.content.substr(actualSpan.start(), actualSpan.length());
|
||||
if (expectedClassification.text !== actualText) {
|
||||
this.raiseError('verifyClassifications failed - expected classificatied text to be ' +
|
||||
this.raiseError('verifyClassifications failed - expected classified text to be ' +
|
||||
expectedClassification.text + ', but was ' +
|
||||
actualText);
|
||||
actualText +
|
||||
jsonMismatchString());
|
||||
}
|
||||
}
|
||||
|
||||
function jsonMismatchString() {
|
||||
return sys.newLine +
|
||||
"expected: '" + sys.newLine + JSON.stringify(expected, (k,v) => v, 2) + "'" + sys.newLine +
|
||||
"actual: '" + sys.newLine + JSON.stringify(actual, (k, v) => v, 2) + "'";
|
||||
}
|
||||
}
|
||||
|
||||
public verifySemanticClassifications(expected: { classificationType: string; text: string }[]) {
|
||||
@ -1984,7 +2064,8 @@ module FourSlash {
|
||||
var newlinePos = text.indexOf('\n');
|
||||
if (newlinePos === -1) {
|
||||
return text;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (text.charAt(newlinePos - 1) === '\r') {
|
||||
newlinePos--;
|
||||
}
|
||||
@ -2090,8 +2171,8 @@ module FourSlash {
|
||||
return this.languageServiceShimHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition).line + 1;
|
||||
}
|
||||
|
||||
private getLineColStringAtCaret() {
|
||||
var pos = this.languageServiceShimHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition);
|
||||
private getLineColStringAtPosition(position: number) {
|
||||
var pos = this.languageServiceShimHost.positionToZeroBasedLineCol(this.activeFile.fileName, position);
|
||||
return 'line ' + (pos.line + 1) + ', col ' + pos.character;
|
||||
}
|
||||
|
||||
@ -2139,7 +2220,7 @@ module FourSlash {
|
||||
var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFilename, content: undefined },
|
||||
{ unitName: fileName, content: content }],
|
||||
(fn, contents) => result = contents,
|
||||
ts.ScriptTarget.ES5,
|
||||
ts.ScriptTarget.Latest,
|
||||
sys.useCaseSensitiveFileNames);
|
||||
var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js" }, host);
|
||||
var checker = ts.createTypeChecker(program, /*fullTypeCheckMode*/ true);
|
||||
|
||||
@ -139,6 +139,7 @@ module Harness {
|
||||
deleteFile(filename: string): void;
|
||||
listFiles(path: string, filter: RegExp, options?: { recursive?: boolean }): string[];
|
||||
log(text: string): void;
|
||||
getMemoryUsage? (): number;
|
||||
}
|
||||
|
||||
module IOImpl {
|
||||
@ -275,6 +276,13 @@ module Harness {
|
||||
|
||||
return filesInFolder(path);
|
||||
}
|
||||
|
||||
export var getMemoryUsage: typeof IO.getMemoryUsage = () => {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
}
|
||||
return process.memoryUsage().heapUsed;
|
||||
}
|
||||
}
|
||||
|
||||
export module Network {
|
||||
@ -532,7 +540,7 @@ module Harness {
|
||||
}
|
||||
|
||||
export var defaultLibFileName = 'lib.d.ts';
|
||||
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.ES5, /*version:*/ "0");
|
||||
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*version:*/ "0");
|
||||
|
||||
// Cache these between executions so we don't have to re-parse them for every test
|
||||
export var fourslashFilename = 'fourslash.ts';
|
||||
@ -685,6 +693,8 @@ module Harness {
|
||||
options.target = ts.ScriptTarget.ES3;
|
||||
} else if (setting.value.toLowerCase() === 'es5') {
|
||||
options.target = ts.ScriptTarget.ES5;
|
||||
} else if (setting.value.toLowerCase() === 'es6') {
|
||||
options.target = ts.ScriptTarget.ES6;
|
||||
} else {
|
||||
throw new Error('Unknown compile target ' + setting.value);
|
||||
}
|
||||
@ -791,9 +801,11 @@ module Harness {
|
||||
var checker = program.getTypeChecker(/*fullTypeCheckMode*/ true);
|
||||
checker.checkProgram();
|
||||
|
||||
var hasEarlyErrors = checker.hasEarlyErrors();
|
||||
|
||||
// only emit if there weren't parse errors
|
||||
var emitResult: ts.EmitResult;
|
||||
if (!hadParseErrors) {
|
||||
if (!hadParseErrors && !hasEarlyErrors) {
|
||||
emitResult = checker.emitFiles();
|
||||
}
|
||||
|
||||
@ -804,15 +816,81 @@ module Harness {
|
||||
});
|
||||
this.lastErrors = errors;
|
||||
|
||||
var result = new CompilerResult(fileOutputs, errors, []);
|
||||
// Covert the source Map data into the baseline
|
||||
result.updateSourceMapRecord(program, emitResult ? emitResult.sourceMaps : undefined);
|
||||
var result = new CompilerResult(fileOutputs, errors, program, sys.getCurrentDirectory(), emitResult ? emitResult.sourceMaps : undefined);
|
||||
onComplete(result, checker);
|
||||
|
||||
// reset what newline means in case the last test changed it
|
||||
sys.newLine = '\r\n';
|
||||
return options;
|
||||
}
|
||||
|
||||
public compileDeclarationFiles(inputFiles: { unitName: string; content: string; }[],
|
||||
otherFiles: { unitName: string; content: string; }[],
|
||||
result: CompilerResult,
|
||||
settingsCallback?: (settings: ts.CompilerOptions) => void,
|
||||
options?: ts.CompilerOptions) {
|
||||
if (options.declaration && result.errors.length === 0 && result.declFilesCode.length !== result.files.length) {
|
||||
throw new Error('There were no errors and declFiles generated did not match number of js files generated');
|
||||
}
|
||||
|
||||
// if the .d.ts is non-empty, confirm it compiles correctly as well
|
||||
if (options.declaration && result.errors.length === 0 && result.declFilesCode.length > 0) {
|
||||
var declInputFiles: { unitName: string; content: string }[] = [];
|
||||
var declOtherFiles: { unitName: string; content: string }[] = [];
|
||||
var declResult: Harness.Compiler.CompilerResult;
|
||||
|
||||
ts.forEach(inputFiles, file => addDtsFile(file, declInputFiles));
|
||||
ts.forEach(otherFiles, file => addDtsFile(file, declOtherFiles));
|
||||
this.compileFiles(declInputFiles, declOtherFiles, function (compileResult) {
|
||||
declResult = compileResult;
|
||||
}, settingsCallback, options);
|
||||
|
||||
return { declInputFiles: declInputFiles, declOtherFiles: declOtherFiles, declResult: declResult };
|
||||
}
|
||||
|
||||
function addDtsFile(file: { unitName: string; content: string }, dtsFiles: { unitName: string; content: string }[]) {
|
||||
if (isDTS(file.unitName)) {
|
||||
dtsFiles.push(file);
|
||||
}
|
||||
else if (isTS(file.unitName)) {
|
||||
var declFile = findResultCodeFile(file.unitName);
|
||||
if (!findUnit(declFile.fileName, declInputFiles) && !findUnit(declFile.fileName, declOtherFiles)) {
|
||||
dtsFiles.push({ unitName: declFile.fileName, content: declFile.code });
|
||||
}
|
||||
}
|
||||
|
||||
function findResultCodeFile(fileName: string) {
|
||||
var dTsFileName = ts.forEach(result.program.getSourceFiles(), sourceFile => {
|
||||
if (sourceFile.filename === fileName) {
|
||||
// Is this file going to be emitted separately
|
||||
var sourceFileName: string;
|
||||
if (ts.isExternalModule(sourceFile) || !options.out) {
|
||||
if (options.outDir) {
|
||||
var sourceFilePath = ts.getNormalizedPathFromPathComponents(ts.getNormalizedPathComponents(sourceFile.filename, result.currentDirectoryForProgram));
|
||||
sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), "");
|
||||
sourceFileName = ts.combinePaths(options.outDir, sourceFilePath);
|
||||
}
|
||||
else {
|
||||
sourceFileName = sourceFile.filename;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Goes to single --out file
|
||||
sourceFileName = options.out;
|
||||
}
|
||||
|
||||
return ts.removeFileExtension(sourceFileName) + ".d.ts";
|
||||
}
|
||||
});
|
||||
|
||||
return ts.forEach(result.declFilesCode, declFile => declFile.fileName === dTsFileName ? declFile : undefined);
|
||||
}
|
||||
|
||||
function findUnit(fileName: string, units: { unitName: string; content: string; }[]) {
|
||||
return ts.forEach(units, unit => unit.unitName === fileName ? unit : undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic {
|
||||
@ -948,10 +1026,6 @@ module Harness {
|
||||
}
|
||||
*/
|
||||
|
||||
/** Recreate the harness compiler instance to its default settings */
|
||||
export function recreate(options?: { useMinimalDefaultLib: boolean; noImplicitAny: boolean; }) {
|
||||
}
|
||||
|
||||
/** The harness' compiler instance used when tests are actually run. Reseting or changing settings of this compiler instance must be done within a test case (i.e., describe/it) */
|
||||
var harnessCompiler: HarnessCompiler;
|
||||
|
||||
@ -991,6 +1065,10 @@ module Harness {
|
||||
return str.substr(str.length - end.length) === end;
|
||||
}
|
||||
|
||||
export function isTS(fileName: string) {
|
||||
return stringEndsWith(fileName, '.ts');
|
||||
}
|
||||
|
||||
export function isDTS(fileName: string) {
|
||||
return stringEndsWith(fileName, '.d.ts');
|
||||
}
|
||||
@ -1009,10 +1087,10 @@ module Harness {
|
||||
public errors: HarnessDiagnostic[] = [];
|
||||
public declFilesCode: GeneratedFile[] = [];
|
||||
public sourceMaps: GeneratedFile[] = [];
|
||||
public sourceMapRecord: string;
|
||||
|
||||
/** @param fileResults an array of strings for the fileName and an ITextWriter with its code */
|
||||
constructor(fileResults: GeneratedFile[], errors: HarnessDiagnostic[], sourceMapRecordLines: string[]) {
|
||||
constructor(fileResults: GeneratedFile[], errors: HarnessDiagnostic[], public program: ts.Program,
|
||||
public currentDirectoryForProgram: string, private sourceMapData: ts.SourceMapData[]) {
|
||||
var lines: string[] = [];
|
||||
|
||||
fileResults.forEach(emittedFile => {
|
||||
@ -1030,12 +1108,11 @@ module Harness {
|
||||
});
|
||||
|
||||
this.errors = errors;
|
||||
this.sourceMapRecord = sourceMapRecordLines.join('\r\n');
|
||||
}
|
||||
|
||||
public updateSourceMapRecord(program: ts.Program, sourceMapData: ts.SourceMapData[]) {
|
||||
if (sourceMapData) {
|
||||
this.sourceMapRecord = Harness.SourceMapRecoder.getSourceMapRecord(sourceMapData, program, this.files);
|
||||
public getSourceMapRecord() {
|
||||
if (this.sourceMapData) {
|
||||
return Harness.SourceMapRecoder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -260,7 +260,7 @@ module Harness.LanguageService {
|
||||
|
||||
/** Parse file given its source text */
|
||||
public parseSourceText(fileName: string, sourceText: TypeScript.IScriptSnapshot): TypeScript.SourceUnitSyntax {
|
||||
return TypeScript.Parser.parse(fileName, TypeScript.SimpleText.fromScriptSnapshot(sourceText), ts.ScriptTarget.ES5, TypeScript.isDTSFile(fileName)).sourceUnit();
|
||||
return TypeScript.Parser.parse(fileName, TypeScript.SimpleText.fromScriptSnapshot(sourceText), ts.ScriptTarget.Latest, TypeScript.isDTSFile(fileName)).sourceUnit();
|
||||
}
|
||||
|
||||
/** Parse a file on disk given its fileName */
|
||||
|
||||
@ -419,6 +419,16 @@ class ProjectRunner extends RunnerBase {
|
||||
// })
|
||||
//});
|
||||
}
|
||||
|
||||
after(() => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
// Therefore we have to clean out large objects after the test is done.
|
||||
nodeCompilerResult = undefined;
|
||||
amdCompilerResult = undefined;
|
||||
testCase = undefined;
|
||||
testFileText = undefined;
|
||||
testCaseJustName = undefined;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,6 @@
|
||||
// ///<reference path='fourslashRunner.ts' />
|
||||
/// <reference path='projectsRunner.ts' />
|
||||
/// <reference path='rwcRunner.ts' />
|
||||
/// <reference path='unittestrunner.ts' />
|
||||
|
||||
function runTests(runners: RunnerBase[]) {
|
||||
if (reverse) {
|
||||
@ -67,9 +66,6 @@ if (testConfigFile !== '') {
|
||||
case 'fourslash-generated':
|
||||
runners.push(new GeneratedFourslashRunner());
|
||||
break;
|
||||
case 'unittests':
|
||||
runners.push(new UnitTestRunner());
|
||||
break;
|
||||
case 'rwc':
|
||||
runners.push(new RWCRunner());
|
||||
break;
|
||||
@ -93,9 +89,6 @@ if (runners.length === 0) {
|
||||
// language services
|
||||
runners.push(new FourslashRunner());
|
||||
//runners.push(new GeneratedFourslashRunner());
|
||||
|
||||
// unittests
|
||||
runners.push(new UnitTestRunner());
|
||||
}
|
||||
|
||||
sys.newLine = '\r\n';
|
||||
|
||||
@ -46,144 +46,171 @@ module RWC {
|
||||
}
|
||||
|
||||
export function runRWCTest(jsonPath: string) {
|
||||
var harnessCompiler = Harness.Compiler.getCompiler();
|
||||
var opts: ts.ParsedCommandLine;
|
||||
describe("Testing a RWC project: " + jsonPath, () => {
|
||||
var inputFiles: { unitName: string; content: string; }[] = [];
|
||||
var otherFiles: { unitName: string; content: string; }[] = [];
|
||||
var compilerResult: Harness.Compiler.CompilerResult;
|
||||
var compilerOptions: ts.CompilerOptions;
|
||||
var baselineOpts: Harness.Baseline.BaselineOptions = { Subfolder: 'rwc' };
|
||||
var baseName = /(.*)\/(.*).json/.exec(Harness.Path.switchToForwardSlashes(jsonPath))[2];
|
||||
// Compile .d.ts files
|
||||
var declFileCompilationResult: {
|
||||
declInputFiles: { unitName: string; content: string }[];
|
||||
declOtherFiles: { unitName: string; content: string }[];
|
||||
declResult: Harness.Compiler.CompilerResult;
|
||||
};
|
||||
|
||||
var ioLog: IOLog = JSON.parse(Harness.IO.readFile(jsonPath));
|
||||
var errors = '';
|
||||
|
||||
it('has parsable options', () => {
|
||||
runWithIOLog(ioLog, () => {
|
||||
opts = ts.parseCommandLine(ioLog.arguments);
|
||||
assert.equal(opts.errors.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
var inputFiles: { unitName: string; content: string; }[] = [];
|
||||
var otherFiles: { unitName: string; content: string; }[] = [];
|
||||
var compilerResult: Harness.Compiler.CompilerResult;
|
||||
it('can compile', () => {
|
||||
runWithIOLog(ioLog, () => {
|
||||
harnessCompiler.reset();
|
||||
|
||||
// Load the files
|
||||
ts.forEach(opts.filenames, fileName => {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(fileName));
|
||||
});
|
||||
|
||||
if (!opts.options.noLib) {
|
||||
// Find the lib.d.ts file in the input file and add it to the input files list
|
||||
var libFile = ts.forEach(ioLog.filesRead, fileRead=> Harness.isLibraryFile(fileRead.path) ? fileRead.path : undefined);
|
||||
if (libFile) {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(libFile));
|
||||
}
|
||||
}
|
||||
|
||||
ts.forEach(ioLog.filesRead, fileRead => {
|
||||
var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileRead.path));
|
||||
var inInputList = ts.forEach(inputFiles, inputFile=> inputFile.unitName === resolvedPath);
|
||||
if (!inInputList) {
|
||||
// Add the file to other files
|
||||
otherFiles.push(getHarnessCompilerInputUnit(fileRead.path));
|
||||
}
|
||||
});
|
||||
|
||||
// do not use lib since we already read it in above
|
||||
opts.options.noLib = true;
|
||||
|
||||
// Emit the results
|
||||
harnessCompiler.compileFiles(inputFiles, otherFiles, compileResult => {
|
||||
compilerResult = compileResult;
|
||||
}, /*settingsCallback*/ undefined, opts.options);
|
||||
after(() => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
// Therefore we have to clean out large objects after the test is done.
|
||||
inputFiles = undefined;
|
||||
otherFiles = undefined;
|
||||
compilerResult = undefined;
|
||||
compilerOptions = undefined;
|
||||
baselineOpts = undefined;
|
||||
baseName = undefined;
|
||||
declFileCompilationResult = undefined;
|
||||
});
|
||||
|
||||
function getHarnessCompilerInputUnit(fileName: string) {
|
||||
var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileName));
|
||||
try {
|
||||
var content = sys.readFile(resolvedPath);
|
||||
it('can compile', () => {
|
||||
var harnessCompiler = Harness.Compiler.getCompiler();
|
||||
var opts: ts.ParsedCommandLine;
|
||||
|
||||
var ioLog: IOLog = JSON.parse(Harness.IO.readFile(jsonPath));
|
||||
runWithIOLog(ioLog, () => {
|
||||
opts = ts.parseCommandLine(ioLog.arguments);
|
||||
assert.equal(opts.errors.length, 0);
|
||||
});
|
||||
|
||||
runWithIOLog(ioLog, () => {
|
||||
harnessCompiler.reset();
|
||||
|
||||
// Load the files
|
||||
ts.forEach(opts.filenames, fileName => {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(fileName));
|
||||
});
|
||||
|
||||
if (!opts.options.noLib) {
|
||||
// Find the lib.d.ts file in the input file and add it to the input files list
|
||||
var libFile = ts.forEach(ioLog.filesRead, fileRead=> Harness.isLibraryFile(fileRead.path) ? fileRead.path : undefined);
|
||||
if (libFile) {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(libFile));
|
||||
}
|
||||
}
|
||||
|
||||
ts.forEach(ioLog.filesRead, fileRead => {
|
||||
var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileRead.path));
|
||||
var inInputList = ts.forEach(inputFiles, inputFile=> inputFile.unitName === resolvedPath);
|
||||
if (!inInputList) {
|
||||
// Add the file to other files
|
||||
otherFiles.push(getHarnessCompilerInputUnit(fileRead.path));
|
||||
}
|
||||
});
|
||||
|
||||
// do not use lib since we already read it in above
|
||||
opts.options.noLib = true;
|
||||
|
||||
// Emit the results
|
||||
compilerOptions = harnessCompiler.compileFiles(inputFiles, otherFiles, compileResult => {
|
||||
compilerResult = compileResult;
|
||||
}, /*settingsCallback*/ undefined, opts.options);
|
||||
});
|
||||
|
||||
function getHarnessCompilerInputUnit(fileName: string) {
|
||||
var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileName));
|
||||
try {
|
||||
var content = sys.readFile(resolvedPath);
|
||||
}
|
||||
catch (e) {
|
||||
// Leave content undefined.
|
||||
}
|
||||
return { unitName: resolvedPath, content: content };
|
||||
}
|
||||
catch (e) {
|
||||
// Leave content undefined.
|
||||
}
|
||||
return { unitName: resolvedPath, content: content };
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Baselines
|
||||
var baselineOpts: Harness.Baseline.BaselineOptions = { Subfolder: 'rwc' };
|
||||
var baseName = /(.*)\/(.*).json/.exec(Harness.Path.switchToForwardSlashes(jsonPath))[2];
|
||||
// Baselines
|
||||
it('Correct compiler generated.d.ts', () => {
|
||||
declFileCompilationResult = Harness.Compiler.getCompiler().compileDeclarationFiles(inputFiles, otherFiles, compilerResult, /*settingscallback*/ undefined, compilerOptions);
|
||||
});
|
||||
|
||||
it('has the expected emitted code', () => {
|
||||
Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => {
|
||||
return collateOutputs(compilerResult.files, s => SyntacticCleaner.clean(s));
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
it('has the expected declaration file content', () => {
|
||||
Harness.Baseline.runBaseline('has the expected declaration file content', baseName + '.d.ts', () => {
|
||||
if (compilerResult.errors.length || !compilerResult.declFilesCode.length) {
|
||||
return null;
|
||||
}
|
||||
return collateOutputs(compilerResult.declFilesCode);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
it('has the expected source maps', () => {
|
||||
Harness.Baseline.runBaseline('has the expected source maps', baseName + '.map', () => {
|
||||
if (!compilerResult.sourceMaps.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return collateOutputs(compilerResult.sourceMaps);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
it('has correct source map record', () => {
|
||||
if (compilerResult.sourceMapRecord) {
|
||||
Harness.Baseline.runBaseline('has correct source map record', baseName + '.sourcemap.txt', () => {
|
||||
return compilerResult.sourceMapRecord;
|
||||
it('has the expected emitted code', () => {
|
||||
Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => {
|
||||
return collateOutputs(compilerResult.files, s => SyntacticCleaner.clean(s));
|
||||
}, false, baselineOpts);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('has the expected errors', () => {
|
||||
Harness.Baseline.runBaseline('has the expected errors', baseName + '.errors.txt', () => {
|
||||
if (compilerResult.errors.length === 0) {
|
||||
return null;
|
||||
it('has the expected declaration file content', () => {
|
||||
Harness.Baseline.runBaseline('has the expected declaration file content', baseName + '.d.ts', () => {
|
||||
if (compilerResult.errors.length || !compilerResult.declFilesCode.length) {
|
||||
return null;
|
||||
}
|
||||
return collateOutputs(compilerResult.declFilesCode);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
it('has the expected source maps', () => {
|
||||
Harness.Baseline.runBaseline('has the expected source maps', baseName + '.map', () => {
|
||||
if (!compilerResult.sourceMaps.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return collateOutputs(compilerResult.sourceMaps);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
//it('has correct source map record', () => {
|
||||
// if (compilerOptions.sourceMap) {
|
||||
// Harness.Baseline.runBaseline('has correct source map record', baseName + '.sourcemap.txt', () => {
|
||||
// return compilerResult.getSourceMapRecord();
|
||||
// }, false, baselineOpts);
|
||||
// }
|
||||
//});
|
||||
|
||||
it('has the expected errors', () => {
|
||||
Harness.Baseline.runBaseline('has the expected errors', baseName + '.errors.txt', () => {
|
||||
if (compilerResult.errors.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
it('has no errors in generated declaration files', () => {
|
||||
if (compilerOptions.declaration && !compilerResult.errors.length) {
|
||||
Harness.Baseline.runBaseline('has no errors in generated declaration files', baseName + '.dts.errors.txt', () => {
|
||||
if (declFileCompilationResult.declResult.errors.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) +
|
||||
sys.newLine + sys.newLine +
|
||||
Harness.Compiler.getErrorBaseline(declFileCompilationResult.declInputFiles.concat(declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors);
|
||||
}, false, baselineOpts);
|
||||
}
|
||||
});
|
||||
|
||||
return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors);
|
||||
}, false, baselineOpts);
|
||||
// TODO: Type baselines (need to refactor out from compilerRunner)
|
||||
});
|
||||
|
||||
// TODO: Type baselines (need to refactor out from compilerRunner)
|
||||
}
|
||||
}
|
||||
|
||||
class RWCRunner extends RunnerBase {
|
||||
private runnerPath = "tests/runners/rwc";
|
||||
private sourcePath = "tests/cases/rwc/";
|
||||
|
||||
private harnessCompiler: Harness.Compiler.HarnessCompiler;
|
||||
private static sourcePath = "tests/cases/rwc/";
|
||||
|
||||
/** Setup the runner's tests so that they are ready to be executed by the harness
|
||||
* The first test should be a describe/it block that sets up the harness's compiler instance appropriately
|
||||
*/
|
||||
public initializeTests(): void {
|
||||
// Recreate the compiler with the default lib
|
||||
Harness.Compiler.recreate({ useMinimalDefaultLib: false, noImplicitAny: false });
|
||||
this.harnessCompiler = Harness.Compiler.getCompiler();
|
||||
|
||||
// Read in and evaluate the test list
|
||||
var testList = Harness.IO.listFiles(this.sourcePath, /.+\.json$/);
|
||||
var testList = Harness.IO.listFiles(RWCRunner.sourcePath, /.+\.json$/);
|
||||
for (var i = 0; i < testList.length; i++) {
|
||||
this.runTest(testList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private runTest(jsonFilename: string) {
|
||||
describe("Testing a RWC project: " + jsonFilename, () => {
|
||||
RWC.runRWCTest(jsonFilename);
|
||||
});
|
||||
RWC.runRWCTest(jsonFilename);
|
||||
}
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
///<reference path="harness.ts" />
|
||||
///<reference path="runnerbase.ts" />
|
||||
|
||||
class UnitTestRunner extends RunnerBase {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
public initializeTests() {
|
||||
this.tests = this.enumerateFiles('tests/cases/unittests/services', /\.ts/i);
|
||||
|
||||
var outfile = new Harness.Compiler.WriterAggregator()
|
||||
var outerr = new Harness.Compiler.WriterAggregator();
|
||||
// note this is running immediately to generate tests to be run later inside describe/it
|
||||
// need a fresh instance so that the previous runner's last test is not hanging around
|
||||
var harnessCompiler = Harness.Compiler.getCompiler({ useExistingInstance: false });
|
||||
|
||||
var toBeAdded = this.tests.map(test => {
|
||||
return { unitName: test, content: Harness.IO.readFile(test) }
|
||||
});
|
||||
harnessCompiler.addInputFiles(toBeAdded);
|
||||
harnessCompiler.setCompilerOptions({ noResolve: true });
|
||||
|
||||
var stdout = new Harness.Compiler.EmitterIOHost();
|
||||
var emitDiagnostics = harnessCompiler.emitAll(stdout);
|
||||
var results = stdout.toArray();
|
||||
var lines: string[] = [];
|
||||
results.forEach(v => lines = lines.concat(v.file.lines));
|
||||
var code = lines.join("\n")
|
||||
|
||||
var nodeContext: any = undefined;
|
||||
if (Utils.getExecutionEnvironment() === Utils.ExecutionEnvironment.Node) {
|
||||
nodeContext = {
|
||||
require: require,
|
||||
process: process,
|
||||
describe: describe,
|
||||
it: it,
|
||||
assert: assert,
|
||||
beforeEach: beforeEach,
|
||||
afterEach: afterEach,
|
||||
before: before,
|
||||
after: after,
|
||||
Harness: Harness,
|
||||
IO: Harness.IO,
|
||||
ts: ts,
|
||||
TypeScript: TypeScript
|
||||
// FourSlash: FourSlash
|
||||
};
|
||||
}
|
||||
|
||||
describe("Setup compiler for compiler unittests", () => {
|
||||
// ensures a clean compiler instance when tests are eventually executed following this describe block
|
||||
harnessCompiler = Harness.Compiler.getCompiler({
|
||||
useExistingInstance: false,
|
||||
optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false }
|
||||
});
|
||||
});
|
||||
|
||||
// this generated code is a series of top level describe/it blocks that will run in between the setup and cleanup blocks in this file
|
||||
Utils.evalFile(code, "generated_test_code.js", nodeContext);
|
||||
|
||||
describe("Cleanup after unittests", () => {
|
||||
var harnessCompiler = Harness.Compiler.getCompiler({
|
||||
useExistingInstance: false,
|
||||
optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false }
|
||||
});
|
||||
});
|
||||
|
||||
// note this runs immediately (ie before this same code in the describe block above)
|
||||
// to make sure the next runner doesn't include the previous one's stuff
|
||||
harnessCompiler = Harness.Compiler.getCompiler({ useExistingInstance: false });
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -476,8 +476,6 @@ module TypeScript {
|
||||
//}
|
||||
}
|
||||
|
||||
var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl);
|
||||
var funcSignature = funcPullDecl.getSignatureSymbol(this.semanticInfoChain);
|
||||
this.emitDeclarationComments(funcDecl);
|
||||
|
||||
this.emitIndent();
|
||||
@ -603,11 +601,6 @@ module TypeScript {
|
||||
private emitConstructSignature(funcDecl: ConstructSignatureSyntax) {
|
||||
var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl);
|
||||
|
||||
var start = new Date().getTime();
|
||||
var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl);
|
||||
|
||||
TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start;
|
||||
|
||||
this.emitDeclarationComments(funcDecl);
|
||||
|
||||
this.emitIndent();
|
||||
@ -633,11 +626,6 @@ module TypeScript {
|
||||
private emitMethodSignature(funcDecl: MethodSignatureSyntax) {
|
||||
var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl);
|
||||
|
||||
var start = new Date().getTime();
|
||||
var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl);
|
||||
|
||||
TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start;
|
||||
|
||||
this.emitDeclarationComments(funcDecl);
|
||||
|
||||
this.emitIndent();
|
||||
@ -817,7 +805,6 @@ module TypeScript {
|
||||
var parameter = funcDecl.callSignature.parameterList.parameters[i];
|
||||
var parameterDecl = this.semanticInfoChain.getDeclForAST(parameter);
|
||||
if (hasFlag(parameterDecl.flags, PullElementFlags.PropertyParameter)) {
|
||||
var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl);
|
||||
this.emitDeclarationComments(parameter);
|
||||
this.declFile.Write(this.getIndentString());
|
||||
this.emitClassElementModifiers(parameter.modifiers);
|
||||
@ -838,7 +825,6 @@ module TypeScript {
|
||||
|
||||
var className = classDecl.identifier.text();
|
||||
this.emitDeclarationComments(classDecl);
|
||||
var classPullDecl = this.semanticInfoChain.getDeclForAST(classDecl);
|
||||
this.emitDeclFlags(classDecl, "class");
|
||||
this.declFile.Write(className);
|
||||
|
||||
@ -934,7 +920,6 @@ module TypeScript {
|
||||
|
||||
var interfaceName = interfaceDecl.identifier.text();
|
||||
this.emitDeclarationComments(interfaceDecl);
|
||||
var interfacePullDecl = this.semanticInfoChain.getDeclForAST(interfaceDecl);
|
||||
this.emitDeclFlags(interfaceDecl, "interface");
|
||||
this.declFile.Write(interfaceName);
|
||||
|
||||
@ -980,7 +965,6 @@ module TypeScript {
|
||||
}
|
||||
|
||||
this.emitDeclarationComments(moduleDecl);
|
||||
var modulePullDecl = this.semanticInfoChain.getDeclForAST(moduleDecl);
|
||||
this.emitDeclFlags(moduleDecl, "enum");
|
||||
this.declFile.WriteLine(moduleDecl.identifier.text() + " {");
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ module TypeScript {
|
||||
|
||||
export function preProcessFile(fileName: string, sourceText: IScriptSnapshot, readImportFiles = true): IPreProcessedFileInfo {
|
||||
var text = SimpleText.fromScriptSnapshot(sourceText);
|
||||
var scanner = Scanner.createScanner(ts.ScriptTarget.ES5, text, reportDiagnostic);
|
||||
var scanner = Scanner.createScanner(ts.ScriptTarget.Latest, text, reportDiagnostic);
|
||||
|
||||
var firstToken = scanner.scan(/*allowRegularExpression:*/ false);
|
||||
|
||||
|
||||
@ -512,7 +512,7 @@ module TypeScript {
|
||||
for (var i = 0, n = fileNames.length; i < n; i++) {
|
||||
var fileName = fileNames[i];
|
||||
|
||||
var document = this.getDocument(fileNames[i]);
|
||||
var document = this.getDocument(fileName);
|
||||
|
||||
sharedEmitter = this._emitDocumentDeclarations(document, emitOptions,
|
||||
file => emitOutput.outputFiles.push(file), sharedEmitter);
|
||||
@ -578,7 +578,6 @@ module TypeScript {
|
||||
var sourceUnit = document.sourceUnit();
|
||||
Debug.assert(this._shouldEmit(document));
|
||||
|
||||
var typeScriptFileName = document.fileName;
|
||||
if (!emitter) {
|
||||
var javaScriptFileName = this.mapOutputFileName(document, emitOptions, TypeScriptCompiler.mapToJSFileName);
|
||||
var outFile = new TextWriter(javaScriptFileName, this.writeByteOrderMarkForDocument(document), OutputFileType.JavaScript);
|
||||
@ -799,8 +798,6 @@ module TypeScript {
|
||||
}
|
||||
|
||||
private extractResolutionContextFromAST(resolver: PullTypeResolver, ast: ISyntaxElement, document: Document, propagateContextualTypes: boolean): { ast: ISyntaxElement; enclosingDecl: PullDecl; resolutionContext: PullTypeResolutionContext; inContextuallyTypedAssignment: boolean; inWithBlock: boolean; } {
|
||||
var scriptName = document.fileName;
|
||||
|
||||
var enclosingDecl: PullDecl = null;
|
||||
var enclosingDeclAST: ISyntaxElement = null;
|
||||
var inContextuallyTypedAssignment = false;
|
||||
@ -981,7 +978,6 @@ module TypeScript {
|
||||
|
||||
case SyntaxKind.ReturnStatement:
|
||||
if (propagateContextualTypes) {
|
||||
var returnStatement = <ReturnStatementSyntax>current;
|
||||
var contextualType: PullTypeSymbol = null;
|
||||
|
||||
if (enclosingDecl && (enclosingDecl.kind & PullElementKind.SomeFunction)) {
|
||||
|
||||
@ -7,12 +7,6 @@ module TypeScript {
|
||||
}
|
||||
|
||||
export function integerMultiplyLow32Bits(n1: number, n2: number): number {
|
||||
var n1Low16 = n1 & 0x0000ffff;
|
||||
var n1High16 = n1 >>> 16;
|
||||
|
||||
var n2Low16 = n2 & 0x0000ffff;
|
||||
var n2High16 = n2 >>> 16;
|
||||
|
||||
var resultLow32 = (((n1 & 0xffff0000) * n2) >>> 0) + (((n1 & 0x0000ffff) * n2) >>> 0) >>> 0;
|
||||
return resultLow32;
|
||||
}
|
||||
|
||||
@ -233,7 +233,12 @@ module ts.NavigationBar {
|
||||
return createItem(node, getTextOfNode((<FunctionDeclaration>node).name), ts.ScriptElementKind.functionElement);
|
||||
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.variableElement);
|
||||
if (node.flags & NodeFlags.Const) {
|
||||
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.constantElement);
|
||||
}
|
||||
else {
|
||||
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.variableElement);
|
||||
}
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement);
|
||||
|
||||
@ -78,7 +78,7 @@ module ts {
|
||||
update(scriptSnapshot: TypeScript.IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TypeScript.TextChangeRange): SourceFile;
|
||||
}
|
||||
|
||||
var scanner: Scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ true);
|
||||
var scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
|
||||
|
||||
var emptyArray: any[] = [];
|
||||
|
||||
@ -576,7 +576,7 @@ module ts {
|
||||
return this.checker.getPropertyOfType(this, propertyName);
|
||||
}
|
||||
getApparentProperties(): Symbol[] {
|
||||
return this.checker.getAugmentedPropertiesOfApparentType(this);
|
||||
return this.checker.getAugmentedPropertiesOfType(this);
|
||||
}
|
||||
getCallSignatures(): Signature[] {
|
||||
return this.checker.getSignaturesOfType(this, SignatureKind.Call);
|
||||
@ -1022,12 +1022,37 @@ module ts {
|
||||
containerKind: string;
|
||||
containerName: string;
|
||||
}
|
||||
|
||||
|
||||
export enum SymbolDisplayPartKind {
|
||||
aliasName,
|
||||
className,
|
||||
enumName,
|
||||
fieldName,
|
||||
interfaceName,
|
||||
keyword,
|
||||
lineBreak,
|
||||
numericLiteral,
|
||||
stringLiteral,
|
||||
localName,
|
||||
methodName,
|
||||
moduleName,
|
||||
operator,
|
||||
parameterName,
|
||||
propertyName,
|
||||
punctuation,
|
||||
space,
|
||||
text,
|
||||
typeParameterName,
|
||||
enumMemberName,
|
||||
functionName,
|
||||
regularExpressionLiteral,
|
||||
}
|
||||
|
||||
export interface SymbolDisplayPart {
|
||||
text: string;
|
||||
kind: string;
|
||||
}
|
||||
|
||||
|
||||
export interface QuickInfo {
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
@ -1238,7 +1263,9 @@ module ts {
|
||||
|
||||
static label = "label";
|
||||
|
||||
static alias = "alias"
|
||||
static alias = "alias";
|
||||
|
||||
static constantElement = "constant";
|
||||
}
|
||||
|
||||
export class ScriptElementKindModifier {
|
||||
@ -1334,7 +1361,12 @@ module ts {
|
||||
resetWriter();
|
||||
return {
|
||||
displayParts: () => displayParts,
|
||||
writeKind: writeKind,
|
||||
writeKeyword: text => writeKind(text, SymbolDisplayPartKind.keyword),
|
||||
writeOperator: text => writeKind(text, SymbolDisplayPartKind.operator),
|
||||
writePunctuation: text => writeKind(text, SymbolDisplayPartKind.punctuation),
|
||||
writeSpace: text => writeKind(text, SymbolDisplayPartKind.space),
|
||||
writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral),
|
||||
writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName),
|
||||
writeSymbol: writeSymbol,
|
||||
writeLine: writeLine,
|
||||
increaseIndent: () => { indent++; },
|
||||
@ -1458,7 +1490,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] {
|
||||
export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] {
|
||||
writeDisplayParts(displayPartWriter);
|
||||
var result = displayPartWriter.displayParts();
|
||||
displayPartWriter.clear();
|
||||
@ -1467,26 +1499,26 @@ module ts {
|
||||
|
||||
export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.writeType(type, writer, enclosingDeclaration, flags);
|
||||
typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typeChecker.writeSymbol(symbol, writer, enclosingDeclaration, meaning, flags);
|
||||
typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags);
|
||||
});
|
||||
}
|
||||
|
||||
function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]{
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.writeSignature(signature, writer, enclosingDeclaration, flags);
|
||||
typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function getDefaultCompilerOptions(): CompilerOptions {
|
||||
// Set "ES5" target by default for language service
|
||||
// Set "ScriptTarget.Latest" target by default for language service
|
||||
return {
|
||||
target: ScriptTarget.ES5,
|
||||
target: ScriptTarget.Latest,
|
||||
module: ModuleKind.None,
|
||||
};
|
||||
}
|
||||
@ -1948,18 +1980,32 @@ module ts {
|
||||
return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node);
|
||||
}
|
||||
|
||||
function isRightSideOfQualifiedName(node: Node) {
|
||||
return node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node;
|
||||
}
|
||||
|
||||
function isRightSideOfPropertyAccess(node: Node) {
|
||||
return node.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.parent).right === node;
|
||||
}
|
||||
|
||||
function isCallExpressionTarget(node: Node): boolean {
|
||||
if (node.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.parent).right === node)
|
||||
if (isRightSideOfPropertyAccess(node)) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node.parent.kind === SyntaxKind.CallExpression && (<CallExpression>node.parent).func === node;
|
||||
}
|
||||
|
||||
function isNewExpressionTarget(node: Node): boolean {
|
||||
if (node.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.parent).right === node)
|
||||
if (isRightSideOfPropertyAccess(node)) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node.parent.kind === SyntaxKind.NewExpression && (<CallExpression>node.parent).func === node;
|
||||
}
|
||||
|
||||
function isNameOfModuleDeclaration(node: Node) {
|
||||
return node.parent.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>node.parent).name === node;
|
||||
}
|
||||
|
||||
function isNameOfFunctionDeclaration(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.Identifier &&
|
||||
isAnyFunction(node.parent) && (<FunctionDeclaration>node.parent).name === node;
|
||||
@ -1992,7 +2038,7 @@ module ts {
|
||||
|
||||
function isNameOfExternalModuleImportOrDeclaration(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.StringLiteral &&
|
||||
((node.parent.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>node.parent).name === node) ||
|
||||
(isNameOfModuleDeclaration(node) ||
|
||||
(node.parent.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node.parent).externalModuleName === node));
|
||||
}
|
||||
|
||||
@ -2578,10 +2624,9 @@ module ts {
|
||||
}
|
||||
|
||||
var type = typeInfoResolver.getTypeOfNode(mappedNode);
|
||||
var apparentType = type && typeInfoResolver.getApparentType(type);
|
||||
if (apparentType) {
|
||||
if (type) {
|
||||
// Filter private properties
|
||||
forEach(apparentType.getApparentProperties(), symbol => {
|
||||
forEach(type.getApparentProperties(), symbol => {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccess>(mappedNode.parent), symbol.name)) {
|
||||
symbols.push(symbol);
|
||||
}
|
||||
@ -2701,7 +2746,7 @@ module ts {
|
||||
|
||||
// TODO(drosen): use contextual SemanticMeaning.
|
||||
function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker): string {
|
||||
var flags = typeInfoResolver.getRootSymbols(symbol)[0].getFlags();
|
||||
var flags = symbol.getFlags();
|
||||
|
||||
if (flags & SymbolFlags.Class) return ScriptElementKind.classElement;
|
||||
if (flags & SymbolFlags.Enum) return ScriptElementKind.enumElement;
|
||||
@ -2729,15 +2774,32 @@ module ts {
|
||||
if (isFirstDeclarationOfSymbolParameter(symbol)) {
|
||||
return ScriptElementKind.parameterElement;
|
||||
}
|
||||
else if(symbol.valueDeclaration && symbol.valueDeclaration.flags & NodeFlags.Const) {
|
||||
return ScriptElementKind.constantElement;
|
||||
}
|
||||
return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement;
|
||||
}
|
||||
if (flags & SymbolFlags.Function) return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement;
|
||||
if (flags & SymbolFlags.GetAccessor) return ScriptElementKind.memberGetAccessorElement;
|
||||
if (flags & SymbolFlags.SetAccessor) return ScriptElementKind.memberSetAccessorElement;
|
||||
if (flags & SymbolFlags.Method) return ScriptElementKind.memberFunctionElement;
|
||||
if (flags & SymbolFlags.Property) return ScriptElementKind.memberVariableElement;
|
||||
if (flags & SymbolFlags.Constructor) return ScriptElementKind.constructorImplementationElement;
|
||||
|
||||
if (flags & SymbolFlags.Property) {
|
||||
if (flags & SymbolFlags.UnionProperty) {
|
||||
return forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => {
|
||||
var rootSymbolFlags = rootSymbol.getFlags();
|
||||
if (rootSymbolFlags & SymbolFlags.Property) {
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
}
|
||||
if (rootSymbolFlags & SymbolFlags.GetAccessor) return ScriptElementKind.memberVariableElement;
|
||||
if (rootSymbolFlags & SymbolFlags.SetAccessor) return ScriptElementKind.memberVariableElement;
|
||||
Debug.assert(rootSymbolFlags & SymbolFlags.Method);
|
||||
}) || ScriptElementKind.memberFunctionElement;
|
||||
}
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
}
|
||||
|
||||
return ScriptElementKind.unknown;
|
||||
}
|
||||
|
||||
@ -2760,7 +2822,7 @@ module ts {
|
||||
case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement;
|
||||
case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement;
|
||||
case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement;
|
||||
case SyntaxKind.VariableDeclaration: return ScriptElementKind.variableElement;
|
||||
case SyntaxKind.VariableDeclaration: return node.flags & NodeFlags.Const ? ScriptElementKind.constantElement: ScriptElementKind.variableElement;
|
||||
case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement;
|
||||
case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement;
|
||||
case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement;
|
||||
@ -2789,7 +2851,7 @@ module ts {
|
||||
semanticMeaning = getMeaningFromLocation(location)) {
|
||||
var displayParts: SymbolDisplayPart[] = [];
|
||||
var documentation: SymbolDisplayPart[];
|
||||
var symbolFlags = typeResolver.getRootSymbols(symbol)[0].flags;
|
||||
var symbolFlags = symbol.flags;
|
||||
var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver);
|
||||
var hasAddedSymbolInfo: boolean;
|
||||
// Class at constructor site need to be shown as constructor apart from property,method, vars
|
||||
@ -2849,6 +2911,7 @@ module ts {
|
||||
switch (symbolKind) {
|
||||
case ScriptElementKind.memberVariableElement:
|
||||
case ScriptElementKind.variableElement:
|
||||
case ScriptElementKind.constantElement:
|
||||
case ScriptElementKind.parameterElement:
|
||||
case ScriptElementKind.localVariableElement:
|
||||
// If it is call or construct signature of lambda's write type name
|
||||
@ -3004,7 +3067,7 @@ module ts {
|
||||
// If the type is type parameter, format it specially
|
||||
if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter) {
|
||||
var typeParameterParts = mapToDisplayParts(writer => {
|
||||
typeResolver.writeTypeParameter(<TypeParameter>type, writer, enclosingDeclaration);
|
||||
typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(<TypeParameter>type, writer, enclosingDeclaration);
|
||||
});
|
||||
displayParts.push.apply(displayParts, typeParameterParts);
|
||||
}
|
||||
@ -3016,7 +3079,8 @@ module ts {
|
||||
symbolFlags & SymbolFlags.Method ||
|
||||
symbolFlags & SymbolFlags.Constructor ||
|
||||
symbolFlags & SymbolFlags.Signature ||
|
||||
symbolFlags & SymbolFlags.Accessor) {
|
||||
symbolFlags & SymbolFlags.Accessor ||
|
||||
symbolKind === ScriptElementKind.memberFunctionElement) {
|
||||
var allSignatures = type.getCallSignatures();
|
||||
addSignatureDisplayParts(allSignatures[0], allSignatures);
|
||||
}
|
||||
@ -3072,7 +3136,7 @@ module ts {
|
||||
|
||||
function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node) {
|
||||
var typeParameterParts = mapToDisplayParts(writer => {
|
||||
typeResolver.writeTypeParametersOfSymbol(symbol, writer, enclosingDeclaration);
|
||||
typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration);
|
||||
});
|
||||
displayParts.push.apply(displayParts, typeParameterParts);
|
||||
}
|
||||
@ -3872,8 +3936,8 @@ module ts {
|
||||
// before and after it have to be a non-identifier char).
|
||||
var endPosition = position + symbolNameLength;
|
||||
|
||||
if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.ES5)) &&
|
||||
(endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.ES5))) {
|
||||
if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) &&
|
||||
(endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))) {
|
||||
// Found a real match. Keep searching.
|
||||
positions.push(position);
|
||||
}
|
||||
@ -4524,8 +4588,9 @@ module ts {
|
||||
}
|
||||
|
||||
function isTypeReference(node: Node): boolean {
|
||||
if (node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node)
|
||||
if (isRightSideOfQualifiedName(node)) {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent.kind === SyntaxKind.TypeReference;
|
||||
}
|
||||
@ -4675,67 +4740,64 @@ module ts {
|
||||
}
|
||||
|
||||
function getNameOrDottedNameSpan(filename: string, startPos: number, endPos: number): TypeScript.TextSpan {
|
||||
function getTypeInfoEligiblePath(filename: string, position: number, isConstructorValidPosition: boolean) {
|
||||
var sourceUnit = syntaxTreeCache.getCurrentFileSyntaxTree(filename).sourceUnit();
|
||||
filename = ts.normalizeSlashes(filename);
|
||||
// Get node at the location
|
||||
var node = getTouchingPropertyName(getCurrentSourceFile(filename), startPos);
|
||||
|
||||
var ast = TypeScript.ASTHelpers.getAstAtPosition(sourceUnit, position, /*useTrailingTriviaAsLimChar*/ false, /*forceInclusive*/ true);
|
||||
if (ast === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ast.kind() === TypeScript.SyntaxKind.ParameterList && ast.parent.kind() === TypeScript.SyntaxKind.CallSignature && ast.parent.parent.kind() === TypeScript.SyntaxKind.ConstructorDeclaration) {
|
||||
ast = ast.parent.parent;
|
||||
}
|
||||
|
||||
switch (ast.kind()) {
|
||||
default:
|
||||
return null;
|
||||
case TypeScript.SyntaxKind.ConstructorDeclaration:
|
||||
var constructorAST = <TypeScript.ConstructorDeclarationSyntax>ast;
|
||||
if (!isConstructorValidPosition || !(position >= TypeScript.start(constructorAST) && position <= TypeScript.start(constructorAST) + "constructor".length)) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return ast;
|
||||
}
|
||||
case TypeScript.SyntaxKind.FunctionDeclaration:
|
||||
return null;
|
||||
case TypeScript.SyntaxKind.MemberAccessExpression:
|
||||
case TypeScript.SyntaxKind.QualifiedName:
|
||||
case TypeScript.SyntaxKind.SuperKeyword:
|
||||
case TypeScript.SyntaxKind.StringLiteral:
|
||||
case TypeScript.SyntaxKind.ThisKeyword:
|
||||
case TypeScript.SyntaxKind.IdentifierName:
|
||||
return ast;
|
||||
}
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
filename = TypeScript.switchToForwardSlashes(filename);
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.Identifier:
|
||||
break;
|
||||
|
||||
var node = getTypeInfoEligiblePath(filename, startPos, false);
|
||||
if (!node) return null;
|
||||
// Cant create the text span
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
while (node) {
|
||||
if (TypeScript.ASTHelpers.isNameOfMemberAccessExpression(node) ||
|
||||
TypeScript.ASTHelpers.isRightSideOfQualifiedName(node)) {
|
||||
node = node.parent;
|
||||
var nodeForStartPos = node;
|
||||
while (true) {
|
||||
if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) {
|
||||
// If on the span is in right side of the the property or qualified name, return the span from the qualified name pos to end of this node
|
||||
nodeForStartPos = nodeForStartPos.parent;
|
||||
}
|
||||
else if (isNameOfModuleDeclaration(nodeForStartPos)) {
|
||||
// If this is name of a module declarations, check if this is right side of dotted module name
|
||||
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
|
||||
// Then this name is name from dotted module
|
||||
if (nodeForStartPos.parent.parent.kind === SyntaxKind.ModuleDeclaration &&
|
||||
(<ModuleDeclaration>nodeForStartPos.parent.parent).body === nodeForStartPos.parent) {
|
||||
// Use parent module declarations name for start pos
|
||||
nodeForStartPos = (<ModuleDeclaration>nodeForStartPos.parent.parent).name;
|
||||
}
|
||||
else {
|
||||
// We have to use this name for start pos
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Is not a member expression so we have found the node for start pos
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TypeScript.TextSpan.fromBounds(
|
||||
TypeScript.start(node),
|
||||
TypeScript.end(node));
|
||||
return TypeScript.TextSpan.fromBounds(nodeForStartPos.getStart(), node.getEnd());
|
||||
}
|
||||
|
||||
function getBreakpointStatementAtPosition(filename: string, position: number) {
|
||||
// doesn't use compiler - no need to synchronize with host
|
||||
filename = TypeScript.switchToForwardSlashes(filename);
|
||||
|
||||
var syntaxtree = getSyntaxTree(filename);
|
||||
return TypeScript.Services.Breakpoints.getBreakpointLocation(syntaxtree, position);
|
||||
filename = ts.normalizeSlashes(filename);
|
||||
return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(filename), position);
|
||||
}
|
||||
|
||||
function getNavigationBarItems(filename: string): NavigationBarItem[] {
|
||||
@ -4773,7 +4835,24 @@ module ts {
|
||||
}
|
||||
}
|
||||
else if (flags & SymbolFlags.Module) {
|
||||
return ClassificationTypeNames.moduleName;
|
||||
// Only classify a module as such if
|
||||
// - It appears in a namespace context.
|
||||
// - There exists a module declaration which actually impacts the value side.
|
||||
if (meaningAtPosition & SemanticMeaning.Namespace ||
|
||||
(meaningAtPosition & SemanticMeaning.Value && hasValueSideModule(symbol))) {
|
||||
return ClassificationTypeNames.moduleName;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
/**
|
||||
* Returns true if there exists a module that introduces entities on the value side.
|
||||
*/
|
||||
function hasValueSideModule(symbol: Symbol): boolean {
|
||||
return forEach(symbol.declarations, declaration => {
|
||||
return declaration.kind === SyntaxKind.ModuleDeclaration && isInstantiated(declaration);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -4804,115 +4883,99 @@ module ts {
|
||||
var sourceFile = getCurrentSourceFile(fileName);
|
||||
|
||||
var result: ClassifiedSpan[] = [];
|
||||
processElement(sourceFile.getSourceUnit());
|
||||
processElement(sourceFile);
|
||||
|
||||
return result;
|
||||
|
||||
function classifyTrivia(trivia: TypeScript.ISyntaxTrivia) {
|
||||
if (trivia.isComment() && span.intersectsWith(trivia.fullStart(), trivia.fullWidth())) {
|
||||
function classifyComment(comment: CommentRange) {
|
||||
var width = comment.end - comment.pos;
|
||||
if (span.intersectsWith(comment.pos, width)) {
|
||||
result.push({
|
||||
textSpan: new TypeScript.TextSpan(trivia.fullStart(), trivia.fullWidth()),
|
||||
textSpan: new TypeScript.TextSpan(comment.pos, width),
|
||||
classificationType: ClassificationTypeNames.comment
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function classifyTriviaList(trivia: TypeScript.ISyntaxTriviaList) {
|
||||
for (var i = 0, n = trivia.count(); i < n; i++) {
|
||||
classifyTrivia(trivia.syntaxTriviaAt(i));
|
||||
}
|
||||
}
|
||||
function classifyToken(token: Node): void {
|
||||
forEach(getLeadingCommentRanges(sourceFile.text, token.getFullStart()), classifyComment);
|
||||
|
||||
function classifyToken(token: TypeScript.ISyntaxToken) {
|
||||
if (token.hasLeadingComment()) {
|
||||
classifyTriviaList(token.leadingTrivia());
|
||||
}
|
||||
|
||||
if (TypeScript.width(token) > 0) {
|
||||
if (token.getWidth() > 0) {
|
||||
var type = classifyTokenType(token);
|
||||
if (type) {
|
||||
result.push({
|
||||
textSpan: new TypeScript.TextSpan(TypeScript.start(token), TypeScript.width(token)),
|
||||
textSpan: new TypeScript.TextSpan(token.getStart(), token.getWidth()),
|
||||
classificationType: type
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (token.hasTrailingComment()) {
|
||||
classifyTriviaList(token.trailingTrivia());
|
||||
}
|
||||
forEach(getTrailingCommentRanges(sourceFile.text, token.getEnd()), classifyComment);
|
||||
}
|
||||
|
||||
function classifyTokenType(token: TypeScript.ISyntaxToken): string {
|
||||
var tokenKind = token.kind();
|
||||
if (TypeScript.SyntaxFacts.isAnyKeyword(token.kind())) {
|
||||
function classifyTokenType(token: Node): string {
|
||||
var tokenKind = token.kind;
|
||||
if (isKeyword(tokenKind)) {
|
||||
return ClassificationTypeNames.keyword;
|
||||
}
|
||||
|
||||
// Special case < and > If they appear in a generic context they are punctation,
|
||||
// Special case < and > If they appear in a generic context they are punctuation,
|
||||
// not operators.
|
||||
if (tokenKind === TypeScript.SyntaxKind.LessThanToken || tokenKind === TypeScript.SyntaxKind.GreaterThanToken) {
|
||||
var tokenParentKind = token.parent.kind();
|
||||
if (tokenParentKind === TypeScript.SyntaxKind.TypeArgumentList ||
|
||||
tokenParentKind === TypeScript.SyntaxKind.TypeParameterList) {
|
||||
|
||||
if (tokenKind === SyntaxKind.LessThanToken || tokenKind === SyntaxKind.GreaterThanToken) {
|
||||
// If the node owning the token has a type argument list or type parameter list, then
|
||||
// we can effectively assume that a '<' and '>' belong to those lists.
|
||||
if (getTypeArgumentOrTypeParameterList(token.parent)) {
|
||||
return ClassificationTypeNames.punctuation;
|
||||
}
|
||||
}
|
||||
|
||||
if (TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(tokenKind) ||
|
||||
TypeScript.SyntaxFacts.isPrefixUnaryExpressionOperatorToken(tokenKind)) {
|
||||
return ClassificationTypeNames.operator;
|
||||
if (isPunctuation(token.kind)) {
|
||||
// the '=' in a variable declaration is special cased here.
|
||||
if (token.parent.kind === SyntaxKind.BinaryExpression ||
|
||||
token.parent.kind === SyntaxKind.VariableDeclaration ||
|
||||
token.parent.kind === SyntaxKind.PrefixOperator ||
|
||||
token.parent.kind === SyntaxKind.PostfixOperator ||
|
||||
token.parent.kind === SyntaxKind.ConditionalExpression) {
|
||||
return ClassificationTypeNames.operator;
|
||||
}
|
||||
else {
|
||||
return ClassificationTypeNames.punctuation;
|
||||
}
|
||||
}
|
||||
else if (TypeScript.SyntaxFacts.isAnyPunctuation(tokenKind)) {
|
||||
return ClassificationTypeNames.punctuation;
|
||||
}
|
||||
else if (tokenKind === TypeScript.SyntaxKind.NumericLiteral) {
|
||||
else if (tokenKind === SyntaxKind.NumericLiteral) {
|
||||
return ClassificationTypeNames.numericLiteral;
|
||||
}
|
||||
else if (tokenKind === TypeScript.SyntaxKind.StringLiteral) {
|
||||
else if (tokenKind === SyntaxKind.StringLiteral) {
|
||||
return ClassificationTypeNames.stringLiteral;
|
||||
}
|
||||
else if (tokenKind === TypeScript.SyntaxKind.RegularExpressionLiteral) {
|
||||
// TODO: we shoudl get another classification type for these literals.
|
||||
else if (tokenKind === SyntaxKind.RegularExpressionLiteral) {
|
||||
// TODO: we should get another classification type for these literals.
|
||||
return ClassificationTypeNames.stringLiteral;
|
||||
}
|
||||
else if (tokenKind === TypeScript.SyntaxKind.IdentifierName) {
|
||||
var current: TypeScript.ISyntaxNodeOrToken = token;
|
||||
var parent = token.parent;
|
||||
while (parent.kind() === TypeScript.SyntaxKind.QualifiedName) {
|
||||
current = parent;
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
switch (parent.kind()) {
|
||||
case TypeScript.SyntaxKind.SimplePropertyAssignment:
|
||||
if ((<TypeScript.SimplePropertyAssignmentSyntax>parent).propertyName === token) {
|
||||
return ClassificationTypeNames.identifier;
|
||||
}
|
||||
return;
|
||||
case TypeScript.SyntaxKind.ClassDeclaration:
|
||||
if ((<TypeScript.ClassDeclarationSyntax>parent).identifier === token) {
|
||||
else if (tokenKind === SyntaxKind.Identifier) {
|
||||
switch (token.parent.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
if ((<ClassDeclaration>token.parent).name === token) {
|
||||
return ClassificationTypeNames.className;
|
||||
}
|
||||
return;
|
||||
case TypeScript.SyntaxKind.TypeParameter:
|
||||
if ((<TypeScript.TypeParameterSyntax>parent).identifier === token) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
if ((<TypeParameterDeclaration>token.parent).name === token) {
|
||||
return ClassificationTypeNames.typeParameterName;
|
||||
}
|
||||
return;
|
||||
case TypeScript.SyntaxKind.InterfaceDeclaration:
|
||||
if ((<TypeScript.InterfaceDeclarationSyntax>parent).identifier === token) {
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
if ((<InterfaceDeclaration>token.parent).name === token) {
|
||||
return ClassificationTypeNames.interfaceName;
|
||||
}
|
||||
return;
|
||||
case TypeScript.SyntaxKind.EnumDeclaration:
|
||||
if ((<TypeScript.EnumDeclarationSyntax>parent).identifier === token) {
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
if ((<EnumDeclaration>token.parent).name === token) {
|
||||
return ClassificationTypeNames.enumName;
|
||||
}
|
||||
return;
|
||||
case TypeScript.SyntaxKind.ModuleDeclaration:
|
||||
if ((<TypeScript.ModuleDeclarationSyntax>parent).name === current) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if ((<ModuleDeclaration>token.parent).name === token) {
|
||||
return ClassificationTypeNames.moduleName;
|
||||
}
|
||||
return;
|
||||
@ -4922,19 +4985,18 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function processElement(element: TypeScript.ISyntaxElement) {
|
||||
function processElement(element: Node) {
|
||||
// Ignore nodes that don't intersect the original span to classify.
|
||||
if (!TypeScript.isShared(element) && span.intersectsWith(TypeScript.fullStart(element), TypeScript.fullWidth(element))) {
|
||||
for (var i = 0, n = TypeScript.childCount(element); i < n; i++) {
|
||||
var child = TypeScript.childAt(element, i);
|
||||
if (child) {
|
||||
if (TypeScript.isToken(child)) {
|
||||
classifyToken(<TypeScript.ISyntaxToken>child);
|
||||
}
|
||||
else {
|
||||
// Recurse into our child nodes.
|
||||
processElement(child);
|
||||
}
|
||||
if (span.intersectsWith(element.getFullStart(), element.getFullWidth())) {
|
||||
var children = element.getChildren();
|
||||
for (var i = 0, n = children.length; i < n; i++) {
|
||||
var child = children[i];
|
||||
if (isToken(child)) {
|
||||
classifyToken(child);
|
||||
}
|
||||
else {
|
||||
// Recurse into our child nodes.
|
||||
processElement(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5337,7 +5399,7 @@ module ts {
|
||||
|
||||
/// Classifier
|
||||
export function createClassifier(host: Logger): Classifier {
|
||||
var scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ false);
|
||||
var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
||||
|
||||
/// We do not have a full parser support to know when we should parse a regex or not
|
||||
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
|
||||
|
||||
@ -174,6 +174,7 @@ module ts {
|
||||
export enum LanguageVersion {
|
||||
EcmaScript3 = 0,
|
||||
EcmaScript5 = 1,
|
||||
EcmaScript6 = 2,
|
||||
}
|
||||
|
||||
export enum ModuleGenTarget {
|
||||
@ -213,6 +214,7 @@ module ts {
|
||||
switch (languageVersion) {
|
||||
case LanguageVersion.EcmaScript3: return ScriptTarget.ES3
|
||||
case LanguageVersion.EcmaScript5: return ScriptTarget.ES5;
|
||||
case LanguageVersion.EcmaScript6: return ScriptTarget.ES6;
|
||||
default: throw Error("unsupported LanguageVersion value: " + languageVersion);
|
||||
}
|
||||
}
|
||||
@ -234,6 +236,7 @@ module ts {
|
||||
switch (scriptTarget) {
|
||||
case ScriptTarget.ES3: return LanguageVersion.EcmaScript3;
|
||||
case ScriptTarget.ES5: return LanguageVersion.EcmaScript5;
|
||||
case ScriptTarget.ES6: return LanguageVersion.EcmaScript6;
|
||||
default: throw Error("unsupported ScriptTarget value: " + scriptTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,6 +258,13 @@ module ts.SignatureHelp {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getChildListThatStartsWithOpenerToken(parent: Node, openerToken: Node, sourceFile: SourceFile): Node {
|
||||
var children = parent.getChildren(sourceFile);
|
||||
var indexOfOpenerToken = children.indexOf(openerToken);
|
||||
Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1);
|
||||
return children[indexOfOpenerToken + 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* The selectedItemIndex could be negative for several reasons.
|
||||
* 1. There are too many arguments for all of the overloads
|
||||
@ -287,74 +294,51 @@ module ts.SignatureHelp {
|
||||
|
||||
function createSignatureHelpItems(candidates: Signature[], bestSignature: Signature, argumentInfoOrTypeArgumentInfo: ListItemInfo): SignatureHelpItems {
|
||||
var argumentListOrTypeArgumentList = argumentInfoOrTypeArgumentInfo.list;
|
||||
var parent = <CallExpression>argumentListOrTypeArgumentList.parent;
|
||||
var isTypeParameterHelp = parent.typeArguments && parent.typeArguments.pos === argumentListOrTypeArgumentList.pos;
|
||||
Debug.assert(isTypeParameterHelp || parent.arguments.pos === argumentListOrTypeArgumentList.pos);
|
||||
|
||||
var callTargetNode = (<CallExpression>argumentListOrTypeArgumentList.parent).func;
|
||||
var callTargetSymbol = typeInfoResolver.getSymbolInfo(callTargetNode);
|
||||
var callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined);
|
||||
var items: SignatureHelpItem[] = map(candidates, candidateSignature => {
|
||||
var parameters = candidateSignature.parameters;
|
||||
var parameterHelpItems: SignatureHelpParameter[] = parameters.length === 0 ? emptyArray : map(parameters, p => {
|
||||
var displayParts: SymbolDisplayPart[] = [];
|
||||
var signatureHelpParameters: SignatureHelpParameter[];
|
||||
var prefixParts: SymbolDisplayPart[] = [];
|
||||
var suffixParts: SymbolDisplayPart[] = [];
|
||||
|
||||
if (candidateSignature.hasRestParameter && parameters[parameters.length - 1] === p) {
|
||||
displayParts.push(punctuationPart(SyntaxKind.DotDotDotToken));
|
||||
}
|
||||
|
||||
displayParts.push(symbolPart(p.name, p));
|
||||
|
||||
var isOptional = !!(p.valueDeclaration.flags & NodeFlags.QuestionMark);
|
||||
if (isOptional) {
|
||||
displayParts.push(punctuationPart(SyntaxKind.QuestionToken));
|
||||
}
|
||||
|
||||
displayParts.push(punctuationPart(SyntaxKind.ColonToken));
|
||||
displayParts.push(spacePart());
|
||||
|
||||
var typeParts = typeToDisplayParts(typeInfoResolver, typeInfoResolver.getTypeOfSymbol(p), argumentListOrTypeArgumentList);
|
||||
displayParts.push.apply(displayParts, typeParts);
|
||||
|
||||
return {
|
||||
name: p.name,
|
||||
documentation: p.getDocumentationComment(),
|
||||
displayParts: displayParts,
|
||||
isOptional: isOptional
|
||||
};
|
||||
});
|
||||
|
||||
var callTargetNode = (<CallExpression>argumentListOrTypeArgumentList.parent).func;
|
||||
var callTargetSymbol = typeInfoResolver.getSymbolInfo(callTargetNode);
|
||||
|
||||
var prefixParts = callTargetSymbol ? symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined) : [];
|
||||
|
||||
var separatorParts = [punctuationPart(SyntaxKind.CommaToken), spacePart()];
|
||||
|
||||
// TODO(jfreeman): Constraints?
|
||||
if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
|
||||
prefixParts.push(punctuationPart(SyntaxKind.LessThanToken));
|
||||
|
||||
for (var i = 0, n = candidateSignature.typeParameters.length; i < n; i++) {
|
||||
if (i) {
|
||||
prefixParts.push.apply(prefixParts, separatorParts);
|
||||
}
|
||||
|
||||
var tp = candidateSignature.typeParameters[i].symbol;
|
||||
prefixParts.push(symbolPart(tp.name, tp));
|
||||
}
|
||||
|
||||
prefixParts.push(punctuationPart(SyntaxKind.GreaterThanToken));
|
||||
if (callTargetDisplayParts) {
|
||||
prefixParts.push.apply(prefixParts, callTargetDisplayParts);
|
||||
}
|
||||
|
||||
prefixParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
if (isTypeParameterHelp) {
|
||||
prefixParts.push(punctuationPart(SyntaxKind.LessThanToken));
|
||||
var typeParameters = candidateSignature.typeParameters;
|
||||
signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
|
||||
suffixParts.push(punctuationPart(SyntaxKind.GreaterThanToken));
|
||||
var parameterParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, argumentListOrTypeArgumentList));
|
||||
suffixParts.push.apply(suffixParts, parameterParts);
|
||||
}
|
||||
else {
|
||||
var typeParameterParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, argumentListOrTypeArgumentList));
|
||||
prefixParts.push.apply(prefixParts, typeParameterParts);
|
||||
prefixParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
var parameters = candidateSignature.parameters;
|
||||
signatureHelpParameters = parameters.length > 0 ? map(parameters, createSignatureHelpParameterForParameter) : emptyArray;
|
||||
suffixParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
}
|
||||
|
||||
var suffixParts = [punctuationPart(SyntaxKind.CloseParenToken)];
|
||||
suffixParts.push(punctuationPart(SyntaxKind.ColonToken));
|
||||
suffixParts.push(spacePart());
|
||||
|
||||
var typeParts = typeToDisplayParts(typeInfoResolver, candidateSignature.getReturnType(), argumentListOrTypeArgumentList);
|
||||
suffixParts.push.apply(suffixParts, typeParts);
|
||||
var returnTypeParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, argumentListOrTypeArgumentList));
|
||||
suffixParts.push.apply(suffixParts, returnTypeParts);
|
||||
|
||||
return {
|
||||
isVariadic: candidateSignature.hasRestParameter,
|
||||
prefixDisplayParts: prefixParts,
|
||||
suffixDisplayParts: suffixParts,
|
||||
separatorDisplayParts: separatorParts,
|
||||
parameters: parameterHelpItems,
|
||||
separatorDisplayParts: [punctuationPart(SyntaxKind.CommaToken), spacePart()],
|
||||
parameters: signatureHelpParameters,
|
||||
documentation: candidateSignature.getDocumentationComment()
|
||||
};
|
||||
});
|
||||
@ -400,12 +384,32 @@ module ts.SignatureHelp {
|
||||
argumentIndex: argumentIndex,
|
||||
argumentCount: argumentCount
|
||||
};
|
||||
|
||||
function createSignatureHelpParameterForParameter(parameter: Symbol): SignatureHelpParameter {
|
||||
var displayParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, argumentListOrTypeArgumentList));
|
||||
|
||||
var isOptional = !!(parameter.valueDeclaration.flags & NodeFlags.QuestionMark);
|
||||
|
||||
return {
|
||||
name: parameter.name,
|
||||
documentation: parameter.getDocumentationComment(),
|
||||
displayParts: displayParts,
|
||||
isOptional: isOptional
|
||||
};
|
||||
}
|
||||
|
||||
function createSignatureHelpParameterForTypeParameter(typeParameter: TypeParameter): SignatureHelpParameter {
|
||||
var displayParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, argumentListOrTypeArgumentList));
|
||||
|
||||
return {
|
||||
name: typeParameter.symbol.name,
|
||||
documentation: emptyArray,
|
||||
displayParts: displayParts,
|
||||
isOptional: false
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getChildListThatStartsWithOpenerToken(parent: Node, openerToken: Node, sourceFile: SourceFile): Node {
|
||||
var children = parent.getChildren(sourceFile);
|
||||
var indexOfOpenerToken = children.indexOf(openerToken);
|
||||
return children[indexOfOpenerToken + 1];
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ module TypeScript.Scanner {
|
||||
var lastTokenInfo = { leadingTriviaWidth: -1, width: -1 };
|
||||
var lastTokenInfoTokenID: number = -1;
|
||||
|
||||
var triviaScanner = createScannerInternal(ts.ScriptTarget.ES5, SimpleText.fromString(""), () => { });
|
||||
var triviaScanner = createScannerInternal(ts.ScriptTarget.Latest, SimpleText.fromString(""), () => { });
|
||||
|
||||
interface IScannerToken extends ISyntaxToken {
|
||||
}
|
||||
|
||||
@ -84,7 +84,6 @@ module TypeScript {
|
||||
private cacheSyntaxTreeInfo(): void {
|
||||
// If we're not keeping around the syntax tree, store the diagnostics and line
|
||||
// map so they don't have to be recomputed.
|
||||
var sourceUnit = this.sourceUnit();
|
||||
var firstToken = firstSyntaxTreeToken(this);
|
||||
var leadingTrivia = firstToken.leadingTrivia(this.text);
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ module TypeScript {
|
||||
if (languageVersion === ts.ScriptTarget.ES3) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierStart);
|
||||
}
|
||||
else if (languageVersion === ts.ScriptTarget.ES5) {
|
||||
else if (languageVersion >= ts.ScriptTarget.ES5) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierStart);
|
||||
}
|
||||
else {
|
||||
@ -96,7 +96,7 @@ module TypeScript {
|
||||
if (languageVersion === ts.ScriptTarget.ES3) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierPart);
|
||||
}
|
||||
else if (languageVersion === ts.ScriptTarget.ES5) {
|
||||
else if (languageVersion >= ts.ScriptTarget.ES5) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierPart);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -75,14 +75,14 @@ module ts {
|
||||
* position >= start and (position < end or (position === end && token is keyword or identifier))
|
||||
*/
|
||||
export function getTouchingWord(sourceFile: SourceFile, position: number): Node {
|
||||
return getTouchingToken(sourceFile, position, isWord);
|
||||
return getTouchingToken(sourceFile, position, n => isWord(n.kind));
|
||||
}
|
||||
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
* and (position < end or (position === end && token is keyword or identifier or numeric\string litera))
|
||||
*/
|
||||
export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node {
|
||||
return getTouchingToken(sourceFile, position, isPropertyName);
|
||||
return getTouchingToken(sourceFile, position, n => isPropertyName(n.kind));
|
||||
}
|
||||
|
||||
/** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
|
||||
@ -243,23 +243,35 @@ module ts {
|
||||
return n.kind !== SyntaxKind.SyntaxList || n.getChildCount() !== 0;
|
||||
}
|
||||
|
||||
export function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node> {
|
||||
if (node.kind === SyntaxKind.TypeReference || node.kind === SyntaxKind.CallExpression) {
|
||||
return (<CallExpression>node).typeArguments;
|
||||
}
|
||||
|
||||
if (isAnyFunction(node) || node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.InterfaceDeclaration) {
|
||||
return (<FunctionDeclaration>node).typeParameters;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function isToken(n: Node): boolean {
|
||||
return n.kind >= SyntaxKind.FirstToken && n.kind <= SyntaxKind.LastToken;
|
||||
}
|
||||
|
||||
function isWord(kind: SyntaxKind): boolean {
|
||||
return kind === SyntaxKind.Identifier || isKeyword(kind);
|
||||
}
|
||||
|
||||
function isPropertyName(kind: SyntaxKind): boolean {
|
||||
return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NumericLiteral || isWord(kind);
|
||||
}
|
||||
|
||||
export function isComment(kind: SyntaxKind): boolean {
|
||||
return kind === SyntaxKind.SingleLineCommentTrivia || kind === SyntaxKind.MultiLineCommentTrivia;
|
||||
}
|
||||
|
||||
function isKeyword(n: Node): boolean {
|
||||
return n.kind >= SyntaxKind.FirstKeyword && n.kind <= SyntaxKind.LastKeyword;
|
||||
}
|
||||
|
||||
function isWord(n: Node): boolean {
|
||||
return n.kind === SyntaxKind.Identifier || isKeyword(n);
|
||||
}
|
||||
|
||||
function isPropertyName(n: Node): boolean {
|
||||
return n.kind === SyntaxKind.StringLiteral || n.kind === SyntaxKind.NumericLiteral || isWord(n);
|
||||
export function isPunctuation(kind: SyntaxKind): boolean {
|
||||
return SyntaxKind.FirstPunctuation <= kind && kind <= SyntaxKind.LastPunctuation;
|
||||
}
|
||||
}
|
||||
@ -557,7 +557,7 @@ module NonEmptyTypes {
|
||||
>x : string
|
||||
>y : base
|
||||
>base : base
|
||||
>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : Array<{ x: undefined; y: base; } | { x: string; y: derived; }>
|
||||
>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : ({ x: undefined; y: base; } | { x: string; y: derived; })[]
|
||||
>{ x: undefined, y: new base() } : { x: undefined; y: base; }
|
||||
>x : undefined
|
||||
>undefined : undefined
|
||||
|
||||
@ -40,7 +40,7 @@ function bar(animals: { [n: number]: IAnimal }) { }
|
||||
foo([
|
||||
>foo([ new Giraffe(), new Elephant()]) : void
|
||||
>foo : (animals: IAnimal[]) => void
|
||||
>[ new Giraffe(), new Elephant()] : Array<Giraffe | Elephant>
|
||||
>[ new Giraffe(), new Elephant()] : (Giraffe | Elephant)[]
|
||||
|
||||
new Giraffe(),
|
||||
>new Giraffe() : Giraffe
|
||||
@ -54,7 +54,7 @@ foo([
|
||||
bar([
|
||||
>bar([ new Giraffe(), new Elephant()]) : void
|
||||
>bar : (animals: { [x: number]: IAnimal; }) => void
|
||||
>[ new Giraffe(), new Elephant()] : Array<Giraffe | Elephant>
|
||||
>[ new Giraffe(), new Elephant()] : (Giraffe | Elephant)[]
|
||||
|
||||
new Giraffe(),
|
||||
>new Giraffe() : Giraffe
|
||||
@ -67,8 +67,8 @@ bar([
|
||||
]); // Legal because of the contextual type IAnimal provided by the parameter
|
||||
|
||||
var arr = [new Giraffe(), new Elephant()];
|
||||
>arr : Array<Giraffe | Elephant>
|
||||
>[new Giraffe(), new Elephant()] : Array<Giraffe | Elephant>
|
||||
>arr : (Giraffe | Elephant)[]
|
||||
>[new Giraffe(), new Elephant()] : (Giraffe | Elephant)[]
|
||||
>new Giraffe() : Giraffe
|
||||
>Giraffe : typeof Giraffe
|
||||
>new Elephant() : Elephant
|
||||
@ -77,10 +77,10 @@ var arr = [new Giraffe(), new Elephant()];
|
||||
foo(arr); // ok because arr is Array<Giraffe|Elephant> not {}[]
|
||||
>foo(arr) : void
|
||||
>foo : (animals: IAnimal[]) => void
|
||||
>arr : Array<Giraffe | Elephant>
|
||||
>arr : (Giraffe | Elephant)[]
|
||||
|
||||
bar(arr); // ok because arr is Array<Giraffe|Elephant> not {}[]
|
||||
>bar(arr) : void
|
||||
>bar : (animals: { [x: number]: IAnimal; }) => void
|
||||
>arr : Array<Giraffe | Elephant>
|
||||
>arr : (Giraffe | Elephant)[]
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class ActionB extends Action {
|
||||
var x1: Action[] = [
|
||||
>x1 : Action[]
|
||||
>Action : Action
|
||||
>[ { id: 2, trueness: false }, { id: 3, name: "three" }] : Array<{ id: number; trueness: boolean; } | { id: number; name: string; }>
|
||||
>[ { id: 2, trueness: false }, { id: 3, name: "three" }] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[]
|
||||
|
||||
{ id: 2, trueness: false },
|
||||
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
|
||||
@ -42,7 +42,7 @@ var x1: Action[] = [
|
||||
var x2: Action[] = [
|
||||
>x2 : Action[]
|
||||
>Action : Action
|
||||
>[ new ActionA(), new ActionB()] : Array<ActionA | ActionB>
|
||||
>[ new ActionA(), new ActionB()] : (ActionA | ActionB)[]
|
||||
|
||||
new ActionA(),
|
||||
>new ActionA() : ActionA
|
||||
@ -78,7 +78,7 @@ var z1: { id: number }[] =
|
||||
>id : number
|
||||
|
||||
[
|
||||
>[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : Array<{ id: number; trueness: boolean; } | { id: number; name: string; }>
|
||||
>[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[]
|
||||
|
||||
{ id: 2, trueness: false },
|
||||
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
|
||||
@ -97,7 +97,7 @@ var z2: { id: number }[] =
|
||||
>id : number
|
||||
|
||||
[
|
||||
>[ new ActionA(), new ActionB() ] : Array<ActionA | ActionB>
|
||||
>[ new ActionA(), new ActionB() ] : (ActionA | ActionB)[]
|
||||
|
||||
new ActionA(),
|
||||
>new ActionA() : ActionA
|
||||
|
||||
@ -17,27 +17,27 @@ var c: { x: number; a?: number };
|
||||
>a : number
|
||||
|
||||
var as = [a, b]; // { x: number; y?: number };[]
|
||||
>as : { x: number; y?: number; }[]
|
||||
>[a, b] : { x: number; y?: number; }[]
|
||||
>as : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
||||
>[a, b] : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
||||
>a : { x: number; y?: number; }
|
||||
>b : { x: number; z?: number; }
|
||||
|
||||
var bs = [b, a]; // { x: number; z?: number };[]
|
||||
>bs : { x: number; y?: number; }[]
|
||||
>[b, a] : { x: number; y?: number; }[]
|
||||
>bs : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
||||
>[b, a] : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
||||
>b : { x: number; z?: number; }
|
||||
>a : { x: number; y?: number; }
|
||||
|
||||
var cs = [a, b, c]; // { x: number; y?: number };[]
|
||||
>cs : { x: number; y?: number; }[]
|
||||
>[a, b, c] : { x: number; y?: number; }[]
|
||||
>cs : ({ x: number; y?: number; } | { x: number; z?: number; } | { x: number; a?: number; })[]
|
||||
>[a, b, c] : ({ x: number; y?: number; } | { x: number; z?: number; } | { x: number; a?: number; })[]
|
||||
>a : { x: number; y?: number; }
|
||||
>b : { x: number; z?: number; }
|
||||
>c : { x: number; a?: number; }
|
||||
|
||||
var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[]
|
||||
>ds : { (x: Object): number; }[]
|
||||
>[(x: Object) => 1, (x: string) => 2] : { (x: Object): number; }[]
|
||||
>ds : ((x: Object) => number)[]
|
||||
>[(x: Object) => 1, (x: string) => 2] : ((x: Object) => number)[]
|
||||
>(x: Object) => 1 : (x: Object) => number
|
||||
>x : Object
|
||||
>Object : Object
|
||||
@ -45,8 +45,8 @@ var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[]
|
||||
>x : string
|
||||
|
||||
var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[]
|
||||
>es : { (x: string): number; }[]
|
||||
>[(x: string) => 2, (x: Object) => 1] : { (x: string): number; }[]
|
||||
>es : ((x: string) => number)[]
|
||||
>[(x: string) => 2, (x: Object) => 1] : ((x: string) => number)[]
|
||||
>(x: string) => 2 : (x: string) => number
|
||||
>x : string
|
||||
>(x: Object) => 1 : (x: Object) => number
|
||||
@ -54,8 +54,8 @@ var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[]
|
||||
>Object : Object
|
||||
|
||||
var fs = [(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2]; // (a: { x: number; y?: number }) => number[]
|
||||
>fs : { (a: { x: number; y?: number; }): number; }[]
|
||||
>[(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2] : { (a: { x: number; y?: number; }): number; }[]
|
||||
>fs : (((a: { x: number; y?: number; }) => number) | ((b: { x: number; z?: number; }) => number))[]
|
||||
>[(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2] : (((a: { x: number; y?: number; }) => number) | ((b: { x: number; z?: number; }) => number))[]
|
||||
>(a: { x: number; y?: number }) => 1 : (a: { x: number; y?: number; }) => number
|
||||
>a : { x: number; y?: number; }
|
||||
>x : number
|
||||
@ -66,8 +66,8 @@ var fs = [(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) =>
|
||||
>z : number
|
||||
|
||||
var gs = [(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1]; // (b: { x: number; z?: number }) => number[]
|
||||
>gs : { (b: { x: number; z?: number; }): number; }[]
|
||||
>[(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1] : { (b: { x: number; z?: number; }): number; }[]
|
||||
>gs : (((b: { x: number; z?: number; }) => number) | ((a: { x: number; y?: number; }) => number))[]
|
||||
>[(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1] : (((b: { x: number; z?: number; }) => number) | ((a: { x: number; y?: number; }) => number))[]
|
||||
>(b: { x: number; z?: number }) => 2 : (b: { x: number; z?: number; }) => number
|
||||
>b : { x: number; z?: number; }
|
||||
>x : number
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
// Empty array literal with no contextual type has type Undefined[]
|
||||
|
||||
var arr1= [[], [1], ['']];
|
||||
>arr1 : Array<string[] | number[]>
|
||||
>[[], [1], ['']] : Array<string[] | number[]>
|
||||
>arr1 : (string[] | number[])[]
|
||||
>[[], [1], ['']] : (string[] | number[])[]
|
||||
>[] : undefined[]
|
||||
>[1] : number[]
|
||||
>[''] : string[]
|
||||
|
||||
var arr2 = [[null], [1], ['']];
|
||||
>arr2 : Array<string[] | number[]>
|
||||
>[[null], [1], ['']] : Array<string[] | number[]>
|
||||
>arr2 : (string[] | number[])[]
|
||||
>[[null], [1], ['']] : (string[] | number[])[]
|
||||
>[null] : null[]
|
||||
>[1] : number[]
|
||||
>[''] : string[]
|
||||
@ -65,7 +65,7 @@ var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '
|
||||
>n : number
|
||||
>a : string
|
||||
>b : number
|
||||
>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : Array<{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }>
|
||||
>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]
|
||||
>{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; }
|
||||
>a : string
|
||||
>b : number
|
||||
@ -76,8 +76,8 @@ var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '
|
||||
>c : number
|
||||
|
||||
var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }];
|
||||
>context2 : Array<{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }>
|
||||
>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : Array<{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }>
|
||||
>context2 : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]
|
||||
>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]
|
||||
>{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; }
|
||||
>a : string
|
||||
>b : number
|
||||
@ -105,7 +105,7 @@ class Derived2 extends Base { private n };
|
||||
var context3: Base[] = [new Derived1(), new Derived2()];
|
||||
>context3 : Base[]
|
||||
>Base : Base
|
||||
>[new Derived1(), new Derived2()] : Array<Derived1 | Derived2>
|
||||
>[new Derived1(), new Derived2()] : (Derived1 | Derived2)[]
|
||||
>new Derived1() : Derived1
|
||||
>Derived1 : typeof Derived1
|
||||
>new Derived2() : Derived2
|
||||
|
||||
@ -61,8 +61,8 @@ var xs = [list, myList]; // {}[]
|
||||
>myList : MyList<number>
|
||||
|
||||
var ys = [list, list2]; // {}[]
|
||||
>ys : Array<List<number> | List<string>>
|
||||
>[list, list2] : Array<List<number> | List<string>>
|
||||
>ys : (List<number> | List<string>)[]
|
||||
>[list, list2] : (List<number> | List<string>)[]
|
||||
>list : List<number>
|
||||
>list2 : List<string>
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// valid uses of arrays of function types
|
||||
|
||||
var x = [() => 1, () => { }];
|
||||
>x : { (): void; }[]
|
||||
>[() => 1, () => { }] : { (): void; }[]
|
||||
>x : (() => void)[]
|
||||
>[() => 1, () => { }] : (() => void)[]
|
||||
>() => 1 : () => number
|
||||
>() => { } : () => void
|
||||
|
||||
@ -11,7 +11,7 @@ var r2 = x[0]();
|
||||
>r2 : void
|
||||
>x[0]() : void
|
||||
>x[0] : () => void
|
||||
>x : { (): void; }[]
|
||||
>x : (() => void)[]
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@ -48,14 +48,14 @@ var r3 = true ? 1 : {};
|
||||
>{} : {}
|
||||
|
||||
var r4 = true ? a : b; // typeof a
|
||||
>r4 : { x: number; y?: number; }
|
||||
>true ? a : b : { x: number; y?: number; }
|
||||
>r4 : { x: number; y?: number; } | { x: number; z?: number; }
|
||||
>true ? a : b : { x: number; y?: number; } | { x: number; z?: number; }
|
||||
>a : { x: number; y?: number; }
|
||||
>b : { x: number; z?: number; }
|
||||
|
||||
var r5 = true ? b : a; // typeof b
|
||||
>r5 : { x: number; y?: number; }
|
||||
>true ? b : a : { x: number; y?: number; }
|
||||
>r5 : { x: number; y?: number; } | { x: number; z?: number; }
|
||||
>true ? b : a : { x: number; y?: number; } | { x: number; z?: number; }
|
||||
>b : { x: number; z?: number; }
|
||||
>a : { x: number; y?: number; }
|
||||
|
||||
|
||||
@ -75,8 +75,8 @@ t4 = [E1.one, E2.two, 20];
|
||||
>two : E2
|
||||
|
||||
var e1 = t1[2]; // {}
|
||||
>e1 : { (x: number): string; } | { (x: number): number; }
|
||||
>t1[2] : { (x: number): string; } | { (x: number): number; }
|
||||
>e1 : ((x: number) => string) | ((x: number) => number)
|
||||
>t1[2] : ((x: number) => string) | ((x: number) => number)
|
||||
>t1 : [(x: number) => string, (x: number) => number]
|
||||
|
||||
var e2 = t2[2]; // {}
|
||||
|
||||
@ -0,0 +1,198 @@
|
||||
|
||||
1 >var a = [10, 20, 30];
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 21) SpanInfo: {"start":0,"length":20}
|
||||
>var a = [10, 20, 30]
|
||||
>:=> (line 1, col 0) to (line 1, col 20)
|
||||
--------------------------------
|
||||
2 >function foo(a: number) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (22 to 47) SpanInfo: {"start":52,"length":8}
|
||||
>return a
|
||||
>:=> (line 3, col 4) to (line 3, col 12)
|
||||
--------------------------------
|
||||
3 > return a;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (48 to 61) SpanInfo: {"start":52,"length":8}
|
||||
>return a
|
||||
>:=> (line 3, col 4) to (line 3, col 12)
|
||||
--------------------------------
|
||||
4 >}
|
||||
|
||||
~~ => Pos: (62 to 63) SpanInfo: {"start":62,"length":1}
|
||||
>}
|
||||
>:=> (line 4, col 0) to (line 4, col 1)
|
||||
--------------------------------
|
||||
5 >a = [foo(30), (function () {
|
||||
|
||||
~~~~~ => Pos: (64 to 68) SpanInfo: {"start":64,"length":49}
|
||||
>a = [foo(30), (function () {
|
||||
> return 30;
|
||||
>})()]
|
||||
>:=> (line 5, col 0) to (line 7, col 5)
|
||||
5 >a = [foo(30), (function () {
|
||||
|
||||
~~~~~~~~ => Pos: (69 to 76) SpanInfo: {"start":69,"length":7}
|
||||
>foo(30)
|
||||
>:=> (line 5, col 5) to (line 5, col 12)
|
||||
5 >a = [foo(30), (function () {
|
||||
|
||||
~~ => Pos: (77 to 78) SpanInfo: {"start":78,"length":34}
|
||||
>(function () {
|
||||
> return 30;
|
||||
>})()
|
||||
>:=> (line 5, col 14) to (line 7, col 4)
|
||||
5 >a = [foo(30), (function () {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (79 to 92) SpanInfo: {"start":97,"length":9}
|
||||
>return 30
|
||||
>:=> (line 6, col 4) to (line 6, col 13)
|
||||
--------------------------------
|
||||
6 > return 30;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (93 to 107) SpanInfo: {"start":97,"length":9}
|
||||
>return 30
|
||||
>:=> (line 6, col 4) to (line 6, col 13)
|
||||
--------------------------------
|
||||
7 >})()];
|
||||
|
||||
~ => Pos: (108 to 108) SpanInfo: {"start":108,"length":1}
|
||||
>}
|
||||
>:=> (line 7, col 0) to (line 7, col 1)
|
||||
7 >})()];
|
||||
|
||||
~~~ => Pos: (109 to 111) SpanInfo: {"start":78,"length":34}
|
||||
>(function () {
|
||||
> return 30;
|
||||
>})()
|
||||
>:=> (line 5, col 14) to (line 7, col 4)
|
||||
7 >})()];
|
||||
|
||||
~~~ => Pos: (112 to 114) SpanInfo: {"start":64,"length":49}
|
||||
>a = [foo(30), (function () {
|
||||
> return 30;
|
||||
>})()]
|
||||
>:=> (line 5, col 0) to (line 7, col 5)
|
||||
--------------------------------
|
||||
8 >function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (115 to 131) SpanInfo: {"start":136,"length":8}
|
||||
>return a
|
||||
>:=> (line 9, col 4) to (line 9, col 12)
|
||||
--------------------------------
|
||||
9 > return a;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (132 to 145) SpanInfo: {"start":136,"length":8}
|
||||
>return a
|
||||
>:=> (line 9, col 4) to (line 9, col 12)
|
||||
--------------------------------
|
||||
10 >}
|
||||
|
||||
~~ => Pos: (146 to 147) SpanInfo: {"start":146,"length":1}
|
||||
>}
|
||||
>:=> (line 10, col 0) to (line 10, col 1)
|
||||
--------------------------------
|
||||
11 >var x = bar()[0];
|
||||
|
||||
~~~~~~~ => Pos: (148 to 154) SpanInfo: {"start":148,"length":16}
|
||||
>var x = bar()[0]
|
||||
>:=> (line 11, col 0) to (line 11, col 16)
|
||||
11 >var x = bar()[0];
|
||||
|
||||
~~~~~~ => Pos: (155 to 160) SpanInfo: {"start":156,"length":5}
|
||||
>bar()
|
||||
>:=> (line 11, col 8) to (line 11, col 13)
|
||||
11 >var x = bar()[0];
|
||||
|
||||
~~~~~ => Pos: (161 to 165) SpanInfo: {"start":148,"length":16}
|
||||
>var x = bar()[0]
|
||||
>:=> (line 11, col 0) to (line 11, col 16)
|
||||
--------------------------------
|
||||
12 >x = (function () {
|
||||
|
||||
~~~ => Pos: (166 to 168) SpanInfo: {"start":166,"length":40}
|
||||
>x = (function () {
|
||||
> return a;
|
||||
>})()[x]
|
||||
>:=> (line 12, col 0) to (line 14, col 7)
|
||||
12 >x = (function () {
|
||||
|
||||
~~ => Pos: (169 to 170) SpanInfo: {"start":170,"length":33}
|
||||
>(function () {
|
||||
> return a;
|
||||
>})()
|
||||
>:=> (line 12, col 4) to (line 14, col 4)
|
||||
12 >x = (function () {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (171 to 184) SpanInfo: {"start":189,"length":8}
|
||||
>return a
|
||||
>:=> (line 13, col 4) to (line 13, col 12)
|
||||
--------------------------------
|
||||
13 > return a;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (185 to 198) SpanInfo: {"start":189,"length":8}
|
||||
>return a
|
||||
>:=> (line 13, col 4) to (line 13, col 12)
|
||||
--------------------------------
|
||||
14 >})()[x];
|
||||
|
||||
~ => Pos: (199 to 199) SpanInfo: {"start":199,"length":1}
|
||||
>}
|
||||
>:=> (line 14, col 0) to (line 14, col 1)
|
||||
14 >})()[x];
|
||||
|
||||
~~~ => Pos: (200 to 202) SpanInfo: {"start":170,"length":33}
|
||||
>(function () {
|
||||
> return a;
|
||||
>})()
|
||||
>:=> (line 12, col 4) to (line 14, col 4)
|
||||
14 >})()[x];
|
||||
|
||||
~~~~~ => Pos: (203 to 207) SpanInfo: {"start":166,"length":40}
|
||||
>x = (function () {
|
||||
> return a;
|
||||
>})()[x]
|
||||
>:=> (line 12, col 0) to (line 14, col 7)
|
||||
--------------------------------
|
||||
15 >a[(function () {
|
||||
|
||||
~~ => Pos: (208 to 209) SpanInfo: {"start":208,"length":36}
|
||||
>a[(function () {
|
||||
> return x;
|
||||
>})()]
|
||||
>:=> (line 15, col 0) to (line 17, col 5)
|
||||
15 >a[(function () {
|
||||
|
||||
~ => Pos: (210 to 210) SpanInfo: {"start":210,"length":33}
|
||||
>(function () {
|
||||
> return x;
|
||||
>})()
|
||||
>:=> (line 15, col 2) to (line 17, col 4)
|
||||
15 >a[(function () {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (211 to 224) SpanInfo: {"start":229,"length":8}
|
||||
>return x
|
||||
>:=> (line 16, col 4) to (line 16, col 12)
|
||||
--------------------------------
|
||||
16 > return x;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (225 to 238) SpanInfo: {"start":229,"length":8}
|
||||
>return x
|
||||
>:=> (line 16, col 4) to (line 16, col 12)
|
||||
--------------------------------
|
||||
17 >})()];
|
||||
~ => Pos: (239 to 239) SpanInfo: {"start":239,"length":1}
|
||||
>}
|
||||
>:=> (line 17, col 0) to (line 17, col 1)
|
||||
17 >})()];
|
||||
~~~ => Pos: (240 to 242) SpanInfo: {"start":210,"length":33}
|
||||
>(function () {
|
||||
> return x;
|
||||
>})()
|
||||
>:=> (line 15, col 2) to (line 17, col 4)
|
||||
17 >})()];
|
||||
~~ => Pos: (243 to 244) SpanInfo: {"start":208,"length":36}
|
||||
>a[(function () {
|
||||
> return x;
|
||||
>})()]
|
||||
>:=> (line 15, col 0) to (line 17, col 5)
|
||||
119
tests/baselines/reference/bpSpan_binaryExpressions.baseline
Normal file
119
tests/baselines/reference/bpSpan_binaryExpressions.baseline
Normal file
@ -0,0 +1,119 @@
|
||||
|
||||
1 >var x = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >var y = 20;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (12 to 23) SpanInfo: {"start":12,"length":10}
|
||||
>var y = 20
|
||||
>:=> (line 2, col 0) to (line 2, col 10)
|
||||
--------------------------------
|
||||
3 >x += 30;
|
||||
|
||||
~~~~~~~~~ => Pos: (24 to 32) SpanInfo: {"start":24,"length":7}
|
||||
>x += 30
|
||||
>:=> (line 3, col 0) to (line 3, col 7)
|
||||
--------------------------------
|
||||
4 >x *= 0;
|
||||
|
||||
~~~~~~~~ => Pos: (33 to 40) SpanInfo: {"start":33,"length":6}
|
||||
>x *= 0
|
||||
>:=> (line 4, col 0) to (line 4, col 6)
|
||||
--------------------------------
|
||||
5 >x = x + 1;
|
||||
|
||||
~~~~~~~~~~~ => Pos: (41 to 51) SpanInfo: {"start":41,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 5, col 0) to (line 5, col 9)
|
||||
--------------------------------
|
||||
6 >x = (function foo() {
|
||||
|
||||
~~~ => Pos: (52 to 54) SpanInfo: {"start":52,"length":44}
|
||||
>x = (function foo() {
|
||||
> return y;
|
||||
>})() + y
|
||||
>:=> (line 6, col 0) to (line 8, col 8)
|
||||
6 >x = (function foo() {
|
||||
|
||||
~~ => Pos: (55 to 56) SpanInfo: {"start":56,"length":36}
|
||||
>(function foo() {
|
||||
> return y;
|
||||
>})()
|
||||
>:=> (line 6, col 4) to (line 8, col 4)
|
||||
6 >x = (function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (57 to 73) SpanInfo: {"start":78,"length":8}
|
||||
>return y
|
||||
>:=> (line 7, col 4) to (line 7, col 12)
|
||||
--------------------------------
|
||||
7 > return y;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (74 to 87) SpanInfo: {"start":78,"length":8}
|
||||
>return y
|
||||
>:=> (line 7, col 4) to (line 7, col 12)
|
||||
--------------------------------
|
||||
8 >})() + y;
|
||||
|
||||
~ => Pos: (88 to 88) SpanInfo: {"start":88,"length":1}
|
||||
>}
|
||||
>:=> (line 8, col 0) to (line 8, col 1)
|
||||
8 >})() + y;
|
||||
|
||||
~~~ => Pos: (89 to 91) SpanInfo: {"start":56,"length":36}
|
||||
>(function foo() {
|
||||
> return y;
|
||||
>})()
|
||||
>:=> (line 6, col 4) to (line 8, col 4)
|
||||
8 >})() + y;
|
||||
|
||||
~~~~~~ => Pos: (92 to 97) SpanInfo: {"start":52,"length":44}
|
||||
>x = (function foo() {
|
||||
> return y;
|
||||
>})() + y
|
||||
>:=> (line 6, col 0) to (line 8, col 8)
|
||||
--------------------------------
|
||||
9 >x = y + 30 + (function foo() {
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (98 to 109) SpanInfo: {"start":98,"length":54}
|
||||
>x = y + 30 + (function foo() {
|
||||
> return y;
|
||||
>})() * 40
|
||||
>:=> (line 9, col 0) to (line 11, col 9)
|
||||
9 >x = y + 30 + (function foo() {
|
||||
|
||||
~~ => Pos: (110 to 111) SpanInfo: {"start":111,"length":36}
|
||||
>(function foo() {
|
||||
> return y;
|
||||
>})()
|
||||
>:=> (line 9, col 13) to (line 11, col 4)
|
||||
9 >x = y + 30 + (function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (112 to 128) SpanInfo: {"start":133,"length":8}
|
||||
>return y
|
||||
>:=> (line 10, col 4) to (line 10, col 12)
|
||||
--------------------------------
|
||||
10 > return y;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (129 to 142) SpanInfo: {"start":133,"length":8}
|
||||
>return y
|
||||
>:=> (line 10, col 4) to (line 10, col 12)
|
||||
--------------------------------
|
||||
11 >})() * 40;
|
||||
~ => Pos: (143 to 143) SpanInfo: {"start":143,"length":1}
|
||||
>}
|
||||
>:=> (line 11, col 0) to (line 11, col 1)
|
||||
11 >})() * 40;
|
||||
~~~ => Pos: (144 to 146) SpanInfo: {"start":111,"length":36}
|
||||
>(function foo() {
|
||||
> return y;
|
||||
>})()
|
||||
>:=> (line 9, col 13) to (line 11, col 4)
|
||||
11 >})() * 40;
|
||||
~~~~~~ => Pos: (147 to 152) SpanInfo: {"start":98,"length":54}
|
||||
>x = y + 30 + (function foo() {
|
||||
> return y;
|
||||
>})() * 40
|
||||
>:=> (line 9, col 0) to (line 11, col 9)
|
||||
71
tests/baselines/reference/bpSpan_breakOrContinue.baseline
Normal file
71
tests/baselines/reference/bpSpan_breakOrContinue.baseline
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
1 >while (true) {
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (0 to 14) SpanInfo: {"start":0,"length":12}
|
||||
>while (true)
|
||||
>:=> (line 1, col 0) to (line 1, col 12)
|
||||
--------------------------------
|
||||
2 > break;
|
||||
|
||||
~~~~~~~~~~~ => Pos: (15 to 25) SpanInfo: {"start":19,"length":5}
|
||||
>break
|
||||
>:=> (line 2, col 4) to (line 2, col 9)
|
||||
--------------------------------
|
||||
3 >}
|
||||
|
||||
~~ => Pos: (26 to 27) SpanInfo: {"start":19,"length":5}
|
||||
>break
|
||||
>:=> (line 2, col 4) to (line 2, col 9)
|
||||
--------------------------------
|
||||
4 >y: while (true) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (28 to 45) SpanInfo: {"start":31,"length":12}
|
||||
>while (true)
|
||||
>:=> (line 4, col 3) to (line 4, col 15)
|
||||
--------------------------------
|
||||
5 > break y;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (46 to 58) SpanInfo: {"start":50,"length":7}
|
||||
>break y
|
||||
>:=> (line 5, col 4) to (line 5, col 11)
|
||||
--------------------------------
|
||||
6 >}
|
||||
|
||||
~~ => Pos: (59 to 60) SpanInfo: {"start":50,"length":7}
|
||||
>break y
|
||||
>:=> (line 5, col 4) to (line 5, col 11)
|
||||
--------------------------------
|
||||
7 >while (true) {
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (61 to 75) SpanInfo: {"start":61,"length":12}
|
||||
>while (true)
|
||||
>:=> (line 7, col 0) to (line 7, col 12)
|
||||
--------------------------------
|
||||
8 > continue;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (76 to 89) SpanInfo: {"start":80,"length":8}
|
||||
>continue
|
||||
>:=> (line 8, col 4) to (line 8, col 12)
|
||||
--------------------------------
|
||||
9 >}
|
||||
|
||||
~~ => Pos: (90 to 91) SpanInfo: {"start":80,"length":8}
|
||||
>continue
|
||||
>:=> (line 8, col 4) to (line 8, col 12)
|
||||
--------------------------------
|
||||
10 >z: while (true) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (92 to 109) SpanInfo: {"start":95,"length":12}
|
||||
>while (true)
|
||||
>:=> (line 10, col 3) to (line 10, col 15)
|
||||
--------------------------------
|
||||
11 > continue z;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (110 to 125) SpanInfo: {"start":114,"length":10}
|
||||
>continue z
|
||||
>:=> (line 11, col 4) to (line 11, col 14)
|
||||
--------------------------------
|
||||
12 >}
|
||||
~ => Pos: (126 to 126) SpanInfo: {"start":114,"length":10}
|
||||
>continue z
|
||||
>:=> (line 11, col 4) to (line 11, col 14)
|
||||
365
tests/baselines/reference/bpSpan_class.baseline
Normal file
365
tests/baselines/reference/bpSpan_class.baseline
Normal file
@ -0,0 +1,365 @@
|
||||
|
||||
1 >class Greeter {
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (0 to 15) SpanInfo: {"start":0,"length":396}
|
||||
>class Greeter {
|
||||
> constructor(public greeting: string, ...b: string[]) {
|
||||
> }
|
||||
> greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
> private x: string;
|
||||
> private x1: number = 10;
|
||||
> private fn() {
|
||||
> return this.greeting;
|
||||
> }
|
||||
> get greetings() {
|
||||
> return this.greeting;
|
||||
> }
|
||||
> set greetings(greetings: string) {
|
||||
> this.greeting = greetings;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 18, col 1)
|
||||
--------------------------------
|
||||
2 > constructor(public greeting: string, ...b: string[]) {
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (16 to 31) SpanInfo: {"start":79,"length":1}
|
||||
>}
|
||||
>:=> (line 3, col 4) to (line 3, col 5)
|
||||
2 > constructor(public greeting: string, ...b: string[]) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (32 to 55) SpanInfo: {"start":32,"length":23}
|
||||
>public greeting: string
|
||||
>:=> (line 2, col 16) to (line 2, col 39)
|
||||
2 > constructor(public greeting: string, ...b: string[]) {
|
||||
|
||||
~~~~~~~~~~~~~~~~=> Pos: (56 to 71) SpanInfo: {"start":57,"length":14}
|
||||
>...b: string[]
|
||||
>:=> (line 2, col 41) to (line 2, col 55)
|
||||
2 > constructor(public greeting: string, ...b: string[]) {
|
||||
|
||||
~~~=> Pos: (72 to 74) SpanInfo: {"start":79,"length":1}
|
||||
>}
|
||||
>:=> (line 3, col 4) to (line 3, col 5)
|
||||
--------------------------------
|
||||
3 > }
|
||||
|
||||
~~~~~~ => Pos: (75 to 80) SpanInfo: {"start":79,"length":1}
|
||||
>}
|
||||
>:=> (line 3, col 4) to (line 3, col 5)
|
||||
--------------------------------
|
||||
4 > greet() {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (81 to 94) SpanInfo: {"start":85,"length":64}
|
||||
>greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
>:=> (line 4, col 4) to (line 6, col 5)
|
||||
--------------------------------
|
||||
5 > return "<h1>" + this.greeting + "</h1>";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (95 to 143) SpanInfo: {"start":103,"length":39}
|
||||
>return "<h1>" + this.greeting + "</h1>"
|
||||
>:=> (line 5, col 8) to (line 5, col 47)
|
||||
--------------------------------
|
||||
6 > }
|
||||
|
||||
~~~~~~ => Pos: (144 to 149) SpanInfo: {"start":148,"length":1}
|
||||
>}
|
||||
>:=> (line 6, col 4) to (line 6, col 5)
|
||||
--------------------------------
|
||||
7 > private x: string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (150 to 172) SpanInfo: undefined
|
||||
--------------------------------
|
||||
8 > private x1: number = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (173 to 201) SpanInfo: {"start":177,"length":24}
|
||||
>private x1: number = 10;
|
||||
>:=> (line 8, col 4) to (line 8, col 28)
|
||||
--------------------------------
|
||||
9 > private fn() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (202 to 220) SpanInfo: {"start":206,"length":50}
|
||||
>private fn() {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>:=> (line 9, col 4) to (line 11, col 5)
|
||||
--------------------------------
|
||||
10 > return this.greeting;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (221 to 250) SpanInfo: {"start":229,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 10, col 8) to (line 10, col 28)
|
||||
--------------------------------
|
||||
11 > }
|
||||
|
||||
~~~~~~ => Pos: (251 to 256) SpanInfo: {"start":255,"length":1}
|
||||
>}
|
||||
>:=> (line 11, col 4) to (line 11, col 5)
|
||||
--------------------------------
|
||||
12 > get greetings() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (257 to 278) SpanInfo: {"start":261,"length":53}
|
||||
>get greetings() {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>:=> (line 12, col 4) to (line 14, col 5)
|
||||
--------------------------------
|
||||
13 > return this.greeting;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (279 to 308) SpanInfo: {"start":287,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 13, col 8) to (line 13, col 28)
|
||||
--------------------------------
|
||||
14 > }
|
||||
|
||||
~~~~~~ => Pos: (309 to 314) SpanInfo: {"start":313,"length":1}
|
||||
>}
|
||||
>:=> (line 14, col 4) to (line 14, col 5)
|
||||
--------------------------------
|
||||
15 > set greetings(greetings: string) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (315 to 353) SpanInfo: {"start":319,"length":75}
|
||||
>set greetings(greetings: string) {
|
||||
> this.greeting = greetings;
|
||||
> }
|
||||
>:=> (line 15, col 4) to (line 17, col 5)
|
||||
--------------------------------
|
||||
16 > this.greeting = greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (354 to 388) SpanInfo: {"start":362,"length":25}
|
||||
>this.greeting = greetings
|
||||
>:=> (line 16, col 8) to (line 16, col 33)
|
||||
--------------------------------
|
||||
17 > }
|
||||
|
||||
~~~~~~ => Pos: (389 to 394) SpanInfo: {"start":393,"length":1}
|
||||
>}
|
||||
>:=> (line 17, col 4) to (line 17, col 5)
|
||||
--------------------------------
|
||||
18 >}
|
||||
|
||||
~~ => Pos: (395 to 396) SpanInfo: {"start":395,"length":1}
|
||||
>}
|
||||
>:=> (line 18, col 0) to (line 18, col 1)
|
||||
--------------------------------
|
||||
19 >class Greeter2 {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (397 to 413) SpanInfo: {"start":397,"length":18}
|
||||
>class Greeter2 {
|
||||
>}
|
||||
>:=> (line 19, col 0) to (line 20, col 1)
|
||||
--------------------------------
|
||||
20 >}
|
||||
|
||||
~~ => Pos: (414 to 415) SpanInfo: {"start":414,"length":1}
|
||||
>}
|
||||
>:=> (line 20, col 0) to (line 20, col 1)
|
||||
--------------------------------
|
||||
21 >class Greeter1
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (416 to 431) SpanInfo: {"start":416,"length":419}
|
||||
>class Greeter1
|
||||
>{
|
||||
> constructor(public greeting: string, ...b: string[])
|
||||
> {
|
||||
> }
|
||||
> greet()
|
||||
> {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
> private x: string;
|
||||
> private x1: number = 10;
|
||||
> private fn()
|
||||
> {
|
||||
> return this.greeting;
|
||||
> }
|
||||
> get greetings()
|
||||
> {
|
||||
> return this.greeting;
|
||||
> }
|
||||
> set greetings(greetings: string)
|
||||
> {
|
||||
> this.greeting = greetings;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 21, col 0) to (line 44, col 1)
|
||||
--------------------------------
|
||||
22 >{
|
||||
|
||||
~~ => Pos: (432 to 433) SpanInfo: {"start":501,"length":1}
|
||||
>}
|
||||
>:=> (line 25, col 4) to (line 25, col 5)
|
||||
--------------------------------
|
||||
23 > constructor(public greeting: string, ...b: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (434 to 449) SpanInfo: {"start":501,"length":1}
|
||||
>}
|
||||
>:=> (line 25, col 4) to (line 25, col 5)
|
||||
23 > constructor(public greeting: string, ...b: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (450 to 473) SpanInfo: {"start":450,"length":23}
|
||||
>public greeting: string
|
||||
>:=> (line 23, col 16) to (line 23, col 39)
|
||||
23 > constructor(public greeting: string, ...b: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~=> Pos: (474 to 490) SpanInfo: {"start":475,"length":14}
|
||||
>...b: string[]
|
||||
>:=> (line 23, col 41) to (line 23, col 55)
|
||||
--------------------------------
|
||||
24 > {
|
||||
|
||||
~~~~~~ => Pos: (491 to 496) SpanInfo: {"start":501,"length":1}
|
||||
>}
|
||||
>:=> (line 25, col 4) to (line 25, col 5)
|
||||
--------------------------------
|
||||
25 > }
|
||||
|
||||
~~~~~~ => Pos: (497 to 502) SpanInfo: {"start":501,"length":1}
|
||||
>}
|
||||
>:=> (line 25, col 4) to (line 25, col 5)
|
||||
--------------------------------
|
||||
26 > greet()
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (503 to 514) SpanInfo: {"start":507,"length":68}
|
||||
>greet()
|
||||
> {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
>:=> (line 26, col 4) to (line 29, col 5)
|
||||
--------------------------------
|
||||
27 > {
|
||||
|
||||
~~~~~~ => Pos: (515 to 520) SpanInfo: {"start":529,"length":39}
|
||||
>return "<h1>" + this.greeting + "</h1>"
|
||||
>:=> (line 28, col 8) to (line 28, col 47)
|
||||
--------------------------------
|
||||
28 > return "<h1>" + this.greeting + "</h1>";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (521 to 569) SpanInfo: {"start":529,"length":39}
|
||||
>return "<h1>" + this.greeting + "</h1>"
|
||||
>:=> (line 28, col 8) to (line 28, col 47)
|
||||
--------------------------------
|
||||
29 > }
|
||||
|
||||
~~~~~~ => Pos: (570 to 575) SpanInfo: {"start":574,"length":1}
|
||||
>}
|
||||
>:=> (line 29, col 4) to (line 29, col 5)
|
||||
--------------------------------
|
||||
30 > private x: string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (576 to 598) SpanInfo: undefined
|
||||
--------------------------------
|
||||
31 > private x1: number = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (599 to 627) SpanInfo: {"start":603,"length":24}
|
||||
>private x1: number = 10;
|
||||
>:=> (line 31, col 4) to (line 31, col 28)
|
||||
--------------------------------
|
||||
32 > private fn()
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (628 to 644) SpanInfo: {"start":632,"length":54}
|
||||
>private fn()
|
||||
> {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>:=> (line 32, col 4) to (line 35, col 5)
|
||||
--------------------------------
|
||||
33 > {
|
||||
|
||||
~~~~~~ => Pos: (645 to 650) SpanInfo: {"start":659,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 34, col 8) to (line 34, col 28)
|
||||
--------------------------------
|
||||
34 > return this.greeting;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (651 to 680) SpanInfo: {"start":659,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 34, col 8) to (line 34, col 28)
|
||||
--------------------------------
|
||||
35 > }
|
||||
|
||||
~~~~~~ => Pos: (681 to 686) SpanInfo: {"start":685,"length":1}
|
||||
>}
|
||||
>:=> (line 35, col 4) to (line 35, col 5)
|
||||
--------------------------------
|
||||
36 > get greetings()
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (687 to 707) SpanInfo: {"start":691,"length":58}
|
||||
>get greetings()
|
||||
> {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>:=> (line 36, col 4) to (line 39, col 5)
|
||||
--------------------------------
|
||||
37 > {
|
||||
|
||||
~~~~~~ => Pos: (708 to 713) SpanInfo: {"start":722,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 38, col 8) to (line 38, col 28)
|
||||
--------------------------------
|
||||
38 > return this.greeting;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (714 to 743) SpanInfo: {"start":722,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 38, col 8) to (line 38, col 28)
|
||||
--------------------------------
|
||||
39 > }
|
||||
|
||||
~~~~~~ => Pos: (744 to 749) SpanInfo: {"start":748,"length":1}
|
||||
>}
|
||||
>:=> (line 39, col 4) to (line 39, col 5)
|
||||
--------------------------------
|
||||
40 > set greetings(greetings: string)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (750 to 786) SpanInfo: {"start":754,"length":79}
|
||||
>set greetings(greetings: string)
|
||||
> {
|
||||
> this.greeting = greetings;
|
||||
> }
|
||||
>:=> (line 40, col 4) to (line 43, col 5)
|
||||
--------------------------------
|
||||
41 > {
|
||||
|
||||
~~~~~~ => Pos: (787 to 792) SpanInfo: {"start":801,"length":25}
|
||||
>this.greeting = greetings
|
||||
>:=> (line 42, col 8) to (line 42, col 33)
|
||||
--------------------------------
|
||||
42 > this.greeting = greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (793 to 827) SpanInfo: {"start":801,"length":25}
|
||||
>this.greeting = greetings
|
||||
>:=> (line 42, col 8) to (line 42, col 33)
|
||||
--------------------------------
|
||||
43 > }
|
||||
|
||||
~~~~~~ => Pos: (828 to 833) SpanInfo: {"start":832,"length":1}
|
||||
>}
|
||||
>:=> (line 43, col 4) to (line 43, col 5)
|
||||
--------------------------------
|
||||
44 >}
|
||||
|
||||
~~ => Pos: (834 to 835) SpanInfo: {"start":834,"length":1}
|
||||
>}
|
||||
>:=> (line 44, col 0) to (line 44, col 1)
|
||||
--------------------------------
|
||||
45 >class Greeter12
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (836 to 851) SpanInfo: {"start":836,"length":19}
|
||||
>class Greeter12
|
||||
>{
|
||||
>}
|
||||
>:=> (line 45, col 0) to (line 47, col 1)
|
||||
--------------------------------
|
||||
46 >{
|
||||
|
||||
~~ => Pos: (852 to 853) SpanInfo: {"start":854,"length":1}
|
||||
>}
|
||||
>:=> (line 47, col 0) to (line 47, col 1)
|
||||
--------------------------------
|
||||
47 >}
|
||||
~ => Pos: (854 to 854) SpanInfo: {"start":854,"length":1}
|
||||
>}
|
||||
>:=> (line 47, col 0) to (line 47, col 1)
|
||||
31
tests/baselines/reference/bpSpan_classAmbient.baseline
Normal file
31
tests/baselines/reference/bpSpan_classAmbient.baseline
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
1 >declare class Greeter {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 23) SpanInfo: undefined
|
||||
--------------------------------
|
||||
2 > public greeting: string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (24 to 52) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 > constructor(greeting: string, ...b: string[]);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (53 to 103) SpanInfo: undefined
|
||||
--------------------------------
|
||||
4 > greet(): string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (104 to 124) SpanInfo: undefined
|
||||
--------------------------------
|
||||
5 > private val;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (125 to 141) SpanInfo: undefined
|
||||
--------------------------------
|
||||
6 > static x: number;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 163) SpanInfo: undefined
|
||||
--------------------------------
|
||||
7 > static fn(a: number, ...b:string[]);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (164 to 204) SpanInfo: undefined
|
||||
--------------------------------
|
||||
8 >}
|
||||
~ => Pos: (205 to 205) SpanInfo: undefined
|
||||
356
tests/baselines/reference/bpSpan_classes.baseline
Normal file
356
tests/baselines/reference/bpSpan_classes.baseline
Normal file
@ -0,0 +1,356 @@
|
||||
|
||||
1 >module Foo.Bar {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: {"start":0,"length":881}
|
||||
>module Foo.Bar {
|
||||
> "use strict";
|
||||
>
|
||||
> class Greeter {
|
||||
> constructor(public greeting: string) {
|
||||
> }
|
||||
>
|
||||
> greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
> }
|
||||
>
|
||||
>
|
||||
> function foo(greeting: string): Greeter {
|
||||
> return new Greeter(greeting);
|
||||
> }
|
||||
>
|
||||
> var greeter = new Greeter("Hello, world!");
|
||||
> var str = greeter.greet();
|
||||
>
|
||||
> function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) {
|
||||
> var greeters: Greeter[] = []; /* inline block comment */
|
||||
> greeters[0] = new Greeter(greeting);
|
||||
> for (var i = 0; i < restGreetings.length; i++) {
|
||||
> greeters.push(new Greeter(restGreetings[i]));
|
||||
> }
|
||||
>
|
||||
> return greeters;
|
||||
> }
|
||||
>
|
||||
> var b = foo2("Hello", "World", "!");
|
||||
> // This is simple signle line comment
|
||||
> for (var j = 0; j < b.length; j++) {
|
||||
> b[j].greet();
|
||||
> }
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 36, col 1)
|
||||
1 >module Foo.Bar {
|
||||
|
||||
~~~~~~ => Pos: (11 to 16) SpanInfo: {"start":11,"length":870}
|
||||
>Bar {
|
||||
> "use strict";
|
||||
>
|
||||
> class Greeter {
|
||||
> constructor(public greeting: string) {
|
||||
> }
|
||||
>
|
||||
> greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
> }
|
||||
>
|
||||
>
|
||||
> function foo(greeting: string): Greeter {
|
||||
> return new Greeter(greeting);
|
||||
> }
|
||||
>
|
||||
> var greeter = new Greeter("Hello, world!");
|
||||
> var str = greeter.greet();
|
||||
>
|
||||
> function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) {
|
||||
> var greeters: Greeter[] = []; /* inline block comment */
|
||||
> greeters[0] = new Greeter(greeting);
|
||||
> for (var i = 0; i < restGreetings.length; i++) {
|
||||
> greeters.push(new Greeter(restGreetings[i]));
|
||||
> }
|
||||
>
|
||||
> return greeters;
|
||||
> }
|
||||
>
|
||||
> var b = foo2("Hello", "World", "!");
|
||||
> // This is simple signle line comment
|
||||
> for (var j = 0; j < b.length; j++) {
|
||||
> b[j].greet();
|
||||
> }
|
||||
>}
|
||||
>:=> (line 1, col 11) to (line 36, col 1)
|
||||
--------------------------------
|
||||
2 > "use strict";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (17 to 34) SpanInfo: {"start":21,"length":12}
|
||||
>"use strict"
|
||||
>:=> (line 2, col 4) to (line 2, col 16)
|
||||
--------------------------------
|
||||
3 >
|
||||
|
||||
~ => Pos: (35 to 35) SpanInfo: undefined
|
||||
--------------------------------
|
||||
4 > class Greeter {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 55) SpanInfo: {"start":40,"length":160}
|
||||
>class Greeter {
|
||||
> constructor(public greeting: string) {
|
||||
> }
|
||||
>
|
||||
> greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
> }
|
||||
>:=> (line 4, col 4) to (line 11, col 5)
|
||||
--------------------------------
|
||||
5 > constructor(public greeting: string) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (56 to 75) SpanInfo: {"start":111,"length":1}
|
||||
>}
|
||||
>:=> (line 6, col 8) to (line 6, col 9)
|
||||
5 > constructor(public greeting: string) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (76 to 99) SpanInfo: {"start":76,"length":23}
|
||||
>public greeting: string
|
||||
>:=> (line 5, col 20) to (line 5, col 43)
|
||||
5 > constructor(public greeting: string) {
|
||||
|
||||
~~~=> Pos: (100 to 102) SpanInfo: {"start":111,"length":1}
|
||||
>}
|
||||
>:=> (line 6, col 8) to (line 6, col 9)
|
||||
--------------------------------
|
||||
6 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (103 to 112) SpanInfo: {"start":111,"length":1}
|
||||
>}
|
||||
>:=> (line 6, col 8) to (line 6, col 9)
|
||||
--------------------------------
|
||||
7 >
|
||||
|
||||
~ => Pos: (113 to 113) SpanInfo: undefined
|
||||
--------------------------------
|
||||
8 > greet() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (114 to 131) SpanInfo: {"start":122,"length":72}
|
||||
>greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
>:=> (line 8, col 8) to (line 10, col 9)
|
||||
--------------------------------
|
||||
9 > return "<h1>" + this.greeting + "</h1>";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (132 to 184) SpanInfo: {"start":144,"length":39}
|
||||
>return "<h1>" + this.greeting + "</h1>"
|
||||
>:=> (line 9, col 12) to (line 9, col 51)
|
||||
--------------------------------
|
||||
10 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (185 to 194) SpanInfo: {"start":193,"length":1}
|
||||
>}
|
||||
>:=> (line 10, col 8) to (line 10, col 9)
|
||||
--------------------------------
|
||||
11 > }
|
||||
|
||||
~~~~~~ => Pos: (195 to 200) SpanInfo: {"start":199,"length":1}
|
||||
>}
|
||||
>:=> (line 11, col 4) to (line 11, col 5)
|
||||
--------------------------------
|
||||
12 >
|
||||
|
||||
~ => Pos: (201 to 201) SpanInfo: undefined
|
||||
--------------------------------
|
||||
13 >
|
||||
|
||||
~ => Pos: (202 to 202) SpanInfo: undefined
|
||||
--------------------------------
|
||||
14 > function foo(greeting: string): Greeter {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (203 to 248) SpanInfo: {"start":257,"length":28}
|
||||
>return new Greeter(greeting)
|
||||
>:=> (line 15, col 8) to (line 15, col 36)
|
||||
--------------------------------
|
||||
15 > return new Greeter(greeting);
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (249 to 262) SpanInfo: {"start":257,"length":28}
|
||||
>return new Greeter(greeting)
|
||||
>:=> (line 15, col 8) to (line 15, col 36)
|
||||
15 > return new Greeter(greeting);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (263 to 286) SpanInfo: {"start":264,"length":21}
|
||||
>new Greeter(greeting)
|
||||
>:=> (line 15, col 15) to (line 15, col 36)
|
||||
--------------------------------
|
||||
16 > }
|
||||
|
||||
~~~~~~ => Pos: (287 to 292) SpanInfo: {"start":291,"length":1}
|
||||
>}
|
||||
>:=> (line 16, col 4) to (line 16, col 5)
|
||||
--------------------------------
|
||||
17 >
|
||||
|
||||
~ => Pos: (293 to 293) SpanInfo: undefined
|
||||
--------------------------------
|
||||
18 > var greeter = new Greeter("Hello, world!");
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (294 to 310) SpanInfo: {"start":298,"length":42}
|
||||
>var greeter = new Greeter("Hello, world!")
|
||||
>:=> (line 18, col 4) to (line 18, col 46)
|
||||
18 > var greeter = new Greeter("Hello, world!");
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (311 to 341) SpanInfo: {"start":312,"length":28}
|
||||
>new Greeter("Hello, world!")
|
||||
>:=> (line 18, col 18) to (line 18, col 46)
|
||||
--------------------------------
|
||||
19 > var str = greeter.greet();
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (342 to 354) SpanInfo: {"start":346,"length":25}
|
||||
>var str = greeter.greet()
|
||||
>:=> (line 19, col 4) to (line 19, col 29)
|
||||
19 > var str = greeter.greet();
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (355 to 372) SpanInfo: {"start":356,"length":15}
|
||||
>greeter.greet()
|
||||
>:=> (line 19, col 14) to (line 19, col 29)
|
||||
--------------------------------
|
||||
20 >
|
||||
|
||||
~ => Pos: (373 to 373) SpanInfo: undefined
|
||||
--------------------------------
|
||||
21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (374 to 408) SpanInfo: {"start":468,"length":28}
|
||||
>var greeters: Greeter[] = []
|
||||
>:=> (line 22, col 8) to (line 22, col 36)
|
||||
21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (409 to 456) SpanInfo: {"start":410,"length":46}
|
||||
>...restGreetings /* more greeting */: string[]
|
||||
>:=> (line 21, col 36) to (line 21, col 82)
|
||||
21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) {
|
||||
|
||||
~~~=> Pos: (457 to 459) SpanInfo: {"start":468,"length":28}
|
||||
>var greeters: Greeter[] = []
|
||||
>:=> (line 22, col 8) to (line 22, col 36)
|
||||
--------------------------------
|
||||
22 > var greeters: Greeter[] = []; /* inline block comment */
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (460 to 524) SpanInfo: {"start":468,"length":28}
|
||||
>var greeters: Greeter[] = []
|
||||
>:=> (line 22, col 8) to (line 22, col 36)
|
||||
--------------------------------
|
||||
23 > greeters[0] = new Greeter(greeting);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (525 to 545) SpanInfo: {"start":533,"length":35}
|
||||
>greeters[0] = new Greeter(greeting)
|
||||
>:=> (line 23, col 8) to (line 23, col 43)
|
||||
23 > greeters[0] = new Greeter(greeting);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (546 to 569) SpanInfo: {"start":547,"length":21}
|
||||
>new Greeter(greeting)
|
||||
>:=> (line 23, col 22) to (line 23, col 43)
|
||||
--------------------------------
|
||||
24 > for (var i = 0; i < restGreetings.length; i++) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (570 to 592) SpanInfo: {"start":583,"length":9}
|
||||
>var i = 0
|
||||
>:=> (line 24, col 13) to (line 24, col 22)
|
||||
24 > for (var i = 0; i < restGreetings.length; i++) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (593 to 618) SpanInfo: {"start":594,"length":24}
|
||||
>i < restGreetings.length
|
||||
>:=> (line 24, col 24) to (line 24, col 48)
|
||||
24 > for (var i = 0; i < restGreetings.length; i++) {
|
||||
|
||||
~~~~~~~~=> Pos: (619 to 626) SpanInfo: {"start":620,"length":3}
|
||||
>i++
|
||||
>:=> (line 24, col 50) to (line 24, col 53)
|
||||
--------------------------------
|
||||
25 > greeters.push(new Greeter(restGreetings[i]));
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (627 to 652) SpanInfo: {"start":639,"length":44}
|
||||
>greeters.push(new Greeter(restGreetings[i]))
|
||||
>:=> (line 25, col 12) to (line 25, col 56)
|
||||
25 > greeters.push(new Greeter(restGreetings[i]));
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (653 to 681) SpanInfo: {"start":653,"length":29}
|
||||
>new Greeter(restGreetings[i])
|
||||
>:=> (line 25, col 26) to (line 25, col 55)
|
||||
25 > greeters.push(new Greeter(restGreetings[i]));
|
||||
|
||||
~~~=> Pos: (682 to 684) SpanInfo: {"start":639,"length":44}
|
||||
>greeters.push(new Greeter(restGreetings[i]))
|
||||
>:=> (line 25, col 12) to (line 25, col 56)
|
||||
--------------------------------
|
||||
26 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (685 to 694) SpanInfo: {"start":639,"length":44}
|
||||
>greeters.push(new Greeter(restGreetings[i]))
|
||||
>:=> (line 25, col 12) to (line 25, col 56)
|
||||
--------------------------------
|
||||
27 >
|
||||
|
||||
~ => Pos: (695 to 695) SpanInfo: undefined
|
||||
--------------------------------
|
||||
28 > return greeters;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (696 to 720) SpanInfo: {"start":704,"length":15}
|
||||
>return greeters
|
||||
>:=> (line 28, col 8) to (line 28, col 23)
|
||||
--------------------------------
|
||||
29 > }
|
||||
|
||||
~~~~~~ => Pos: (721 to 726) SpanInfo: {"start":725,"length":1}
|
||||
>}
|
||||
>:=> (line 29, col 4) to (line 29, col 5)
|
||||
--------------------------------
|
||||
30 >
|
||||
|
||||
~ => Pos: (727 to 727) SpanInfo: undefined
|
||||
--------------------------------
|
||||
31 > var b = foo2("Hello", "World", "!");
|
||||
|
||||
~~~~~~~~~~~ => Pos: (728 to 738) SpanInfo: {"start":732,"length":35}
|
||||
>var b = foo2("Hello", "World", "!")
|
||||
>:=> (line 31, col 4) to (line 31, col 39)
|
||||
31 > var b = foo2("Hello", "World", "!");
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (739 to 768) SpanInfo: {"start":740,"length":27}
|
||||
>foo2("Hello", "World", "!")
|
||||
>:=> (line 31, col 12) to (line 31, col 39)
|
||||
--------------------------------
|
||||
32 > // This is simple signle line comment
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (769 to 810) SpanInfo: undefined
|
||||
--------------------------------
|
||||
33 > for (var j = 0; j < b.length; j++) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (811 to 829) SpanInfo: {"start":820,"length":9}
|
||||
>var j = 0
|
||||
>:=> (line 33, col 9) to (line 33, col 18)
|
||||
33 > for (var j = 0; j < b.length; j++) {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (830 to 843) SpanInfo: {"start":831,"length":12}
|
||||
>j < b.length
|
||||
>:=> (line 33, col 20) to (line 33, col 32)
|
||||
33 > for (var j = 0; j < b.length; j++) {
|
||||
|
||||
~~~~~~~~ => Pos: (844 to 851) SpanInfo: {"start":845,"length":3}
|
||||
>j++
|
||||
>:=> (line 33, col 34) to (line 33, col 37)
|
||||
--------------------------------
|
||||
34 > b[j].greet();
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (852 to 873) SpanInfo: {"start":860,"length":12}
|
||||
>b[j].greet()
|
||||
>:=> (line 34, col 8) to (line 34, col 20)
|
||||
--------------------------------
|
||||
35 > }
|
||||
|
||||
~~~~~~ => Pos: (874 to 879) SpanInfo: {"start":860,"length":12}
|
||||
>b[j].greet()
|
||||
>:=> (line 34, col 8) to (line 34, col 20)
|
||||
--------------------------------
|
||||
36 >}
|
||||
~ => Pos: (880 to 880) SpanInfo: {"start":880,"length":1}
|
||||
>}
|
||||
>:=> (line 36, col 0) to (line 36, col 1)
|
||||
129
tests/baselines/reference/bpSpan_conditionalExpressions.baseline
Normal file
129
tests/baselines/reference/bpSpan_conditionalExpressions.baseline
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
1 >var x = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >var y = x ? x + 10 : 30;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (12 to 36) SpanInfo: {"start":12,"length":23}
|
||||
>var y = x ? x + 10 : 30
|
||||
>:=> (line 2, col 0) to (line 2, col 23)
|
||||
--------------------------------
|
||||
3 >var z = (function foo() {
|
||||
|
||||
~~~~~~~ => Pos: (37 to 43) SpanInfo: {"start":37,"length":90}
|
||||
>var z = (function foo() {
|
||||
> return x;
|
||||
>})() ? y : function bar() {
|
||||
> return x;
|
||||
>} ()
|
||||
>:=> (line 3, col 0) to (line 7, col 4)
|
||||
3 >var z = (function foo() {
|
||||
|
||||
~~ => Pos: (44 to 45) SpanInfo: {"start":45,"length":36}
|
||||
>(function foo() {
|
||||
> return x;
|
||||
>})()
|
||||
>:=> (line 3, col 8) to (line 5, col 4)
|
||||
3 >var z = (function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (46 to 62) SpanInfo: {"start":67,"length":8}
|
||||
>return x
|
||||
>:=> (line 4, col 4) to (line 4, col 12)
|
||||
--------------------------------
|
||||
4 > return x;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (63 to 76) SpanInfo: {"start":67,"length":8}
|
||||
>return x
|
||||
>:=> (line 4, col 4) to (line 4, col 12)
|
||||
--------------------------------
|
||||
5 >})() ? y : function bar() {
|
||||
|
||||
~ => Pos: (77 to 77) SpanInfo: {"start":77,"length":1}
|
||||
>}
|
||||
>:=> (line 5, col 0) to (line 5, col 1)
|
||||
5 >})() ? y : function bar() {
|
||||
|
||||
~~~ => Pos: (78 to 80) SpanInfo: {"start":45,"length":36}
|
||||
>(function foo() {
|
||||
> return x;
|
||||
>})()
|
||||
>:=> (line 3, col 8) to (line 5, col 4)
|
||||
5 >})() ? y : function bar() {
|
||||
|
||||
~~~~~~ => Pos: (81 to 86) SpanInfo: {"start":37,"length":90}
|
||||
>var z = (function foo() {
|
||||
> return x;
|
||||
>})() ? y : function bar() {
|
||||
> return x;
|
||||
>} ()
|
||||
>:=> (line 3, col 0) to (line 7, col 4)
|
||||
5 >})() ? y : function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (87 to 104) SpanInfo: {"start":113,"length":8}
|
||||
>return x
|
||||
>:=> (line 6, col 8) to (line 6, col 16)
|
||||
--------------------------------
|
||||
6 > return x;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (105 to 122) SpanInfo: {"start":113,"length":8}
|
||||
>return x
|
||||
>:=> (line 6, col 8) to (line 6, col 16)
|
||||
--------------------------------
|
||||
7 >} ();
|
||||
|
||||
~ => Pos: (123 to 123) SpanInfo: {"start":123,"length":1}
|
||||
>}
|
||||
>:=> (line 7, col 0) to (line 7, col 1)
|
||||
7 >} ();
|
||||
|
||||
~~~~~ => Pos: (124 to 128) SpanInfo: {"start":88,"length":39}
|
||||
>function bar() {
|
||||
> return x;
|
||||
>} ()
|
||||
>:=> (line 5, col 11) to (line 7, col 4)
|
||||
--------------------------------
|
||||
8 >x = y ? (function () {
|
||||
|
||||
~~~~~~~ => Pos: (129 to 135) SpanInfo: {"start":129,"length":47}
|
||||
>x = y ? (function () {
|
||||
> return z;
|
||||
>})() : 10
|
||||
>:=> (line 8, col 0) to (line 10, col 10)
|
||||
8 >x = y ? (function () {
|
||||
|
||||
~~ => Pos: (136 to 137) SpanInfo: {"start":137,"length":33}
|
||||
>(function () {
|
||||
> return z;
|
||||
>})()
|
||||
>:=> (line 8, col 8) to (line 10, col 4)
|
||||
8 >x = y ? (function () {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (138 to 151) SpanInfo: {"start":156,"length":8}
|
||||
>return z
|
||||
>:=> (line 9, col 4) to (line 9, col 12)
|
||||
--------------------------------
|
||||
9 > return z;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (152 to 165) SpanInfo: {"start":156,"length":8}
|
||||
>return z
|
||||
>:=> (line 9, col 4) to (line 9, col 12)
|
||||
--------------------------------
|
||||
10 >})() : 10;
|
||||
~ => Pos: (166 to 166) SpanInfo: {"start":166,"length":1}
|
||||
>}
|
||||
>:=> (line 10, col 0) to (line 10, col 1)
|
||||
10 >})() : 10;
|
||||
~~~ => Pos: (167 to 169) SpanInfo: {"start":137,"length":33}
|
||||
>(function () {
|
||||
> return z;
|
||||
>})()
|
||||
>:=> (line 8, col 8) to (line 10, col 4)
|
||||
10 >})() : 10;
|
||||
~~~~~~~ => Pos: (170 to 176) SpanInfo: {"start":129,"length":47}
|
||||
>x = y ? (function () {
|
||||
> return z;
|
||||
>})() : 10
|
||||
>:=> (line 8, col 0) to (line 10, col 10)
|
||||
5
tests/baselines/reference/bpSpan_debugger.baseline
Normal file
5
tests/baselines/reference/bpSpan_debugger.baseline
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
1 >debugger;
|
||||
~~~~~~~~~ => Pos: (0 to 8) SpanInfo: {"start":0,"length":8}
|
||||
>debugger
|
||||
>:=> (line 1, col 0) to (line 1, col 8)
|
||||
142
tests/baselines/reference/bpSpan_do.baseline
Normal file
142
tests/baselines/reference/bpSpan_do.baseline
Normal file
@ -0,0 +1,142 @@
|
||||
|
||||
1 >var i = 0;
|
||||
|
||||
~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: {"start":0,"length":9}
|
||||
>var i = 0
|
||||
>:=> (line 1, col 0) to (line 1, col 9)
|
||||
--------------------------------
|
||||
2 >do
|
||||
|
||||
~~~ => Pos: (11 to 13) SpanInfo: {"start":20,"length":3}
|
||||
>i++
|
||||
>:=> (line 4, col 4) to (line 4, col 7)
|
||||
--------------------------------
|
||||
3 >{
|
||||
|
||||
~~ => Pos: (14 to 15) SpanInfo: {"start":20,"length":3}
|
||||
>i++
|
||||
>:=> (line 4, col 4) to (line 4, col 7)
|
||||
--------------------------------
|
||||
4 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (16 to 24) SpanInfo: {"start":20,"length":3}
|
||||
>i++
|
||||
>:=> (line 4, col 4) to (line 4, col 7)
|
||||
--------------------------------
|
||||
5 >} while (i < 10);
|
||||
|
||||
~ => Pos: (25 to 25) SpanInfo: {"start":20,"length":3}
|
||||
>i++
|
||||
>:=> (line 4, col 4) to (line 4, col 7)
|
||||
5 >} while (i < 10);
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (26 to 42) SpanInfo: {"start":27,"length":14}
|
||||
>while (i < 10)
|
||||
>:=> (line 5, col 2) to (line 5, col 16)
|
||||
--------------------------------
|
||||
6 >do {
|
||||
|
||||
~~~~~ => Pos: (43 to 47) SpanInfo: {"start":52,"length":3}
|
||||
>i++
|
||||
>:=> (line 7, col 4) to (line 7, col 7)
|
||||
--------------------------------
|
||||
7 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (48 to 56) SpanInfo: {"start":52,"length":3}
|
||||
>i++
|
||||
>:=> (line 7, col 4) to (line 7, col 7)
|
||||
--------------------------------
|
||||
8 >} while (i < 20);
|
||||
|
||||
~ => Pos: (57 to 57) SpanInfo: {"start":52,"length":3}
|
||||
>i++
|
||||
>:=> (line 7, col 4) to (line 7, col 7)
|
||||
8 >} while (i < 20);
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (58 to 74) SpanInfo: {"start":59,"length":14}
|
||||
>while (i < 20)
|
||||
>:=> (line 8, col 2) to (line 8, col 16)
|
||||
--------------------------------
|
||||
9 >do {
|
||||
|
||||
~~~~~ => Pos: (75 to 79) SpanInfo: {"start":84,"length":3}
|
||||
>i++
|
||||
>:=> (line 10, col 4) to (line 10, col 7)
|
||||
--------------------------------
|
||||
10 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (80 to 88) SpanInfo: {"start":84,"length":3}
|
||||
>i++
|
||||
>:=> (line 10, col 4) to (line 10, col 7)
|
||||
--------------------------------
|
||||
11 >}
|
||||
|
||||
~~~ => Pos: (89 to 91) SpanInfo: {"start":84,"length":3}
|
||||
>i++
|
||||
>:=> (line 10, col 4) to (line 10, col 7)
|
||||
--------------------------------
|
||||
12 >while (i < 30);
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (92 to 107) SpanInfo: {"start":92,"length":14}
|
||||
>while (i < 30)
|
||||
>:=> (line 12, col 0) to (line 12, col 14)
|
||||
--------------------------------
|
||||
13 >do {
|
||||
|
||||
~~~~~ => Pos: (108 to 112) SpanInfo: {"start":117,"length":3}
|
||||
>i--
|
||||
>:=> (line 14, col 4) to (line 14, col 7)
|
||||
--------------------------------
|
||||
14 > i--;
|
||||
|
||||
~~~~~~~~~ => Pos: (113 to 121) SpanInfo: {"start":117,"length":3}
|
||||
>i--
|
||||
>:=> (line 14, col 4) to (line 14, col 7)
|
||||
--------------------------------
|
||||
15 >} while ((function () {
|
||||
|
||||
~ => Pos: (122 to 122) SpanInfo: {"start":117,"length":3}
|
||||
>i--
|
||||
>:=> (line 14, col 4) to (line 14, col 7)
|
||||
15 >} while ((function () {
|
||||
|
||||
~~~~~~~~ => Pos: (123 to 130) SpanInfo: {"start":124,"length":60}
|
||||
>while ((function () {
|
||||
> return 30 * i;
|
||||
> })() !== i)
|
||||
>:=> (line 15, col 2) to (line 17, col 15)
|
||||
15 >} while ((function () {
|
||||
|
||||
~ => Pos: (131 to 131) SpanInfo: {"start":131,"length":46}
|
||||
>(function () {
|
||||
> return 30 * i;
|
||||
> })()
|
||||
>:=> (line 15, col 9) to (line 17, col 8)
|
||||
15 >} while ((function () {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (132 to 145) SpanInfo: {"start":154,"length":13}
|
||||
>return 30 * i
|
||||
>:=> (line 16, col 8) to (line 16, col 21)
|
||||
--------------------------------
|
||||
16 > return 30 * i;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (146 to 168) SpanInfo: {"start":154,"length":13}
|
||||
>return 30 * i
|
||||
>:=> (line 16, col 8) to (line 16, col 21)
|
||||
--------------------------------
|
||||
17 > })() !== i);
|
||||
~~~~~ => Pos: (169 to 173) SpanInfo: {"start":173,"length":1}
|
||||
>}
|
||||
>:=> (line 17, col 4) to (line 17, col 5)
|
||||
17 > })() !== i);
|
||||
~~~ => Pos: (174 to 176) SpanInfo: {"start":131,"length":46}
|
||||
>(function () {
|
||||
> return 30 * i;
|
||||
> })()
|
||||
>:=> (line 15, col 9) to (line 17, col 8)
|
||||
17 > })() !== i);
|
||||
~~~~~~~~~ => Pos: (177 to 185) SpanInfo: {"start":124,"length":60}
|
||||
>while ((function () {
|
||||
> return 30 * i;
|
||||
> })() !== i)
|
||||
>:=> (line 15, col 2) to (line 17, col 15)
|
||||
248
tests/baselines/reference/bpSpan_enums.baseline
Normal file
248
tests/baselines/reference/bpSpan_enums.baseline
Normal file
@ -0,0 +1,248 @@
|
||||
|
||||
1 >enum e {
|
||||
|
||||
~~~~~~~~~ => Pos: (0 to 8) SpanInfo: {"start":0,"length":30}
|
||||
>enum e {
|
||||
> x,
|
||||
> y,
|
||||
> x
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 5, col 1)
|
||||
--------------------------------
|
||||
2 > x,
|
||||
|
||||
~~~~~~~ => Pos: (9 to 15) SpanInfo: {"start":13,"length":1}
|
||||
>x
|
||||
>:=> (line 2, col 4) to (line 2, col 5)
|
||||
--------------------------------
|
||||
3 > y,
|
||||
|
||||
~~~~~~~ => Pos: (16 to 22) SpanInfo: {"start":20,"length":1}
|
||||
>y
|
||||
>:=> (line 3, col 4) to (line 3, col 5)
|
||||
--------------------------------
|
||||
4 > x
|
||||
|
||||
~~~~~~ => Pos: (23 to 28) SpanInfo: {"start":27,"length":1}
|
||||
>x
|
||||
>:=> (line 4, col 4) to (line 4, col 5)
|
||||
--------------------------------
|
||||
5 >}
|
||||
|
||||
~~ => Pos: (29 to 30) SpanInfo: {"start":29,"length":1}
|
||||
>}
|
||||
>:=> (line 5, col 0) to (line 5, col 1)
|
||||
--------------------------------
|
||||
6 >enum e2 {
|
||||
|
||||
~~~~~~~~~~ => Pos: (31 to 40) SpanInfo: {"start":31,"length":49}
|
||||
>enum e2 {
|
||||
> x = 10,
|
||||
> y = 10,
|
||||
> z,
|
||||
> x2
|
||||
>}
|
||||
>:=> (line 6, col 0) to (line 11, col 1)
|
||||
--------------------------------
|
||||
7 > x = 10,
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (41 to 52) SpanInfo: {"start":45,"length":6}
|
||||
>x = 10
|
||||
>:=> (line 7, col 4) to (line 7, col 10)
|
||||
--------------------------------
|
||||
8 > y = 10,
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (53 to 64) SpanInfo: {"start":57,"length":6}
|
||||
>y = 10
|
||||
>:=> (line 8, col 4) to (line 8, col 10)
|
||||
--------------------------------
|
||||
9 > z,
|
||||
|
||||
~~~~~~~ => Pos: (65 to 71) SpanInfo: {"start":69,"length":1}
|
||||
>z
|
||||
>:=> (line 9, col 4) to (line 9, col 5)
|
||||
--------------------------------
|
||||
10 > x2
|
||||
|
||||
~~~~~~~ => Pos: (72 to 78) SpanInfo: {"start":76,"length":2}
|
||||
>x2
|
||||
>:=> (line 10, col 4) to (line 10, col 6)
|
||||
--------------------------------
|
||||
11 >}
|
||||
|
||||
~~ => Pos: (79 to 80) SpanInfo: {"start":79,"length":1}
|
||||
>}
|
||||
>:=> (line 11, col 0) to (line 11, col 1)
|
||||
--------------------------------
|
||||
12 >enum e3 {
|
||||
|
||||
~~~~~~~~~~ => Pos: (81 to 90) SpanInfo: {"start":81,"length":11}
|
||||
>enum e3 {
|
||||
>}
|
||||
>:=> (line 12, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
13 >}
|
||||
|
||||
~~ => Pos: (91 to 92) SpanInfo: {"start":91,"length":1}
|
||||
>}
|
||||
>:=> (line 13, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
14 >declare enum e4 {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (93 to 110) SpanInfo: undefined
|
||||
--------------------------------
|
||||
15 > x,
|
||||
|
||||
~~~~~~~ => Pos: (111 to 117) SpanInfo: undefined
|
||||
--------------------------------
|
||||
16 > y,
|
||||
|
||||
~~~~~~~ => Pos: (118 to 124) SpanInfo: undefined
|
||||
--------------------------------
|
||||
17 > z,
|
||||
|
||||
~~~~~~~ => Pos: (125 to 131) SpanInfo: undefined
|
||||
--------------------------------
|
||||
18 > x2
|
||||
|
||||
~~~~~~~ => Pos: (132 to 138) SpanInfo: undefined
|
||||
--------------------------------
|
||||
19 >}
|
||||
|
||||
~~ => Pos: (139 to 140) SpanInfo: undefined
|
||||
--------------------------------
|
||||
20 >enum e11
|
||||
|
||||
~~~~~~~~~~ => Pos: (141 to 150) SpanInfo: {"start":141,"length":33}
|
||||
>enum e11
|
||||
>{
|
||||
> x,
|
||||
> y,
|
||||
> x
|
||||
>}
|
||||
>:=> (line 20, col 0) to (line 25, col 1)
|
||||
--------------------------------
|
||||
21 >{
|
||||
|
||||
~~ => Pos: (151 to 152) SpanInfo: {"start":157,"length":1}
|
||||
>x
|
||||
>:=> (line 22, col 4) to (line 22, col 5)
|
||||
--------------------------------
|
||||
22 > x,
|
||||
|
||||
~~~~~~~ => Pos: (153 to 159) SpanInfo: {"start":157,"length":1}
|
||||
>x
|
||||
>:=> (line 22, col 4) to (line 22, col 5)
|
||||
--------------------------------
|
||||
23 > y,
|
||||
|
||||
~~~~~~~ => Pos: (160 to 166) SpanInfo: {"start":164,"length":1}
|
||||
>y
|
||||
>:=> (line 23, col 4) to (line 23, col 5)
|
||||
--------------------------------
|
||||
24 > x
|
||||
|
||||
~~~~~~ => Pos: (167 to 172) SpanInfo: {"start":171,"length":1}
|
||||
>x
|
||||
>:=> (line 24, col 4) to (line 24, col 5)
|
||||
--------------------------------
|
||||
25 >}
|
||||
|
||||
~~ => Pos: (173 to 174) SpanInfo: {"start":173,"length":1}
|
||||
>}
|
||||
>:=> (line 25, col 0) to (line 25, col 1)
|
||||
--------------------------------
|
||||
26 >enum e12
|
||||
|
||||
~~~~~~~~~ => Pos: (175 to 183) SpanInfo: {"start":175,"length":50}
|
||||
>enum e12
|
||||
>{
|
||||
> x = 10,
|
||||
> y = 10,
|
||||
> z,
|
||||
> x2
|
||||
>}
|
||||
>:=> (line 26, col 0) to (line 32, col 1)
|
||||
--------------------------------
|
||||
27 >{
|
||||
|
||||
~~ => Pos: (184 to 185) SpanInfo: {"start":190,"length":6}
|
||||
>x = 10
|
||||
>:=> (line 28, col 4) to (line 28, col 10)
|
||||
--------------------------------
|
||||
28 > x = 10,
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (186 to 197) SpanInfo: {"start":190,"length":6}
|
||||
>x = 10
|
||||
>:=> (line 28, col 4) to (line 28, col 10)
|
||||
--------------------------------
|
||||
29 > y = 10,
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (198 to 209) SpanInfo: {"start":202,"length":6}
|
||||
>y = 10
|
||||
>:=> (line 29, col 4) to (line 29, col 10)
|
||||
--------------------------------
|
||||
30 > z,
|
||||
|
||||
~~~~~~~ => Pos: (210 to 216) SpanInfo: {"start":214,"length":1}
|
||||
>z
|
||||
>:=> (line 30, col 4) to (line 30, col 5)
|
||||
--------------------------------
|
||||
31 > x2
|
||||
|
||||
~~~~~~~ => Pos: (217 to 223) SpanInfo: {"start":221,"length":2}
|
||||
>x2
|
||||
>:=> (line 31, col 4) to (line 31, col 6)
|
||||
--------------------------------
|
||||
32 >}
|
||||
|
||||
~~ => Pos: (224 to 225) SpanInfo: {"start":224,"length":1}
|
||||
>}
|
||||
>:=> (line 32, col 0) to (line 32, col 1)
|
||||
--------------------------------
|
||||
33 >enum e13
|
||||
|
||||
~~~~~~~~~ => Pos: (226 to 234) SpanInfo: {"start":226,"length":12}
|
||||
>enum e13
|
||||
>{
|
||||
>}
|
||||
>:=> (line 33, col 0) to (line 35, col 1)
|
||||
--------------------------------
|
||||
34 >{
|
||||
|
||||
~~ => Pos: (235 to 236) SpanInfo: {"start":237,"length":1}
|
||||
>}
|
||||
>:=> (line 35, col 0) to (line 35, col 1)
|
||||
--------------------------------
|
||||
35 >}
|
||||
|
||||
~~ => Pos: (237 to 238) SpanInfo: {"start":237,"length":1}
|
||||
>}
|
||||
>:=> (line 35, col 0) to (line 35, col 1)
|
||||
--------------------------------
|
||||
36 >declare enum e14
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (239 to 255) SpanInfo: undefined
|
||||
--------------------------------
|
||||
37 >{
|
||||
|
||||
~~ => Pos: (256 to 257) SpanInfo: undefined
|
||||
--------------------------------
|
||||
38 > x,
|
||||
|
||||
~~~~~~~ => Pos: (258 to 264) SpanInfo: undefined
|
||||
--------------------------------
|
||||
39 > y,
|
||||
|
||||
~~~~~~~ => Pos: (265 to 271) SpanInfo: undefined
|
||||
--------------------------------
|
||||
40 > z,
|
||||
|
||||
~~~~~~~ => Pos: (272 to 278) SpanInfo: undefined
|
||||
--------------------------------
|
||||
41 > x2
|
||||
|
||||
~~~~~~~ => Pos: (279 to 285) SpanInfo: undefined
|
||||
--------------------------------
|
||||
42 >}
|
||||
~ => Pos: (286 to 286) SpanInfo: undefined
|
||||
23
tests/baselines/reference/bpSpan_exportAssignment.baseline
Normal file
23
tests/baselines/reference/bpSpan_exportAssignment.baseline
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
1 >class a {
|
||||
|
||||
~~~~~~~~~~ => Pos: (0 to 9) SpanInfo: {"start":0,"length":25}
|
||||
>class a {
|
||||
> public c;
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 3, col 1)
|
||||
--------------------------------
|
||||
2 > public c;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (10 to 23) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 >}
|
||||
|
||||
~~ => Pos: (24 to 25) SpanInfo: {"start":24,"length":1}
|
||||
>}
|
||||
>:=> (line 3, col 0) to (line 3, col 1)
|
||||
--------------------------------
|
||||
4 >export = a;
|
||||
~~~~~~~~~~~ => Pos: (26 to 36) SpanInfo: {"start":26,"length":10}
|
||||
>export = a
|
||||
>:=> (line 4, col 0) to (line 4, col 10)
|
||||
253
tests/baselines/reference/bpSpan_for.baseline
Normal file
253
tests/baselines/reference/bpSpan_for.baseline
Normal file
@ -0,0 +1,253 @@
|
||||
|
||||
1 >for (var i = 0; i < 10; i++) {
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (0 to 14) SpanInfo: {"start":5,"length":9}
|
||||
>var i = 0
|
||||
>:=> (line 1, col 5) to (line 1, col 14)
|
||||
1 >for (var i = 0; i < 10; i++) {
|
||||
|
||||
~~~~~~~~ => Pos: (15 to 22) SpanInfo: {"start":16,"length":6}
|
||||
>i < 10
|
||||
>:=> (line 1, col 16) to (line 1, col 22)
|
||||
1 >for (var i = 0; i < 10; i++) {
|
||||
|
||||
~~~~~~~~ => Pos: (23 to 30) SpanInfo: {"start":24,"length":3}
|
||||
>i++
|
||||
>:=> (line 1, col 24) to (line 1, col 27)
|
||||
--------------------------------
|
||||
2 > WScript.Echo("i: " + i);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (31 to 59) SpanInfo: {"start":35,"length":23}
|
||||
>WScript.Echo("i: " + i)
|
||||
>:=> (line 2, col 4) to (line 2, col 27)
|
||||
--------------------------------
|
||||
3 >}
|
||||
|
||||
~~ => Pos: (60 to 61) SpanInfo: {"start":35,"length":23}
|
||||
>WScript.Echo("i: " + i)
|
||||
>:=> (line 2, col 4) to (line 2, col 27)
|
||||
--------------------------------
|
||||
4 >for (i = 0; i < 10; i++)
|
||||
|
||||
~~~~~~~~~~~ => Pos: (62 to 72) SpanInfo: {"start":67,"length":5}
|
||||
>i = 0
|
||||
>:=> (line 4, col 5) to (line 4, col 10)
|
||||
4 >for (i = 0; i < 10; i++)
|
||||
|
||||
~~~~~~~~ => Pos: (73 to 80) SpanInfo: {"start":74,"length":6}
|
||||
>i < 10
|
||||
>:=> (line 4, col 12) to (line 4, col 18)
|
||||
4 >for (i = 0; i < 10; i++)
|
||||
|
||||
~~~~~~ => Pos: (81 to 86) SpanInfo: {"start":82,"length":3}
|
||||
>i++
|
||||
>:=> (line 4, col 20) to (line 4, col 23)
|
||||
--------------------------------
|
||||
5 >{
|
||||
|
||||
~~ => Pos: (87 to 88) SpanInfo: {"start":93,"length":23}
|
||||
>WScript.Echo("i: " + i)
|
||||
>:=> (line 6, col 4) to (line 6, col 27)
|
||||
--------------------------------
|
||||
6 > WScript.Echo("i: " + i);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (89 to 117) SpanInfo: {"start":93,"length":23}
|
||||
>WScript.Echo("i: " + i)
|
||||
>:=> (line 6, col 4) to (line 6, col 27)
|
||||
--------------------------------
|
||||
7 >}
|
||||
|
||||
~~ => Pos: (118 to 119) SpanInfo: {"start":93,"length":23}
|
||||
>WScript.Echo("i: " + i)
|
||||
>:=> (line 6, col 4) to (line 6, col 27)
|
||||
--------------------------------
|
||||
8 >for (var j = 0; j < 10; ) {
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (120 to 134) SpanInfo: {"start":125,"length":9}
|
||||
>var j = 0
|
||||
>:=> (line 8, col 5) to (line 8, col 14)
|
||||
8 >for (var j = 0; j < 10; ) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (135 to 147) SpanInfo: {"start":136,"length":6}
|
||||
>j < 10
|
||||
>:=> (line 8, col 16) to (line 8, col 22)
|
||||
--------------------------------
|
||||
9 > j++;
|
||||
|
||||
~~~~~~~~~ => Pos: (148 to 156) SpanInfo: {"start":152,"length":3}
|
||||
>j++
|
||||
>:=> (line 9, col 4) to (line 9, col 7)
|
||||
--------------------------------
|
||||
10 > if (j == 1) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (157 to 174) SpanInfo: {"start":161,"length":11}
|
||||
>if (j == 1)
|
||||
>:=> (line 10, col 4) to (line 10, col 15)
|
||||
--------------------------------
|
||||
11 > continue;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (175 to 192) SpanInfo: {"start":183,"length":8}
|
||||
>continue
|
||||
>:=> (line 11, col 8) to (line 11, col 16)
|
||||
--------------------------------
|
||||
12 > }
|
||||
|
||||
~~~~~~ => Pos: (193 to 198) SpanInfo: {"start":183,"length":8}
|
||||
>continue
|
||||
>:=> (line 11, col 8) to (line 11, col 16)
|
||||
--------------------------------
|
||||
13 >}
|
||||
|
||||
~~ => Pos: (199 to 200) SpanInfo: {"start":161,"length":11}
|
||||
>if (j == 1)
|
||||
>:=> (line 10, col 4) to (line 10, col 15)
|
||||
--------------------------------
|
||||
14 >for (j = 0; j < 10;)
|
||||
|
||||
~~~~~~~~~~~ => Pos: (201 to 211) SpanInfo: {"start":206,"length":5}
|
||||
>j = 0
|
||||
>:=> (line 14, col 5) to (line 14, col 10)
|
||||
14 >for (j = 0; j < 10;)
|
||||
|
||||
~~~~~~~~~~ => Pos: (212 to 221) SpanInfo: {"start":213,"length":6}
|
||||
>j < 10
|
||||
>:=> (line 14, col 12) to (line 14, col 18)
|
||||
--------------------------------
|
||||
15 >{
|
||||
|
||||
~~ => Pos: (222 to 223) SpanInfo: {"start":228,"length":3}
|
||||
>j++
|
||||
>:=> (line 16, col 4) to (line 16, col 7)
|
||||
--------------------------------
|
||||
16 > j++;
|
||||
|
||||
~~~~~~~~~ => Pos: (224 to 232) SpanInfo: {"start":228,"length":3}
|
||||
>j++
|
||||
>:=> (line 16, col 4) to (line 16, col 7)
|
||||
--------------------------------
|
||||
17 >}
|
||||
|
||||
~~ => Pos: (233 to 234) SpanInfo: {"start":228,"length":3}
|
||||
>j++
|
||||
>:=> (line 16, col 4) to (line 16, col 7)
|
||||
--------------------------------
|
||||
18 >for (var k = 0;; k++) {
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (235 to 250) SpanInfo: {"start":240,"length":9}
|
||||
>var k = 0
|
||||
>:=> (line 18, col 5) to (line 18, col 14)
|
||||
18 >for (var k = 0;; k++) {
|
||||
|
||||
~~~~~~~~ => Pos: (251 to 258) SpanInfo: {"start":252,"length":3}
|
||||
>k++
|
||||
>:=> (line 18, col 17) to (line 18, col 20)
|
||||
--------------------------------
|
||||
19 >}
|
||||
|
||||
~~ => Pos: (259 to 260) SpanInfo: undefined
|
||||
--------------------------------
|
||||
20 >for (k = 0;; k++)
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (261 to 272) SpanInfo: {"start":266,"length":5}
|
||||
>k = 0
|
||||
>:=> (line 20, col 5) to (line 20, col 10)
|
||||
20 >for (k = 0;; k++)
|
||||
|
||||
~~~~~~ => Pos: (273 to 278) SpanInfo: {"start":274,"length":3}
|
||||
>k++
|
||||
>:=> (line 20, col 13) to (line 20, col 16)
|
||||
--------------------------------
|
||||
21 >{
|
||||
|
||||
~~ => Pos: (279 to 280) SpanInfo: undefined
|
||||
--------------------------------
|
||||
22 >}
|
||||
|
||||
~~ => Pos: (281 to 282) SpanInfo: undefined
|
||||
--------------------------------
|
||||
23 >for (; k < 10; k++) {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (283 to 296) SpanInfo: {"start":290,"length":6}
|
||||
>k < 10
|
||||
>:=> (line 23, col 7) to (line 23, col 13)
|
||||
23 >for (; k < 10; k++) {
|
||||
|
||||
~~~~~~~~ => Pos: (297 to 304) SpanInfo: {"start":298,"length":3}
|
||||
>k++
|
||||
>:=> (line 23, col 15) to (line 23, col 18)
|
||||
--------------------------------
|
||||
24 >}
|
||||
|
||||
~~ => Pos: (305 to 306) SpanInfo: undefined
|
||||
--------------------------------
|
||||
25 >for (;;) {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (307 to 317) SpanInfo: undefined
|
||||
--------------------------------
|
||||
26 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (318 to 326) SpanInfo: {"start":322,"length":3}
|
||||
>i++
|
||||
>:=> (line 26, col 4) to (line 26, col 7)
|
||||
--------------------------------
|
||||
27 >}
|
||||
|
||||
~~ => Pos: (327 to 328) SpanInfo: {"start":322,"length":3}
|
||||
>i++
|
||||
>:=> (line 26, col 4) to (line 26, col 7)
|
||||
--------------------------------
|
||||
28 >for (;;)
|
||||
|
||||
~~~~~~~~~ => Pos: (329 to 337) SpanInfo: undefined
|
||||
--------------------------------
|
||||
29 >{
|
||||
|
||||
~~ => Pos: (338 to 339) SpanInfo: {"start":344,"length":3}
|
||||
>i++
|
||||
>:=> (line 30, col 4) to (line 30, col 7)
|
||||
--------------------------------
|
||||
30 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (340 to 348) SpanInfo: {"start":344,"length":3}
|
||||
>i++
|
||||
>:=> (line 30, col 4) to (line 30, col 7)
|
||||
--------------------------------
|
||||
31 >}
|
||||
|
||||
~~ => Pos: (349 to 350) SpanInfo: {"start":344,"length":3}
|
||||
>i++
|
||||
>:=> (line 30, col 4) to (line 30, col 7)
|
||||
--------------------------------
|
||||
32 >for (i = 0, j = 20; j < 20, i < 20; j++) {
|
||||
|
||||
~~~~~ => Pos: (351 to 355) SpanInfo: {"start":356,"length":13}
|
||||
>i = 0, j = 20
|
||||
>:=> (line 32, col 5) to (line 32, col 18)
|
||||
32 >for (i = 0, j = 20; j < 20, i < 20; j++) {
|
||||
|
||||
~~~~~~ => Pos: (356 to 361) SpanInfo: {"start":356,"length":5}
|
||||
>i = 0
|
||||
>:=> (line 32, col 5) to (line 32, col 10)
|
||||
32 >for (i = 0, j = 20; j < 20, i < 20; j++) {
|
||||
|
||||
~~~~~~~~ => Pos: (362 to 369) SpanInfo: {"start":363,"length":6}
|
||||
>j = 20
|
||||
>:=> (line 32, col 12) to (line 32, col 18)
|
||||
32 >for (i = 0, j = 20; j < 20, i < 20; j++) {
|
||||
|
||||
~~~~~~~~ => Pos: (370 to 377) SpanInfo: {"start":371,"length":6}
|
||||
>j < 20
|
||||
>:=> (line 32, col 20) to (line 32, col 26)
|
||||
32 >for (i = 0, j = 20; j < 20, i < 20; j++) {
|
||||
|
||||
~~~~~~~~ => Pos: (378 to 385) SpanInfo: {"start":379,"length":6}
|
||||
>i < 20
|
||||
>:=> (line 32, col 28) to (line 32, col 34)
|
||||
32 >for (i = 0, j = 20; j < 20, i < 20; j++) {
|
||||
|
||||
~~~~~~~~ => Pos: (386 to 393) SpanInfo: {"start":387,"length":3}
|
||||
>j++
|
||||
>:=> (line 32, col 36) to (line 32, col 39)
|
||||
--------------------------------
|
||||
33 >}
|
||||
~ => Pos: (394 to 394) SpanInfo: undefined
|
||||
143
tests/baselines/reference/bpSpan_forIn.baseline
Normal file
143
tests/baselines/reference/bpSpan_forIn.baseline
Normal file
@ -0,0 +1,143 @@
|
||||
|
||||
1 >for (var x in String) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 23) SpanInfo: {"start":0,"length":21}
|
||||
>for (var x in String)
|
||||
>:=> (line 1, col 0) to (line 1, col 21)
|
||||
--------------------------------
|
||||
2 > WScript.Echo(x);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (24 to 44) SpanInfo: {"start":28,"length":15}
|
||||
>WScript.Echo(x)
|
||||
>:=> (line 2, col 4) to (line 2, col 19)
|
||||
--------------------------------
|
||||
3 >}
|
||||
|
||||
~~ => Pos: (45 to 46) SpanInfo: {"start":28,"length":15}
|
||||
>WScript.Echo(x)
|
||||
>:=> (line 2, col 4) to (line 2, col 19)
|
||||
--------------------------------
|
||||
4 >for (x in String) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (47 to 66) SpanInfo: {"start":47,"length":17}
|
||||
>for (x in String)
|
||||
>:=> (line 4, col 0) to (line 4, col 17)
|
||||
--------------------------------
|
||||
5 > WScript.Echo(x);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (67 to 87) SpanInfo: {"start":71,"length":15}
|
||||
>WScript.Echo(x)
|
||||
>:=> (line 5, col 4) to (line 5, col 19)
|
||||
--------------------------------
|
||||
6 >}
|
||||
|
||||
~~ => Pos: (88 to 89) SpanInfo: {"start":71,"length":15}
|
||||
>WScript.Echo(x)
|
||||
>:=> (line 5, col 4) to (line 5, col 19)
|
||||
--------------------------------
|
||||
7 >for (var x2 in String)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (90 to 112) SpanInfo: {"start":90,"length":22}
|
||||
>for (var x2 in String)
|
||||
>:=> (line 7, col 0) to (line 7, col 22)
|
||||
--------------------------------
|
||||
8 >{
|
||||
|
||||
~~ => Pos: (113 to 114) SpanInfo: {"start":119,"length":16}
|
||||
>WScript.Echo(x2)
|
||||
>:=> (line 9, col 4) to (line 9, col 20)
|
||||
--------------------------------
|
||||
9 > WScript.Echo(x2);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (115 to 136) SpanInfo: {"start":119,"length":16}
|
||||
>WScript.Echo(x2)
|
||||
>:=> (line 9, col 4) to (line 9, col 20)
|
||||
--------------------------------
|
||||
10 >}
|
||||
|
||||
~~ => Pos: (137 to 138) SpanInfo: {"start":119,"length":16}
|
||||
>WScript.Echo(x2)
|
||||
>:=> (line 9, col 4) to (line 9, col 20)
|
||||
--------------------------------
|
||||
11 >for (x in String)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (139 to 156) SpanInfo: {"start":139,"length":17}
|
||||
>for (x in String)
|
||||
>:=> (line 11, col 0) to (line 11, col 17)
|
||||
--------------------------------
|
||||
12 >{
|
||||
|
||||
~~ => Pos: (157 to 158) SpanInfo: {"start":163,"length":15}
|
||||
>WScript.Echo(x)
|
||||
>:=> (line 13, col 4) to (line 13, col 19)
|
||||
--------------------------------
|
||||
13 > WScript.Echo(x);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (159 to 179) SpanInfo: {"start":163,"length":15}
|
||||
>WScript.Echo(x)
|
||||
>:=> (line 13, col 4) to (line 13, col 19)
|
||||
--------------------------------
|
||||
14 >}
|
||||
|
||||
~~ => Pos: (180 to 181) SpanInfo: {"start":163,"length":15}
|
||||
>WScript.Echo(x)
|
||||
>:=> (line 13, col 4) to (line 13, col 19)
|
||||
--------------------------------
|
||||
15 >var z = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (182 to 193) SpanInfo: {"start":182,"length":10}
|
||||
>var z = 10
|
||||
>:=> (line 15, col 0) to (line 15, col 10)
|
||||
--------------------------------
|
||||
16 >for (x in function foo() {
|
||||
|
||||
~~~~~~~~~ => Pos: (194 to 202) SpanInfo: {"start":194,"length":54}
|
||||
>for (x in function foo() {
|
||||
> return new String();
|
||||
>})
|
||||
>:=> (line 16, col 0) to (line 18, col 2)
|
||||
16 >for (x in function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (203 to 220) SpanInfo: {"start":225,"length":19}
|
||||
>return new String()
|
||||
>:=> (line 17, col 4) to (line 17, col 23)
|
||||
--------------------------------
|
||||
17 > return new String();
|
||||
|
||||
~~~~~~~~~~ => Pos: (221 to 230) SpanInfo: {"start":225,"length":19}
|
||||
>return new String()
|
||||
>:=> (line 17, col 4) to (line 17, col 23)
|
||||
17 > return new String();
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (231 to 245) SpanInfo: {"start":232,"length":12}
|
||||
>new String()
|
||||
>:=> (line 17, col 11) to (line 17, col 23)
|
||||
--------------------------------
|
||||
18 >}) {
|
||||
|
||||
~ => Pos: (246 to 246) SpanInfo: {"start":246,"length":1}
|
||||
>}
|
||||
>:=> (line 18, col 0) to (line 18, col 1)
|
||||
18 >}) {
|
||||
|
||||
~ => Pos: (247 to 247) SpanInfo: {"start":194,"length":54}
|
||||
>for (x in function foo() {
|
||||
> return new String();
|
||||
>})
|
||||
>:=> (line 16, col 0) to (line 18, col 2)
|
||||
18 >}) {
|
||||
|
||||
~~~ => Pos: (248 to 250) SpanInfo: {"start":255,"length":3}
|
||||
>z++
|
||||
>:=> (line 19, col 4) to (line 19, col 7)
|
||||
--------------------------------
|
||||
19 > z++;
|
||||
|
||||
~~~~~~~~~ => Pos: (251 to 259) SpanInfo: {"start":255,"length":3}
|
||||
>z++
|
||||
>:=> (line 19, col 4) to (line 19, col 7)
|
||||
--------------------------------
|
||||
20 >}
|
||||
~ => Pos: (260 to 260) SpanInfo: {"start":255,"length":3}
|
||||
>z++
|
||||
>:=> (line 19, col 4) to (line 19, col 7)
|
||||
189
tests/baselines/reference/bpSpan_functionExpressions.baseline
Normal file
189
tests/baselines/reference/bpSpan_functionExpressions.baseline
Normal file
@ -0,0 +1,189 @@
|
||||
|
||||
1 >var greetings = 0;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17}
|
||||
>var greetings = 0
|
||||
>:=> (line 1, col 0) to (line 1, col 17)
|
||||
--------------------------------
|
||||
2 >var greet = (greeting: string): number => {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (19 to 29) SpanInfo: {"start":19,"length":84}
|
||||
>var greet = (greeting: string): number => {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
>}
|
||||
>:=> (line 2, col 0) to (line 5, col 1)
|
||||
2 >var greet = (greeting: string): number => {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (30 to 62) SpanInfo: {"start":67,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 3, col 4) to (line 3, col 15)
|
||||
--------------------------------
|
||||
3 > greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (63 to 79) SpanInfo: {"start":67,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 3, col 4) to (line 3, col 15)
|
||||
--------------------------------
|
||||
4 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (80 to 101) SpanInfo: {"start":84,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 4, col 4) to (line 4, col 20)
|
||||
--------------------------------
|
||||
5 >}
|
||||
|
||||
~~ => Pos: (102 to 103) SpanInfo: {"start":102,"length":1}
|
||||
>}
|
||||
>:=> (line 5, col 0) to (line 5, col 1)
|
||||
--------------------------------
|
||||
6 >greet("Hello");
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (104 to 119) SpanInfo: {"start":104,"length":14}
|
||||
>greet("Hello")
|
||||
>:=> (line 6, col 0) to (line 6, col 14)
|
||||
--------------------------------
|
||||
7 >var incrGreetings = () => greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (120 to 138) SpanInfo: {"start":120,"length":37}
|
||||
>var incrGreetings = () => greetings++
|
||||
>:=> (line 7, col 0) to (line 7, col 37)
|
||||
7 >var incrGreetings = () => greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (139 to 158) SpanInfo: {"start":146,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 7, col 26) to (line 7, col 37)
|
||||
--------------------------------
|
||||
8 >var greetNewMsg = msg => greet(msg);
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (159 to 175) SpanInfo: {"start":159,"length":35}
|
||||
>var greetNewMsg = msg => greet(msg)
|
||||
>:=> (line 8, col 0) to (line 8, col 35)
|
||||
8 >var greetNewMsg = msg => greet(msg);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (176 to 195) SpanInfo: {"start":184,"length":10}
|
||||
>greet(msg)
|
||||
>:=> (line 8, col 25) to (line 8, col 35)
|
||||
--------------------------------
|
||||
9 >greetNewMsg = function (msg: string) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (196 to 208) SpanInfo: {"start":196,"length":63}
|
||||
>greetNewMsg = function (msg: string) {
|
||||
> return greet(msg);
|
||||
>}
|
||||
>:=> (line 9, col 0) to (line 11, col 1)
|
||||
9 >greetNewMsg = function (msg: string) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (209 to 234) SpanInfo: {"start":239,"length":17}
|
||||
>return greet(msg)
|
||||
>:=> (line 10, col 4) to (line 10, col 21)
|
||||
--------------------------------
|
||||
10 > return greet(msg);
|
||||
|
||||
~~~~~~~~~~ => Pos: (235 to 244) SpanInfo: {"start":239,"length":17}
|
||||
>return greet(msg)
|
||||
>:=> (line 10, col 4) to (line 10, col 21)
|
||||
10 > return greet(msg);
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (245 to 257) SpanInfo: {"start":246,"length":10}
|
||||
>greet(msg)
|
||||
>:=> (line 10, col 11) to (line 10, col 21)
|
||||
--------------------------------
|
||||
11 >};
|
||||
|
||||
~~~ => Pos: (258 to 260) SpanInfo: {"start":258,"length":1}
|
||||
>}
|
||||
>:=> (line 11, col 0) to (line 11, col 1)
|
||||
--------------------------------
|
||||
12 >function bar(a = function foo() {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (261 to 273) SpanInfo: {"start":326,"length":9}
|
||||
>if (!a())
|
||||
>:=> (line 15, col 4) to (line 15, col 13)
|
||||
12 >function bar(a = function foo() {
|
||||
|
||||
~~~ => Pos: (274 to 276) SpanInfo: {"start":274,"length":44}
|
||||
>a = function foo() {
|
||||
> return greetings;
|
||||
>}
|
||||
>:=> (line 12, col 13) to (line 14, col 1)
|
||||
12 >function bar(a = function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (277 to 294) SpanInfo: {"start":299,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 13, col 4) to (line 13, col 20)
|
||||
--------------------------------
|
||||
13 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (295 to 316) SpanInfo: {"start":299,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 13, col 4) to (line 13, col 20)
|
||||
--------------------------------
|
||||
14 >}) {
|
||||
|
||||
~~ => Pos: (317 to 318) SpanInfo: {"start":317,"length":1}
|
||||
>}
|
||||
>:=> (line 14, col 0) to (line 14, col 1)
|
||||
14 >}) {
|
||||
|
||||
~~~ => Pos: (319 to 321) SpanInfo: {"start":326,"length":9}
|
||||
>if (!a())
|
||||
>:=> (line 15, col 4) to (line 15, col 13)
|
||||
--------------------------------
|
||||
15 > if (!a()) {
|
||||
|
||||
~~~~~~~~~ => Pos: (322 to 330) SpanInfo: {"start":326,"length":9}
|
||||
>if (!a())
|
||||
>:=> (line 15, col 4) to (line 15, col 13)
|
||||
15 > if (!a()) {
|
||||
|
||||
~~~ => Pos: (331 to 333) SpanInfo: {"start":331,"length":3}
|
||||
>a()
|
||||
>:=> (line 15, col 9) to (line 15, col 12)
|
||||
15 > if (!a()) {
|
||||
|
||||
~~~~ => Pos: (334 to 337) SpanInfo: {"start":326,"length":9}
|
||||
>if (!a())
|
||||
>:=> (line 15, col 4) to (line 15, col 13)
|
||||
--------------------------------
|
||||
16 > return a;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (338 to 355) SpanInfo: {"start":346,"length":8}
|
||||
>return a
|
||||
>:=> (line 16, col 8) to (line 16, col 16)
|
||||
--------------------------------
|
||||
17 > }
|
||||
|
||||
~~~~~~ => Pos: (356 to 361) SpanInfo: {"start":346,"length":8}
|
||||
>return a
|
||||
>:=> (line 16, col 8) to (line 16, col 16)
|
||||
--------------------------------
|
||||
18 > return function bar() {
|
||||
|
||||
~~~~~~~~~~ => Pos: (362 to 371) SpanInfo: {"start":366,"length":56}
|
||||
>return function bar() {
|
||||
> return -greetings;
|
||||
> }
|
||||
>:=> (line 18, col 4) to (line 20, col 5)
|
||||
18 > return function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (372 to 389) SpanInfo: {"start":398,"length":17}
|
||||
>return -greetings
|
||||
>:=> (line 19, col 8) to (line 19, col 25)
|
||||
--------------------------------
|
||||
19 > return -greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (390 to 416) SpanInfo: {"start":398,"length":17}
|
||||
>return -greetings
|
||||
>:=> (line 19, col 8) to (line 19, col 25)
|
||||
--------------------------------
|
||||
20 > };
|
||||
|
||||
~~~~~~~ => Pos: (417 to 423) SpanInfo: {"start":421,"length":1}
|
||||
>}
|
||||
>:=> (line 20, col 4) to (line 20, col 5)
|
||||
--------------------------------
|
||||
21 >}
|
||||
~ => Pos: (424 to 424) SpanInfo: {"start":424,"length":1}
|
||||
>}
|
||||
>:=> (line 21, col 0) to (line 21, col 1)
|
||||
372
tests/baselines/reference/bpSpan_functions.baseline
Normal file
372
tests/baselines/reference/bpSpan_functions.baseline
Normal file
@ -0,0 +1,372 @@
|
||||
|
||||
1 >var greetings = 0;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17}
|
||||
>var greetings = 0
|
||||
>:=> (line 1, col 0) to (line 1, col 17)
|
||||
--------------------------------
|
||||
2 >function greet(greeting: string): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (19 to 61) SpanInfo: {"start":66,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 3, col 4) to (line 3, col 15)
|
||||
--------------------------------
|
||||
3 > greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (62 to 78) SpanInfo: {"start":66,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 3, col 4) to (line 3, col 15)
|
||||
--------------------------------
|
||||
4 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (79 to 100) SpanInfo: {"start":83,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 4, col 4) to (line 4, col 20)
|
||||
--------------------------------
|
||||
5 >}
|
||||
|
||||
~~ => Pos: (101 to 102) SpanInfo: {"start":101,"length":1}
|
||||
>}
|
||||
>:=> (line 5, col 0) to (line 5, col 1)
|
||||
--------------------------------
|
||||
6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 135) SpanInfo: {"start":196,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 7, col 4) to (line 7, col 15)
|
||||
6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~=> Pos: (136 to 155) SpanInfo: {"start":137,"length":6}
|
||||
>n = 10
|
||||
>:=> (line 6, col 34) to (line 6, col 40)
|
||||
6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (156 to 188) SpanInfo: {"start":157,"length":23}
|
||||
>...restParams: string[]
|
||||
>:=> (line 6, col 54) to (line 6, col 77)
|
||||
6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~=> Pos: (189 to 191) SpanInfo: {"start":196,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 7, col 4) to (line 7, col 15)
|
||||
--------------------------------
|
||||
7 > greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (192 to 208) SpanInfo: {"start":196,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 7, col 4) to (line 7, col 15)
|
||||
--------------------------------
|
||||
8 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (209 to 230) SpanInfo: {"start":213,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 8, col 4) to (line 8, col 20)
|
||||
--------------------------------
|
||||
9 >}
|
||||
|
||||
~~ => Pos: (231 to 232) SpanInfo: {"start":231,"length":1}
|
||||
>}
|
||||
>:=> (line 9, col 0) to (line 9, col 1)
|
||||
--------------------------------
|
||||
10 >function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (233 to 262) SpanInfo: {"start":315,"length":6}
|
||||
>return
|
||||
>:=> (line 12, col 4) to (line 12, col 10)
|
||||
10 >function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~=> Pos: (263 to 282) SpanInfo: {"start":264,"length":6}
|
||||
>n = 10
|
||||
>:=> (line 10, col 31) to (line 10, col 37)
|
||||
10 >function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (283 to 308) SpanInfo: {"start":284,"length":23}
|
||||
>...restParams: string[]
|
||||
>:=> (line 10, col 51) to (line 10, col 74)
|
||||
--------------------------------
|
||||
11 >{
|
||||
|
||||
~~ => Pos: (309 to 310) SpanInfo: {"start":315,"length":6}
|
||||
>return
|
||||
>:=> (line 12, col 4) to (line 12, col 10)
|
||||
--------------------------------
|
||||
12 > return;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (311 to 322) SpanInfo: {"start":315,"length":6}
|
||||
>return
|
||||
>:=> (line 12, col 4) to (line 12, col 10)
|
||||
--------------------------------
|
||||
13 >}
|
||||
|
||||
~~ => Pos: (323 to 324) SpanInfo: {"start":323,"length":1}
|
||||
>}
|
||||
>:=> (line 13, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
14 >module m {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (325 to 335) SpanInfo: {"start":325,"length":389}
|
||||
>module m {
|
||||
> var greetings = 0;
|
||||
> function greet(greeting: string): number {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
> }
|
||||
> function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
> }
|
||||
> function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
> {
|
||||
> return;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 14, col 0) to (line 28, col 1)
|
||||
--------------------------------
|
||||
15 > var greetings = 0;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (336 to 358) SpanInfo: {"start":340,"length":17}
|
||||
>var greetings = 0
|
||||
>:=> (line 15, col 4) to (line 15, col 21)
|
||||
--------------------------------
|
||||
16 > function greet(greeting: string): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (359 to 405) SpanInfo: {"start":414,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 17, col 8) to (line 17, col 19)
|
||||
--------------------------------
|
||||
17 > greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (406 to 426) SpanInfo: {"start":414,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 17, col 8) to (line 17, col 19)
|
||||
--------------------------------
|
||||
18 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (427 to 452) SpanInfo: {"start":435,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 18, col 8) to (line 18, col 24)
|
||||
--------------------------------
|
||||
19 > }
|
||||
|
||||
~~~~~~ => Pos: (453 to 458) SpanInfo: {"start":457,"length":1}
|
||||
>}
|
||||
>:=> (line 19, col 4) to (line 19, col 5)
|
||||
--------------------------------
|
||||
20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (459 to 495) SpanInfo: {"start":560,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 21, col 8) to (line 21, col 19)
|
||||
20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~=> Pos: (496 to 515) SpanInfo: {"start":497,"length":6}
|
||||
>n = 10
|
||||
>:=> (line 20, col 38) to (line 20, col 44)
|
||||
20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (516 to 548) SpanInfo: {"start":517,"length":23}
|
||||
>...restParams: string[]
|
||||
>:=> (line 20, col 58) to (line 20, col 81)
|
||||
20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~=> Pos: (549 to 551) SpanInfo: {"start":560,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 21, col 8) to (line 21, col 19)
|
||||
--------------------------------
|
||||
21 > greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (552 to 572) SpanInfo: {"start":560,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 21, col 8) to (line 21, col 19)
|
||||
--------------------------------
|
||||
22 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (573 to 598) SpanInfo: {"start":581,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 22, col 8) to (line 22, col 24)
|
||||
--------------------------------
|
||||
23 > }
|
||||
|
||||
~~~~~~ => Pos: (599 to 604) SpanInfo: {"start":603,"length":1}
|
||||
>}
|
||||
>:=> (line 23, col 4) to (line 23, col 5)
|
||||
--------------------------------
|
||||
24 > function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (605 to 638) SpanInfo: {"start":699,"length":6}
|
||||
>return
|
||||
>:=> (line 26, col 8) to (line 26, col 14)
|
||||
24 > function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~=> Pos: (639 to 658) SpanInfo: {"start":640,"length":6}
|
||||
>n = 10
|
||||
>:=> (line 24, col 35) to (line 24, col 41)
|
||||
24 > function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (659 to 684) SpanInfo: {"start":660,"length":23}
|
||||
>...restParams: string[]
|
||||
>:=> (line 24, col 55) to (line 24, col 78)
|
||||
--------------------------------
|
||||
25 > {
|
||||
|
||||
~~~~~~ => Pos: (685 to 690) SpanInfo: {"start":699,"length":6}
|
||||
>return
|
||||
>:=> (line 26, col 8) to (line 26, col 14)
|
||||
--------------------------------
|
||||
26 > return;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (691 to 706) SpanInfo: {"start":699,"length":6}
|
||||
>return
|
||||
>:=> (line 26, col 8) to (line 26, col 14)
|
||||
--------------------------------
|
||||
27 > }
|
||||
|
||||
~~~~~~ => Pos: (707 to 712) SpanInfo: {"start":711,"length":1}
|
||||
>}
|
||||
>:=> (line 27, col 4) to (line 27, col 5)
|
||||
--------------------------------
|
||||
28 >}
|
||||
|
||||
~~ => Pos: (713 to 714) SpanInfo: {"start":713,"length":1}
|
||||
>}
|
||||
>:=> (line 28, col 0) to (line 28, col 1)
|
||||
--------------------------------
|
||||
29 >module m1 {
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (715 to 726) SpanInfo: {"start":715,"length":411}
|
||||
>module m1 {
|
||||
> var greetings = 0;
|
||||
> export function greet(greeting: string): number {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
> }
|
||||
> export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
> }
|
||||
> export function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
> {
|
||||
> return;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 29, col 0) to (line 43, col 1)
|
||||
--------------------------------
|
||||
30 > var greetings = 0;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (727 to 749) SpanInfo: {"start":731,"length":17}
|
||||
>var greetings = 0
|
||||
>:=> (line 30, col 4) to (line 30, col 21)
|
||||
--------------------------------
|
||||
31 > export function greet(greeting: string): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (750 to 803) SpanInfo: {"start":754,"length":102}
|
||||
>export function greet(greeting: string): number {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
> }
|
||||
>:=> (line 31, col 4) to (line 34, col 5)
|
||||
--------------------------------
|
||||
32 > greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (804 to 824) SpanInfo: {"start":812,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 32, col 8) to (line 32, col 19)
|
||||
--------------------------------
|
||||
33 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (825 to 850) SpanInfo: {"start":833,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 33, col 8) to (line 33, col 24)
|
||||
--------------------------------
|
||||
34 > }
|
||||
|
||||
~~~~~~ => Pos: (851 to 856) SpanInfo: {"start":855,"length":1}
|
||||
>}
|
||||
>:=> (line 34, col 4) to (line 34, col 5)
|
||||
--------------------------------
|
||||
35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (857 to 900) SpanInfo: {"start":861,"length":148}
|
||||
>export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
> }
|
||||
>:=> (line 35, col 4) to (line 38, col 5)
|
||||
35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~=> Pos: (901 to 920) SpanInfo: {"start":902,"length":6}
|
||||
>n = 10
|
||||
>:=> (line 35, col 45) to (line 35, col 51)
|
||||
35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (921 to 953) SpanInfo: {"start":922,"length":23}
|
||||
>...restParams: string[]
|
||||
>:=> (line 35, col 65) to (line 35, col 88)
|
||||
35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
|
||||
~~~=> Pos: (954 to 956) SpanInfo: {"start":861,"length":148}
|
||||
>export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number {
|
||||
> greetings++;
|
||||
> return greetings;
|
||||
> }
|
||||
>:=> (line 35, col 4) to (line 38, col 5)
|
||||
--------------------------------
|
||||
36 > greetings++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (957 to 977) SpanInfo: {"start":965,"length":11}
|
||||
>greetings++
|
||||
>:=> (line 36, col 8) to (line 36, col 19)
|
||||
--------------------------------
|
||||
37 > return greetings;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (978 to 1003) SpanInfo: {"start":986,"length":16}
|
||||
>return greetings
|
||||
>:=> (line 37, col 8) to (line 37, col 24)
|
||||
--------------------------------
|
||||
38 > }
|
||||
|
||||
~~~~~~ => Pos: (1004 to 1009) SpanInfo: {"start":1008,"length":1}
|
||||
>}
|
||||
>:=> (line 38, col 4) to (line 38, col 5)
|
||||
--------------------------------
|
||||
39 > export function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1010 to 1050) SpanInfo: {"start":1014,"length":110}
|
||||
>export function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
> {
|
||||
> return;
|
||||
> }
|
||||
>:=> (line 39, col 4) to (line 42, col 5)
|
||||
39 > export function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~=> Pos: (1051 to 1070) SpanInfo: {"start":1052,"length":6}
|
||||
>n = 10
|
||||
>:=> (line 39, col 42) to (line 39, col 48)
|
||||
39 > export function foo(greeting: string, n = 10, x?: string, ...restParams: string[])
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1071 to 1096) SpanInfo: {"start":1072,"length":23}
|
||||
>...restParams: string[]
|
||||
>:=> (line 39, col 62) to (line 39, col 85)
|
||||
--------------------------------
|
||||
40 > {
|
||||
|
||||
~~~~~~ => Pos: (1097 to 1102) SpanInfo: {"start":1111,"length":6}
|
||||
>return
|
||||
>:=> (line 41, col 8) to (line 41, col 14)
|
||||
--------------------------------
|
||||
41 > return;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (1103 to 1118) SpanInfo: {"start":1111,"length":6}
|
||||
>return
|
||||
>:=> (line 41, col 8) to (line 41, col 14)
|
||||
--------------------------------
|
||||
42 > }
|
||||
|
||||
~~~~~~ => Pos: (1119 to 1124) SpanInfo: {"start":1123,"length":1}
|
||||
>}
|
||||
>:=> (line 42, col 4) to (line 42, col 5)
|
||||
--------------------------------
|
||||
43 >}
|
||||
~ => Pos: (1125 to 1125) SpanInfo: {"start":1125,"length":1}
|
||||
>}
|
||||
>:=> (line 43, col 0) to (line 43, col 1)
|
||||
166
tests/baselines/reference/bpSpan_ifElse.baseline
Normal file
166
tests/baselines/reference/bpSpan_ifElse.baseline
Normal file
@ -0,0 +1,166 @@
|
||||
|
||||
1 >var i = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var i = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >if (i == 10) {
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (12 to 26) SpanInfo: {"start":12,"length":12}
|
||||
>if (i == 10)
|
||||
>:=> (line 2, col 0) to (line 2, col 12)
|
||||
--------------------------------
|
||||
3 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (27 to 35) SpanInfo: {"start":31,"length":3}
|
||||
>i++
|
||||
>:=> (line 3, col 4) to (line 3, col 7)
|
||||
--------------------------------
|
||||
4 >} else
|
||||
|
||||
~ => Pos: (36 to 36) SpanInfo: {"start":31,"length":3}
|
||||
>i++
|
||||
>:=> (line 3, col 4) to (line 3, col 7)
|
||||
4 >} else
|
||||
|
||||
~~~~~~ => Pos: (37 to 42) SpanInfo: undefined
|
||||
--------------------------------
|
||||
5 >{
|
||||
|
||||
~~ => Pos: (43 to 44) SpanInfo: undefined
|
||||
--------------------------------
|
||||
6 >}
|
||||
|
||||
~~ => Pos: (45 to 46) SpanInfo: undefined
|
||||
--------------------------------
|
||||
7 >if (i == 10)
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (47 to 59) SpanInfo: {"start":47,"length":12}
|
||||
>if (i == 10)
|
||||
>:=> (line 7, col 0) to (line 7, col 12)
|
||||
--------------------------------
|
||||
8 >{
|
||||
|
||||
~~ => Pos: (60 to 61) SpanInfo: {"start":66,"length":3}
|
||||
>i++
|
||||
>:=> (line 9, col 4) to (line 9, col 7)
|
||||
--------------------------------
|
||||
9 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (62 to 70) SpanInfo: {"start":66,"length":3}
|
||||
>i++
|
||||
>:=> (line 9, col 4) to (line 9, col 7)
|
||||
--------------------------------
|
||||
10 >}
|
||||
|
||||
~~ => Pos: (71 to 72) SpanInfo: {"start":66,"length":3}
|
||||
>i++
|
||||
>:=> (line 9, col 4) to (line 9, col 7)
|
||||
--------------------------------
|
||||
11 >else if (i == 20) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (73 to 92) SpanInfo: {"start":78,"length":12}
|
||||
>if (i == 20)
|
||||
>:=> (line 11, col 5) to (line 11, col 17)
|
||||
--------------------------------
|
||||
12 > i--;
|
||||
|
||||
~~~~~~~~~ => Pos: (93 to 101) SpanInfo: {"start":97,"length":3}
|
||||
>i--
|
||||
>:=> (line 12, col 4) to (line 12, col 7)
|
||||
--------------------------------
|
||||
13 >} else if (i == 30) {
|
||||
|
||||
~ => Pos: (102 to 102) SpanInfo: {"start":97,"length":3}
|
||||
>i--
|
||||
>:=> (line 12, col 4) to (line 12, col 7)
|
||||
13 >} else if (i == 30) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 123) SpanInfo: {"start":109,"length":12}
|
||||
>if (i == 30)
|
||||
>:=> (line 13, col 7) to (line 13, col 19)
|
||||
--------------------------------
|
||||
14 > i += 70;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (124 to 136) SpanInfo: {"start":128,"length":7}
|
||||
>i += 70
|
||||
>:=> (line 14, col 4) to (line 14, col 11)
|
||||
--------------------------------
|
||||
15 >} else {
|
||||
|
||||
~ => Pos: (137 to 137) SpanInfo: {"start":128,"length":7}
|
||||
>i += 70
|
||||
>:=> (line 14, col 4) to (line 14, col 11)
|
||||
15 >} else {
|
||||
|
||||
~~~~~~~~ => Pos: (138 to 145) SpanInfo: {"start":150,"length":3}
|
||||
>i--
|
||||
>:=> (line 16, col 4) to (line 16, col 7)
|
||||
--------------------------------
|
||||
16 > i--;
|
||||
|
||||
~~~~~~~~~ => Pos: (146 to 154) SpanInfo: {"start":150,"length":3}
|
||||
>i--
|
||||
>:=> (line 16, col 4) to (line 16, col 7)
|
||||
--------------------------------
|
||||
17 >}
|
||||
|
||||
~~ => Pos: (155 to 156) SpanInfo: {"start":150,"length":3}
|
||||
>i--
|
||||
>:=> (line 16, col 4) to (line 16, col 7)
|
||||
--------------------------------
|
||||
18 >if (function foo() {
|
||||
|
||||
~~~~ => Pos: (157 to 160) SpanInfo: {"start":157,"length":41}
|
||||
>if (function foo() {
|
||||
> return 30;
|
||||
>} ())
|
||||
>:=> (line 18, col 0) to (line 20, col 5)
|
||||
18 >if (function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (161 to 177) SpanInfo: {"start":182,"length":9}
|
||||
>return 30
|
||||
>:=> (line 19, col 4) to (line 19, col 13)
|
||||
--------------------------------
|
||||
19 > return 30;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (178 to 192) SpanInfo: {"start":182,"length":9}
|
||||
>return 30
|
||||
>:=> (line 19, col 4) to (line 19, col 13)
|
||||
--------------------------------
|
||||
20 >} ()) {
|
||||
|
||||
~ => Pos: (193 to 193) SpanInfo: {"start":193,"length":1}
|
||||
>}
|
||||
>:=> (line 20, col 0) to (line 20, col 1)
|
||||
20 >} ()) {
|
||||
|
||||
~~~ => Pos: (194 to 196) SpanInfo: {"start":161,"length":36}
|
||||
>function foo() {
|
||||
> return 30;
|
||||
>} ()
|
||||
>:=> (line 18, col 4) to (line 20, col 4)
|
||||
20 >} ()) {
|
||||
|
||||
~ => Pos: (197 to 197) SpanInfo: {"start":157,"length":41}
|
||||
>if (function foo() {
|
||||
> return 30;
|
||||
>} ())
|
||||
>:=> (line 18, col 0) to (line 20, col 5)
|
||||
20 >} ()) {
|
||||
|
||||
~~~ => Pos: (198 to 200) SpanInfo: {"start":205,"length":3}
|
||||
>i++
|
||||
>:=> (line 21, col 4) to (line 21, col 7)
|
||||
--------------------------------
|
||||
21 > i++;
|
||||
|
||||
~~~~~~~~~ => Pos: (201 to 209) SpanInfo: {"start":205,"length":3}
|
||||
>i++
|
||||
>:=> (line 21, col 4) to (line 21, col 7)
|
||||
--------------------------------
|
||||
22 >}
|
||||
~ => Pos: (210 to 210) SpanInfo: {"start":205,"length":3}
|
||||
>i++
|
||||
>:=> (line 21, col 4) to (line 21, col 7)
|
||||
60
tests/baselines/reference/bpSpan_import.baseline
Normal file
60
tests/baselines/reference/bpSpan_import.baseline
Normal file
@ -0,0 +1,60 @@
|
||||
|
||||
1 >module m {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: {"start":0,"length":32}
|
||||
>module m {
|
||||
> class c {
|
||||
> }
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 4, col 1)
|
||||
--------------------------------
|
||||
2 > class c {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (11 to 24) SpanInfo: {"start":15,"length":15}
|
||||
>class c {
|
||||
> }
|
||||
>:=> (line 2, col 4) to (line 3, col 5)
|
||||
--------------------------------
|
||||
3 > }
|
||||
|
||||
~~~~~~ => Pos: (25 to 30) SpanInfo: {"start":29,"length":1}
|
||||
>}
|
||||
>:=> (line 3, col 4) to (line 3, col 5)
|
||||
--------------------------------
|
||||
4 >}
|
||||
|
||||
~~ => Pos: (31 to 32) SpanInfo: {"start":31,"length":1}
|
||||
>}
|
||||
>:=> (line 4, col 0) to (line 4, col 1)
|
||||
--------------------------------
|
||||
5 >import a = m.c;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (33 to 48) SpanInfo: {"start":33,"length":14}
|
||||
>import a = m.c
|
||||
>:=> (line 5, col 0) to (line 5, col 14)
|
||||
--------------------------------
|
||||
6 >export import b = m.c;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (49 to 71) SpanInfo: {"start":49,"length":21}
|
||||
>export import b = m.c
|
||||
>:=> (line 6, col 0) to (line 6, col 21)
|
||||
--------------------------------
|
||||
7 >var x = new a();
|
||||
|
||||
~~~~~~~ => Pos: (72 to 78) SpanInfo: {"start":72,"length":15}
|
||||
>var x = new a()
|
||||
>:=> (line 7, col 0) to (line 7, col 15)
|
||||
7 >var x = new a();
|
||||
|
||||
~~~~~~~~~~ => Pos: (79 to 88) SpanInfo: {"start":80,"length":7}
|
||||
>new a()
|
||||
>:=> (line 7, col 8) to (line 7, col 15)
|
||||
--------------------------------
|
||||
8 >var y = new b();
|
||||
~~~~~~~ => Pos: (89 to 95) SpanInfo: {"start":89,"length":15}
|
||||
>var y = new b()
|
||||
>:=> (line 8, col 0) to (line 8, col 15)
|
||||
8 >var y = new b();
|
||||
~~~~~~~~~ => Pos: (96 to 104) SpanInfo: {"start":97,"length":7}
|
||||
>new b()
|
||||
>:=> (line 8, col 8) to (line 8, col 15)
|
||||
15
tests/baselines/reference/bpSpan_inBlankLine.baseline
Normal file
15
tests/baselines/reference/bpSpan_inBlankLine.baseline
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
1 >var x = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >
|
||||
|
||||
~ => Pos: (12 to 12) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 >var y = 10;
|
||||
~~~~~~~~~~~ => Pos: (13 to 23) SpanInfo: {"start":13,"length":10}
|
||||
>var y = 10
|
||||
>:=> (line 3, col 0) to (line 3, col 10)
|
||||
19
tests/baselines/reference/bpSpan_inComments.baseline
Normal file
19
tests/baselines/reference/bpSpan_inComments.baseline
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
1 >/*comment here*/ var x = 10; /*comment here*/
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (0 to 45) SpanInfo: {"start":17,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 1, col 17) to (line 1, col 27)
|
||||
--------------------------------
|
||||
2 >// comment only line
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (46 to 66) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 >/*multiline comment
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (67 to 86) SpanInfo: undefined
|
||||
--------------------------------
|
||||
4 >another line of multiline comment */ var y = 10; // comment here
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (87 to 150) SpanInfo: {"start":124,"length":10}
|
||||
>var y = 10
|
||||
>:=> (line 4, col 37) to (line 4, col 47)
|
||||
91
tests/baselines/reference/bpSpan_interface.baseline
Normal file
91
tests/baselines/reference/bpSpan_interface.baseline
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
1 >interface I {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (0 to 13) SpanInfo: undefined
|
||||
--------------------------------
|
||||
2 > property: string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (14 to 35) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 > method(): number;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 57) SpanInfo: undefined
|
||||
--------------------------------
|
||||
4 > (a: string): string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (58 to 82) SpanInfo: undefined
|
||||
--------------------------------
|
||||
5 > new (a: string): I;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (83 to 106) SpanInfo: undefined
|
||||
--------------------------------
|
||||
6 > [a: number]: number;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 131) SpanInfo: undefined
|
||||
--------------------------------
|
||||
7 >}
|
||||
|
||||
~~ => Pos: (132 to 133) SpanInfo: undefined
|
||||
--------------------------------
|
||||
8 >module m {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (134 to 144) SpanInfo: undefined
|
||||
--------------------------------
|
||||
9 > interface I1 {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (145 to 163) SpanInfo: undefined
|
||||
--------------------------------
|
||||
10 > property: string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (164 to 189) SpanInfo: undefined
|
||||
--------------------------------
|
||||
11 > method(): number;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (190 to 215) SpanInfo: undefined
|
||||
--------------------------------
|
||||
12 > (a: string): string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (216 to 244) SpanInfo: undefined
|
||||
--------------------------------
|
||||
13 > new (a: string): I;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (245 to 272) SpanInfo: undefined
|
||||
--------------------------------
|
||||
14 > [a: number]: number;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (273 to 301) SpanInfo: undefined
|
||||
--------------------------------
|
||||
15 > }
|
||||
|
||||
~~~~~~ => Pos: (302 to 307) SpanInfo: undefined
|
||||
--------------------------------
|
||||
16 > export interface I2 {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (308 to 333) SpanInfo: undefined
|
||||
--------------------------------
|
||||
17 > property: string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (334 to 359) SpanInfo: undefined
|
||||
--------------------------------
|
||||
18 > method(): number;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (360 to 385) SpanInfo: undefined
|
||||
--------------------------------
|
||||
19 > (a: string): string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (386 to 414) SpanInfo: undefined
|
||||
--------------------------------
|
||||
20 > new (a: string): I;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (415 to 442) SpanInfo: undefined
|
||||
--------------------------------
|
||||
21 > [a: number]: number;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (443 to 471) SpanInfo: undefined
|
||||
--------------------------------
|
||||
22 > }
|
||||
|
||||
~~~~~~ => Pos: (472 to 477) SpanInfo: undefined
|
||||
--------------------------------
|
||||
23 >}
|
||||
~ => Pos: (478 to 478) SpanInfo: undefined
|
||||
11
tests/baselines/reference/bpSpan_labeled.baseline
Normal file
11
tests/baselines/reference/bpSpan_labeled.baseline
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
1 >x:
|
||||
|
||||
~~~ => Pos: (0 to 2) SpanInfo: {"start":3,"length":10}
|
||||
>var b = 10
|
||||
>:=> (line 2, col 0) to (line 2, col 10)
|
||||
--------------------------------
|
||||
2 >var b = 10;
|
||||
~~~~~~~~~~~ => Pos: (3 to 13) SpanInfo: {"start":3,"length":10}
|
||||
>var b = 10
|
||||
>:=> (line 2, col 0) to (line 2, col 10)
|
||||
234
tests/baselines/reference/bpSpan_module.baseline
Normal file
234
tests/baselines/reference/bpSpan_module.baseline
Normal file
@ -0,0 +1,234 @@
|
||||
|
||||
1 >module m2 {
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":38}
|
||||
>module m2 {
|
||||
> var a = 10;
|
||||
> a++;
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 4, col 1)
|
||||
--------------------------------
|
||||
2 > var a = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (12 to 27) SpanInfo: {"start":16,"length":10}
|
||||
>var a = 10
|
||||
>:=> (line 2, col 4) to (line 2, col 14)
|
||||
--------------------------------
|
||||
3 > a++;
|
||||
|
||||
~~~~~~~~~ => Pos: (28 to 36) SpanInfo: {"start":32,"length":3}
|
||||
>a++
|
||||
>:=> (line 3, col 4) to (line 3, col 7)
|
||||
--------------------------------
|
||||
4 >}
|
||||
|
||||
~~ => Pos: (37 to 38) SpanInfo: {"start":37,"length":1}
|
||||
>}
|
||||
>:=> (line 4, col 0) to (line 4, col 1)
|
||||
--------------------------------
|
||||
5 >module m3 {
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (39 to 50) SpanInfo: {"start":39,"length":118}
|
||||
>module m3 {
|
||||
> module m4 {
|
||||
> export var x = 30;
|
||||
> }
|
||||
>
|
||||
> export function foo() {
|
||||
> return m4.x;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 5, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
6 > module m4 {
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (51 to 66) SpanInfo: {"start":55,"length":44}
|
||||
>module m4 {
|
||||
> export var x = 30;
|
||||
> }
|
||||
>:=> (line 6, col 4) to (line 8, col 5)
|
||||
--------------------------------
|
||||
7 > export var x = 30;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (67 to 93) SpanInfo: {"start":75,"length":17}
|
||||
>export var x = 30
|
||||
>:=> (line 7, col 8) to (line 7, col 25)
|
||||
--------------------------------
|
||||
8 > }
|
||||
|
||||
~~~~~~ => Pos: (94 to 99) SpanInfo: {"start":98,"length":1}
|
||||
>}
|
||||
>:=> (line 8, col 4) to (line 8, col 5)
|
||||
--------------------------------
|
||||
9 >
|
||||
|
||||
~ => Pos: (100 to 100) SpanInfo: undefined
|
||||
--------------------------------
|
||||
10 > export function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (101 to 128) SpanInfo: {"start":105,"length":50}
|
||||
>export function foo() {
|
||||
> return m4.x;
|
||||
> }
|
||||
>:=> (line 10, col 4) to (line 12, col 5)
|
||||
--------------------------------
|
||||
11 > return m4.x;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (129 to 149) SpanInfo: {"start":137,"length":11}
|
||||
>return m4.x
|
||||
>:=> (line 11, col 8) to (line 11, col 19)
|
||||
--------------------------------
|
||||
12 > }
|
||||
|
||||
~~~~~~ => Pos: (150 to 155) SpanInfo: {"start":154,"length":1}
|
||||
>}
|
||||
>:=> (line 12, col 4) to (line 12, col 5)
|
||||
--------------------------------
|
||||
13 >}
|
||||
|
||||
~~ => Pos: (156 to 157) SpanInfo: {"start":156,"length":1}
|
||||
>}
|
||||
>:=> (line 13, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
14 >module m4 {
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (158 to 169) SpanInfo: undefined
|
||||
--------------------------------
|
||||
15 > interface I { }
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (170 to 189) SpanInfo: undefined
|
||||
--------------------------------
|
||||
16 >}
|
||||
|
||||
~~ => Pos: (190 to 191) SpanInfo: undefined
|
||||
--------------------------------
|
||||
17 >module m12
|
||||
|
||||
~~~~~~~~~~~ => Pos: (192 to 202) SpanInfo: {"start":192,"length":39}
|
||||
>module m12
|
||||
>{
|
||||
> var a = 10;
|
||||
> a++;
|
||||
>}
|
||||
>:=> (line 17, col 0) to (line 21, col 1)
|
||||
--------------------------------
|
||||
18 >{
|
||||
|
||||
~~ => Pos: (203 to 204) SpanInfo: {"start":209,"length":10}
|
||||
>var a = 10
|
||||
>:=> (line 19, col 4) to (line 19, col 14)
|
||||
--------------------------------
|
||||
19 > var a = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (205 to 220) SpanInfo: {"start":209,"length":10}
|
||||
>var a = 10
|
||||
>:=> (line 19, col 4) to (line 19, col 14)
|
||||
--------------------------------
|
||||
20 > a++;
|
||||
|
||||
~~~~~~~~~ => Pos: (221 to 229) SpanInfo: {"start":225,"length":3}
|
||||
>a++
|
||||
>:=> (line 20, col 4) to (line 20, col 7)
|
||||
--------------------------------
|
||||
21 >}
|
||||
|
||||
~~ => Pos: (230 to 231) SpanInfo: {"start":230,"length":1}
|
||||
>}
|
||||
>:=> (line 21, col 0) to (line 21, col 1)
|
||||
--------------------------------
|
||||
22 >module m13
|
||||
|
||||
~~~~~~~~~~~ => Pos: (232 to 242) SpanInfo: {"start":232,"length":125}
|
||||
>module m13
|
||||
>{
|
||||
> module m14
|
||||
> {
|
||||
> export var x = 30;
|
||||
> }
|
||||
>
|
||||
> export function foo() {
|
||||
> return m4.x;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 22, col 0) to (line 32, col 1)
|
||||
--------------------------------
|
||||
23 >{
|
||||
|
||||
~~ => Pos: (243 to 244) SpanInfo: {"start":249,"length":50}
|
||||
>module m14
|
||||
> {
|
||||
> export var x = 30;
|
||||
> }
|
||||
>:=> (line 24, col 4) to (line 27, col 5)
|
||||
--------------------------------
|
||||
24 > module m14
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (245 to 260) SpanInfo: {"start":249,"length":50}
|
||||
>module m14
|
||||
> {
|
||||
> export var x = 30;
|
||||
> }
|
||||
>:=> (line 24, col 4) to (line 27, col 5)
|
||||
--------------------------------
|
||||
25 > {
|
||||
|
||||
~~~~~~ => Pos: (261 to 266) SpanInfo: {"start":275,"length":17}
|
||||
>export var x = 30
|
||||
>:=> (line 26, col 8) to (line 26, col 25)
|
||||
--------------------------------
|
||||
26 > export var x = 30;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (267 to 293) SpanInfo: {"start":275,"length":17}
|
||||
>export var x = 30
|
||||
>:=> (line 26, col 8) to (line 26, col 25)
|
||||
--------------------------------
|
||||
27 > }
|
||||
|
||||
~~~~~~ => Pos: (294 to 299) SpanInfo: {"start":298,"length":1}
|
||||
>}
|
||||
>:=> (line 27, col 4) to (line 27, col 5)
|
||||
--------------------------------
|
||||
28 >
|
||||
|
||||
~ => Pos: (300 to 300) SpanInfo: undefined
|
||||
--------------------------------
|
||||
29 > export function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (301 to 328) SpanInfo: {"start":305,"length":50}
|
||||
>export function foo() {
|
||||
> return m4.x;
|
||||
> }
|
||||
>:=> (line 29, col 4) to (line 31, col 5)
|
||||
--------------------------------
|
||||
30 > return m4.x;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (329 to 349) SpanInfo: {"start":337,"length":11}
|
||||
>return m4.x
|
||||
>:=> (line 30, col 8) to (line 30, col 19)
|
||||
--------------------------------
|
||||
31 > }
|
||||
|
||||
~~~~~~ => Pos: (350 to 355) SpanInfo: {"start":354,"length":1}
|
||||
>}
|
||||
>:=> (line 31, col 4) to (line 31, col 5)
|
||||
--------------------------------
|
||||
32 >}
|
||||
|
||||
~~ => Pos: (356 to 357) SpanInfo: {"start":356,"length":1}
|
||||
>}
|
||||
>:=> (line 32, col 0) to (line 32, col 1)
|
||||
--------------------------------
|
||||
33 >module m14
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (358 to 369) SpanInfo: undefined
|
||||
--------------------------------
|
||||
34 >{
|
||||
|
||||
~~ => Pos: (370 to 371) SpanInfo: undefined
|
||||
--------------------------------
|
||||
35 > interface I { }
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (372 to 391) SpanInfo: undefined
|
||||
--------------------------------
|
||||
36 >}
|
||||
~ => Pos: (392 to 392) SpanInfo: undefined
|
||||
19
tests/baselines/reference/bpSpan_moduleAmbient.baseline
Normal file
19
tests/baselines/reference/bpSpan_moduleAmbient.baseline
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
1 >declare module Bar {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 20) SpanInfo: undefined
|
||||
--------------------------------
|
||||
2 >}
|
||||
|
||||
~~ => Pos: (21 to 22) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 >declare module Foo {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 43) SpanInfo: undefined
|
||||
--------------------------------
|
||||
4 > var x;
|
||||
|
||||
~~~~~~~~~~~ => Pos: (44 to 54) SpanInfo: undefined
|
||||
--------------------------------
|
||||
5 >}
|
||||
~ => Pos: (55 to 55) SpanInfo: undefined
|
||||
7
tests/baselines/reference/bpSpan_moduleEmpty.baseline
Normal file
7
tests/baselines/reference/bpSpan_moduleEmpty.baseline
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
1 >module Bar {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (0 to 12) SpanInfo: undefined
|
||||
--------------------------------
|
||||
2 >}
|
||||
~ => Pos: (13 to 13) SpanInfo: undefined
|
||||
@ -0,0 +1,233 @@
|
||||
|
||||
1 >var x = {
|
||||
|
||||
~~~~~~~~~~ => Pos: (0 to 9) SpanInfo: {"start":0,"length":179}
|
||||
>var x = {
|
||||
> a: 10,
|
||||
> b: () => 10,
|
||||
> someMethod() {
|
||||
> return "Hello";
|
||||
> },
|
||||
> get y() {
|
||||
> return 30;
|
||||
> },
|
||||
> set z(x: number) {
|
||||
> var bar = x;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
2 > a: 10,
|
||||
|
||||
~~~~~~~~~~~ => Pos: (10 to 20) SpanInfo: {"start":0,"length":179}
|
||||
>var x = {
|
||||
> a: 10,
|
||||
> b: () => 10,
|
||||
> someMethod() {
|
||||
> return "Hello";
|
||||
> },
|
||||
> get y() {
|
||||
> return 30;
|
||||
> },
|
||||
> set z(x: number) {
|
||||
> var bar = x;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
3 > b: () => 10,
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (21 to 37) SpanInfo: {"start":34,"length":2}
|
||||
>10
|
||||
>:=> (line 3, col 13) to (line 3, col 15)
|
||||
--------------------------------
|
||||
4 > someMethod() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (38 to 56) SpanInfo: {"start":65,"length":14}
|
||||
>return "Hello"
|
||||
>:=> (line 5, col 8) to (line 5, col 22)
|
||||
--------------------------------
|
||||
5 > return "Hello";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (57 to 80) SpanInfo: {"start":65,"length":14}
|
||||
>return "Hello"
|
||||
>:=> (line 5, col 8) to (line 5, col 22)
|
||||
--------------------------------
|
||||
6 > },
|
||||
|
||||
~~~~~~~ => Pos: (81 to 87) SpanInfo: {"start":85,"length":1}
|
||||
>}
|
||||
>:=> (line 6, col 4) to (line 6, col 5)
|
||||
--------------------------------
|
||||
7 > get y() {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (88 to 101) SpanInfo: {"start":110,"length":9}
|
||||
>return 30
|
||||
>:=> (line 8, col 8) to (line 8, col 17)
|
||||
--------------------------------
|
||||
8 > return 30;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (102 to 120) SpanInfo: {"start":110,"length":9}
|
||||
>return 30
|
||||
>:=> (line 8, col 8) to (line 8, col 17)
|
||||
--------------------------------
|
||||
9 > },
|
||||
|
||||
~~~~~~~ => Pos: (121 to 127) SpanInfo: {"start":125,"length":1}
|
||||
>}
|
||||
>:=> (line 9, col 4) to (line 9, col 5)
|
||||
--------------------------------
|
||||
10 > set z(x: number) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (128 to 150) SpanInfo: {"start":159,"length":11}
|
||||
>var bar = x
|
||||
>:=> (line 11, col 8) to (line 11, col 19)
|
||||
--------------------------------
|
||||
11 > var bar = x;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (151 to 171) SpanInfo: {"start":159,"length":11}
|
||||
>var bar = x
|
||||
>:=> (line 11, col 8) to (line 11, col 19)
|
||||
--------------------------------
|
||||
12 > }
|
||||
|
||||
~~~~~~ => Pos: (172 to 177) SpanInfo: {"start":176,"length":1}
|
||||
>}
|
||||
>:=> (line 12, col 4) to (line 12, col 5)
|
||||
--------------------------------
|
||||
13 >};
|
||||
|
||||
~~~ => Pos: (178 to 180) SpanInfo: {"start":0,"length":179}
|
||||
>var x = {
|
||||
> a: 10,
|
||||
> b: () => 10,
|
||||
> someMethod() {
|
||||
> return "Hello";
|
||||
> },
|
||||
> get y() {
|
||||
> return 30;
|
||||
> },
|
||||
> set z(x: number) {
|
||||
> var bar = x;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
14 >var a = ({
|
||||
|
||||
~~~~~~~~~~~ => Pos: (181 to 191) SpanInfo: {"start":181,"length":192}
|
||||
>var a = ({
|
||||
> a: 10,
|
||||
> b: () => 10,
|
||||
> someMethod() {
|
||||
> return "Hello";
|
||||
> },
|
||||
> get y() {
|
||||
> return 30;
|
||||
> },
|
||||
> set z(x: number) {
|
||||
> var bar = x;
|
||||
> }
|
||||
>}).someMethod
|
||||
>:=> (line 14, col 0) to (line 26, col 13)
|
||||
--------------------------------
|
||||
15 > a: 10,
|
||||
|
||||
~~~~~~~~~~~ => Pos: (192 to 202) SpanInfo: {"start":181,"length":192}
|
||||
>var a = ({
|
||||
> a: 10,
|
||||
> b: () => 10,
|
||||
> someMethod() {
|
||||
> return "Hello";
|
||||
> },
|
||||
> get y() {
|
||||
> return 30;
|
||||
> },
|
||||
> set z(x: number) {
|
||||
> var bar = x;
|
||||
> }
|
||||
>}).someMethod
|
||||
>:=> (line 14, col 0) to (line 26, col 13)
|
||||
--------------------------------
|
||||
16 > b: () => 10,
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (203 to 219) SpanInfo: {"start":216,"length":2}
|
||||
>10
|
||||
>:=> (line 16, col 13) to (line 16, col 15)
|
||||
--------------------------------
|
||||
17 > someMethod() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (220 to 238) SpanInfo: {"start":247,"length":14}
|
||||
>return "Hello"
|
||||
>:=> (line 18, col 8) to (line 18, col 22)
|
||||
--------------------------------
|
||||
18 > return "Hello";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (239 to 262) SpanInfo: {"start":247,"length":14}
|
||||
>return "Hello"
|
||||
>:=> (line 18, col 8) to (line 18, col 22)
|
||||
--------------------------------
|
||||
19 > },
|
||||
|
||||
~~~~~~~ => Pos: (263 to 269) SpanInfo: {"start":267,"length":1}
|
||||
>}
|
||||
>:=> (line 19, col 4) to (line 19, col 5)
|
||||
--------------------------------
|
||||
20 > get y() {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (270 to 283) SpanInfo: {"start":292,"length":9}
|
||||
>return 30
|
||||
>:=> (line 21, col 8) to (line 21, col 17)
|
||||
--------------------------------
|
||||
21 > return 30;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (284 to 302) SpanInfo: {"start":292,"length":9}
|
||||
>return 30
|
||||
>:=> (line 21, col 8) to (line 21, col 17)
|
||||
--------------------------------
|
||||
22 > },
|
||||
|
||||
~~~~~~~ => Pos: (303 to 309) SpanInfo: {"start":307,"length":1}
|
||||
>}
|
||||
>:=> (line 22, col 4) to (line 22, col 5)
|
||||
--------------------------------
|
||||
23 > set z(x: number) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (310 to 332) SpanInfo: {"start":341,"length":11}
|
||||
>var bar = x
|
||||
>:=> (line 24, col 8) to (line 24, col 19)
|
||||
--------------------------------
|
||||
24 > var bar = x;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (333 to 353) SpanInfo: {"start":341,"length":11}
|
||||
>var bar = x
|
||||
>:=> (line 24, col 8) to (line 24, col 19)
|
||||
--------------------------------
|
||||
25 > }
|
||||
|
||||
~~~~~~ => Pos: (354 to 359) SpanInfo: {"start":358,"length":1}
|
||||
>}
|
||||
>:=> (line 25, col 4) to (line 25, col 5)
|
||||
--------------------------------
|
||||
26 >}).someMethod;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (360 to 374) SpanInfo: {"start":181,"length":192}
|
||||
>var a = ({
|
||||
> a: 10,
|
||||
> b: () => 10,
|
||||
> someMethod() {
|
||||
> return "Hello";
|
||||
> },
|
||||
> get y() {
|
||||
> return 30;
|
||||
> },
|
||||
> set z(x: number) {
|
||||
> var bar = x;
|
||||
> }
|
||||
>}).someMethod
|
||||
>:=> (line 14, col 0) to (line 26, col 13)
|
||||
--------------------------------
|
||||
27 >a();
|
||||
~~~~ => Pos: (375 to 378) SpanInfo: {"start":375,"length":3}
|
||||
>a()
|
||||
>:=> (line 27, col 0) to (line 27, col 3)
|
||||
@ -0,0 +1,364 @@
|
||||
|
||||
1 >function foo(a: number) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 25) SpanInfo: {"start":30,"length":8}
|
||||
>return a
|
||||
>:=> (line 2, col 4) to (line 2, col 12)
|
||||
--------------------------------
|
||||
2 > return a;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (26 to 39) SpanInfo: {"start":30,"length":8}
|
||||
>return a
|
||||
>:=> (line 2, col 4) to (line 2, col 12)
|
||||
--------------------------------
|
||||
3 >}
|
||||
|
||||
~~ => Pos: (40 to 41) SpanInfo: {"start":40,"length":1}
|
||||
>}
|
||||
>:=> (line 3, col 0) to (line 3, col 1)
|
||||
--------------------------------
|
||||
4 >foo((function bar() {
|
||||
|
||||
~~~~ => Pos: (42 to 45) SpanInfo: {"start":42,"length":47}
|
||||
>foo((function bar() {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 4, col 0) to (line 6, col 5)
|
||||
4 >foo((function bar() {
|
||||
|
||||
~ => Pos: (46 to 46) SpanInfo: {"start":46,"length":42}
|
||||
>(function bar() {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 4, col 4) to (line 6, col 4)
|
||||
4 >foo((function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (47 to 63) SpanInfo: {"start":68,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 5, col 4) to (line 5, col 18)
|
||||
--------------------------------
|
||||
5 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (64 to 73) SpanInfo: {"start":68,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 5, col 4) to (line 5, col 18)
|
||||
5 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (74 to 83) SpanInfo: {"start":75,"length":7}
|
||||
>foo(40)
|
||||
>:=> (line 5, col 11) to (line 5, col 18)
|
||||
--------------------------------
|
||||
6 >})());
|
||||
|
||||
~ => Pos: (84 to 84) SpanInfo: {"start":84,"length":1}
|
||||
>}
|
||||
>:=> (line 6, col 0) to (line 6, col 1)
|
||||
6 >})());
|
||||
|
||||
~~~ => Pos: (85 to 87) SpanInfo: {"start":46,"length":42}
|
||||
>(function bar() {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 4, col 4) to (line 6, col 4)
|
||||
6 >})());
|
||||
|
||||
~~~ => Pos: (88 to 90) SpanInfo: {"start":42,"length":47}
|
||||
>foo((function bar() {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 4, col 0) to (line 6, col 5)
|
||||
--------------------------------
|
||||
7 >var y = foo((function () {
|
||||
|
||||
~~~~~~~ => Pos: (91 to 97) SpanInfo: {"start":91,"length":52}
|
||||
>var y = foo((function () {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 7, col 0) to (line 9, col 5)
|
||||
7 >var y = foo((function () {
|
||||
|
||||
~~~~~ => Pos: (98 to 102) SpanInfo: {"start":99,"length":44}
|
||||
>foo((function () {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 7, col 8) to (line 9, col 5)
|
||||
7 >var y = foo((function () {
|
||||
|
||||
~ => Pos: (103 to 103) SpanInfo: {"start":103,"length":39}
|
||||
>(function () {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 7, col 12) to (line 9, col 4)
|
||||
7 >var y = foo((function () {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (104 to 117) SpanInfo: {"start":122,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 8, col 4) to (line 8, col 18)
|
||||
--------------------------------
|
||||
8 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (118 to 127) SpanInfo: {"start":122,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 8, col 4) to (line 8, col 18)
|
||||
8 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (128 to 137) SpanInfo: {"start":129,"length":7}
|
||||
>foo(40)
|
||||
>:=> (line 8, col 11) to (line 8, col 18)
|
||||
--------------------------------
|
||||
9 >})());;
|
||||
|
||||
~ => Pos: (138 to 138) SpanInfo: {"start":138,"length":1}
|
||||
>}
|
||||
>:=> (line 9, col 0) to (line 9, col 1)
|
||||
9 >})());;
|
||||
|
||||
~~~ => Pos: (139 to 141) SpanInfo: {"start":103,"length":39}
|
||||
>(function () {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 7, col 12) to (line 9, col 4)
|
||||
9 >})());;
|
||||
|
||||
~~~~ => Pos: (142 to 145) SpanInfo: {"start":99,"length":44}
|
||||
>foo((function () {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 7, col 8) to (line 9, col 5)
|
||||
--------------------------------
|
||||
10 >class greeter {
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (146 to 161) SpanInfo: {"start":146,"length":52}
|
||||
>class greeter {
|
||||
> constructor(a: number) {
|
||||
> }
|
||||
>}
|
||||
>:=> (line 10, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
11 > constructor(a: number) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 190) SpanInfo: {"start":195,"length":1}
|
||||
>}
|
||||
>:=> (line 12, col 4) to (line 12, col 5)
|
||||
--------------------------------
|
||||
12 > }
|
||||
|
||||
~~~~~~ => Pos: (191 to 196) SpanInfo: {"start":195,"length":1}
|
||||
>}
|
||||
>:=> (line 12, col 4) to (line 12, col 5)
|
||||
--------------------------------
|
||||
13 >}
|
||||
|
||||
~~ => Pos: (197 to 198) SpanInfo: {"start":197,"length":1}
|
||||
>}
|
||||
>:=> (line 13, col 0) to (line 13, col 1)
|
||||
--------------------------------
|
||||
14 >foo(30);
|
||||
|
||||
~~~~~~~~~ => Pos: (199 to 207) SpanInfo: {"start":199,"length":7}
|
||||
>foo(30)
|
||||
>:=> (line 14, col 0) to (line 14, col 7)
|
||||
--------------------------------
|
||||
15 >foo(40 + y);
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (208 to 220) SpanInfo: {"start":208,"length":11}
|
||||
>foo(40 + y)
|
||||
>:=> (line 15, col 0) to (line 15, col 11)
|
||||
--------------------------------
|
||||
16 >y = foo(30);
|
||||
|
||||
~~~ => Pos: (221 to 223) SpanInfo: {"start":221,"length":11}
|
||||
>y = foo(30)
|
||||
>:=> (line 16, col 0) to (line 16, col 11)
|
||||
16 >y = foo(30);
|
||||
|
||||
~~~~~~~~~~ => Pos: (224 to 233) SpanInfo: {"start":225,"length":7}
|
||||
>foo(30)
|
||||
>:=> (line 16, col 4) to (line 16, col 11)
|
||||
--------------------------------
|
||||
17 >y = foo(500 + y);
|
||||
|
||||
~~~ => Pos: (234 to 236) SpanInfo: {"start":234,"length":16}
|
||||
>y = foo(500 + y)
|
||||
>:=> (line 17, col 0) to (line 17, col 16)
|
||||
17 >y = foo(500 + y);
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (237 to 251) SpanInfo: {"start":238,"length":12}
|
||||
>foo(500 + y)
|
||||
>:=> (line 17, col 4) to (line 17, col 16)
|
||||
--------------------------------
|
||||
18 >new greeter((function bar() {
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (252 to 263) SpanInfo: {"start":252,"length":55}
|
||||
>new greeter((function bar() {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 18, col 0) to (line 20, col 5)
|
||||
18 >new greeter((function bar() {
|
||||
|
||||
~ => Pos: (264 to 264) SpanInfo: {"start":264,"length":42}
|
||||
>(function bar() {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 18, col 12) to (line 20, col 4)
|
||||
18 >new greeter((function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (265 to 281) SpanInfo: {"start":286,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 19, col 4) to (line 19, col 18)
|
||||
--------------------------------
|
||||
19 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (282 to 291) SpanInfo: {"start":286,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 19, col 4) to (line 19, col 18)
|
||||
19 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (292 to 301) SpanInfo: {"start":293,"length":7}
|
||||
>foo(40)
|
||||
>:=> (line 19, col 11) to (line 19, col 18)
|
||||
--------------------------------
|
||||
20 >})());
|
||||
|
||||
~ => Pos: (302 to 302) SpanInfo: {"start":302,"length":1}
|
||||
>}
|
||||
>:=> (line 20, col 0) to (line 20, col 1)
|
||||
20 >})());
|
||||
|
||||
~~~ => Pos: (303 to 305) SpanInfo: {"start":264,"length":42}
|
||||
>(function bar() {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 18, col 12) to (line 20, col 4)
|
||||
20 >})());
|
||||
|
||||
~~~ => Pos: (306 to 308) SpanInfo: {"start":252,"length":55}
|
||||
>new greeter((function bar() {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 18, col 0) to (line 20, col 5)
|
||||
--------------------------------
|
||||
21 >var anotherGreeter = new greeter((function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (309 to 328) SpanInfo: {"start":309,"length":76}
|
||||
>var anotherGreeter = new greeter((function bar() {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 21, col 0) to (line 23, col 5)
|
||||
21 >var anotherGreeter = new greeter((function bar() {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (329 to 341) SpanInfo: {"start":330,"length":55}
|
||||
>new greeter((function bar() {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 21, col 21) to (line 23, col 5)
|
||||
21 >var anotherGreeter = new greeter((function bar() {
|
||||
|
||||
~ => Pos: (342 to 342) SpanInfo: {"start":342,"length":42}
|
||||
>(function bar() {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 21, col 33) to (line 23, col 4)
|
||||
21 >var anotherGreeter = new greeter((function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~=> Pos: (343 to 359) SpanInfo: {"start":364,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 22, col 4) to (line 22, col 18)
|
||||
--------------------------------
|
||||
22 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (360 to 369) SpanInfo: {"start":364,"length":14}
|
||||
>return foo(40)
|
||||
>:=> (line 22, col 4) to (line 22, col 18)
|
||||
22 > return foo(40);
|
||||
|
||||
~~~~~~~~~~ => Pos: (370 to 379) SpanInfo: {"start":371,"length":7}
|
||||
>foo(40)
|
||||
>:=> (line 22, col 11) to (line 22, col 18)
|
||||
--------------------------------
|
||||
23 >})());
|
||||
|
||||
~ => Pos: (380 to 380) SpanInfo: {"start":380,"length":1}
|
||||
>}
|
||||
>:=> (line 23, col 0) to (line 23, col 1)
|
||||
23 >})());
|
||||
|
||||
~~~ => Pos: (381 to 383) SpanInfo: {"start":342,"length":42}
|
||||
>(function bar() {
|
||||
> return foo(40);
|
||||
>})()
|
||||
>:=> (line 21, col 33) to (line 23, col 4)
|
||||
23 >})());
|
||||
|
||||
~~~ => Pos: (384 to 386) SpanInfo: {"start":330,"length":55}
|
||||
>new greeter((function bar() {
|
||||
> return foo(40);
|
||||
>})())
|
||||
>:=> (line 21, col 21) to (line 23, col 5)
|
||||
--------------------------------
|
||||
24 >anotherGreeter = new greeter(30);
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (387 to 402) SpanInfo: {"start":387,"length":32}
|
||||
>anotherGreeter = new greeter(30)
|
||||
>:=> (line 24, col 0) to (line 24, col 32)
|
||||
24 >anotherGreeter = new greeter(30);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (403 to 420) SpanInfo: {"start":404,"length":15}
|
||||
>new greeter(30)
|
||||
>:=> (line 24, col 17) to (line 24, col 32)
|
||||
--------------------------------
|
||||
25 >anotherGreeter = new greeter(40 + y);
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (421 to 436) SpanInfo: {"start":421,"length":36}
|
||||
>anotherGreeter = new greeter(40 + y)
|
||||
>:=> (line 25, col 0) to (line 25, col 36)
|
||||
25 >anotherGreeter = new greeter(40 + y);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (437 to 458) SpanInfo: {"start":438,"length":19}
|
||||
>new greeter(40 + y)
|
||||
>:=> (line 25, col 17) to (line 25, col 36)
|
||||
--------------------------------
|
||||
26 >new greeter(30);
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (459 to 475) SpanInfo: {"start":459,"length":15}
|
||||
>new greeter(30)
|
||||
>:=> (line 26, col 0) to (line 26, col 15)
|
||||
--------------------------------
|
||||
27 >new greeter(40 + y);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (476 to 496) SpanInfo: {"start":476,"length":19}
|
||||
>new greeter(40 + y)
|
||||
>:=> (line 27, col 0) to (line 27, col 19)
|
||||
--------------------------------
|
||||
28 >function foo2(x: number, y: string) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (497 to 534) SpanInfo: {"start":535,"length":1}
|
||||
>}
|
||||
>:=> (line 29, col 0) to (line 29, col 1)
|
||||
--------------------------------
|
||||
29 >}
|
||||
|
||||
~~ => Pos: (535 to 536) SpanInfo: {"start":535,"length":1}
|
||||
>}
|
||||
>:=> (line 29, col 0) to (line 29, col 1)
|
||||
--------------------------------
|
||||
30 >foo2(foo(30), foo(40).toString());
|
||||
~~~~~ => Pos: (537 to 541) SpanInfo: {"start":537,"length":33}
|
||||
>foo2(foo(30), foo(40).toString())
|
||||
>:=> (line 30, col 0) to (line 30, col 33)
|
||||
30 >foo2(foo(30), foo(40).toString());
|
||||
~~~~~~~~ => Pos: (542 to 549) SpanInfo: {"start":542,"length":7}
|
||||
>foo(30)
|
||||
>:=> (line 30, col 5) to (line 30, col 12)
|
||||
30 >foo2(foo(30), foo(40).toString());
|
||||
~~~~~~~~ => Pos: (550 to 557) SpanInfo: {"start":551,"length":7}
|
||||
>foo(40)
|
||||
>:=> (line 30, col 14) to (line 30, col 21)
|
||||
30 >foo2(foo(30), foo(40).toString());
|
||||
~~~~~~~~~~~ => Pos: (558 to 568) SpanInfo: {"start":551,"length":18}
|
||||
>foo(40).toString()
|
||||
>:=> (line 30, col 14) to (line 30, col 32)
|
||||
30 >foo2(foo(30), foo(40).toString());
|
||||
~~ => Pos: (569 to 570) SpanInfo: {"start":537,"length":33}
|
||||
>foo2(foo(30), foo(40).toString())
|
||||
>:=> (line 30, col 0) to (line 30, col 33)
|
||||
572
tests/baselines/reference/bpSpan_stmts.baseline
Normal file
572
tests/baselines/reference/bpSpan_stmts.baseline
Normal file
@ -0,0 +1,572 @@
|
||||
|
||||
1 >function f() {
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (0 to 14) SpanInfo: undefined
|
||||
--------------------------------
|
||||
2 > var y;
|
||||
|
||||
~~~~~~~~~~~ => Pos: (15 to 25) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 > var x = 0;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (26 to 40) SpanInfo: {"start":30,"length":9}
|
||||
>var x = 0
|
||||
>:=> (line 3, col 4) to (line 3, col 13)
|
||||
--------------------------------
|
||||
4 > for (var i = 0; i < 10; i++) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (41 to 59) SpanInfo: {"start":50,"length":9}
|
||||
>var i = 0
|
||||
>:=> (line 4, col 9) to (line 4, col 18)
|
||||
4 > for (var i = 0; i < 10; i++) {
|
||||
|
||||
~~~~~~~~ => Pos: (60 to 67) SpanInfo: {"start":61,"length":6}
|
||||
>i < 10
|
||||
>:=> (line 4, col 20) to (line 4, col 26)
|
||||
4 > for (var i = 0; i < 10; i++) {
|
||||
|
||||
~~~~~~~~ => Pos: (68 to 75) SpanInfo: {"start":69,"length":3}
|
||||
>i++
|
||||
>:=> (line 4, col 28) to (line 4, col 31)
|
||||
--------------------------------
|
||||
5 > x += i;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (76 to 91) SpanInfo: {"start":84,"length":6}
|
||||
>x += i
|
||||
>:=> (line 5, col 8) to (line 5, col 14)
|
||||
--------------------------------
|
||||
6 > x *= 0;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (92 to 107) SpanInfo: {"start":100,"length":6}
|
||||
>x *= 0
|
||||
>:=> (line 6, col 8) to (line 6, col 14)
|
||||
--------------------------------
|
||||
7 > }
|
||||
|
||||
~~~~~~ => Pos: (108 to 113) SpanInfo: {"start":100,"length":6}
|
||||
>x *= 0
|
||||
>:=> (line 6, col 8) to (line 6, col 14)
|
||||
--------------------------------
|
||||
8 > if (x > 17) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (114 to 131) SpanInfo: {"start":118,"length":11}
|
||||
>if (x > 17)
|
||||
>:=> (line 8, col 4) to (line 8, col 15)
|
||||
--------------------------------
|
||||
9 > x /= 9;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (132 to 147) SpanInfo: {"start":140,"length":6}
|
||||
>x /= 9
|
||||
>:=> (line 9, col 8) to (line 9, col 14)
|
||||
--------------------------------
|
||||
10 > } else {
|
||||
|
||||
~~~~~ => Pos: (148 to 152) SpanInfo: {"start":140,"length":6}
|
||||
>x /= 9
|
||||
>:=> (line 9, col 8) to (line 9, col 14)
|
||||
10 > } else {
|
||||
|
||||
~~~~~~~~ => Pos: (153 to 160) SpanInfo: {"start":169,"length":7}
|
||||
>x += 10
|
||||
>:=> (line 11, col 8) to (line 11, col 15)
|
||||
--------------------------------
|
||||
11 > x += 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (161 to 177) SpanInfo: {"start":169,"length":7}
|
||||
>x += 10
|
||||
>:=> (line 11, col 8) to (line 11, col 15)
|
||||
--------------------------------
|
||||
12 > x++;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (178 to 190) SpanInfo: {"start":186,"length":3}
|
||||
>x++
|
||||
>:=> (line 12, col 8) to (line 12, col 11)
|
||||
--------------------------------
|
||||
13 > }
|
||||
|
||||
~~~~~~ => Pos: (191 to 196) SpanInfo: {"start":186,"length":3}
|
||||
>x++
|
||||
>:=> (line 12, col 8) to (line 12, col 11)
|
||||
--------------------------------
|
||||
14 > var a = [
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (197 to 210) SpanInfo: {"start":201,"length":47}
|
||||
>var a = [
|
||||
> 1,
|
||||
> 2,
|
||||
> 3
|
||||
> ]
|
||||
>:=> (line 14, col 4) to (line 18, col 5)
|
||||
--------------------------------
|
||||
15 > 1,
|
||||
|
||||
~~~~~~~~~~~ => Pos: (211 to 221) SpanInfo: {"start":201,"length":47}
|
||||
>var a = [
|
||||
> 1,
|
||||
> 2,
|
||||
> 3
|
||||
> ]
|
||||
>:=> (line 14, col 4) to (line 18, col 5)
|
||||
--------------------------------
|
||||
16 > 2,
|
||||
|
||||
~~~~~~~~~~~ => Pos: (222 to 232) SpanInfo: {"start":201,"length":47}
|
||||
>var a = [
|
||||
> 1,
|
||||
> 2,
|
||||
> 3
|
||||
> ]
|
||||
>:=> (line 14, col 4) to (line 18, col 5)
|
||||
--------------------------------
|
||||
17 > 3
|
||||
|
||||
~~~~~~~~~~ => Pos: (233 to 242) SpanInfo: {"start":201,"length":47}
|
||||
>var a = [
|
||||
> 1,
|
||||
> 2,
|
||||
> 3
|
||||
> ]
|
||||
>:=> (line 14, col 4) to (line 18, col 5)
|
||||
--------------------------------
|
||||
18 > ];
|
||||
|
||||
~~~~~~~ => Pos: (243 to 249) SpanInfo: {"start":201,"length":47}
|
||||
>var a = [
|
||||
> 1,
|
||||
> 2,
|
||||
> 3
|
||||
> ]
|
||||
>:=> (line 14, col 4) to (line 18, col 5)
|
||||
--------------------------------
|
||||
19 > var obj = {
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (250 to 265) SpanInfo: {"start":254,"length":50}
|
||||
>var obj = {
|
||||
> z: 1,
|
||||
> q: "hello"
|
||||
> }
|
||||
>:=> (line 19, col 4) to (line 22, col 5)
|
||||
--------------------------------
|
||||
20 > z: 1,
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (266 to 279) SpanInfo: {"start":254,"length":50}
|
||||
>var obj = {
|
||||
> z: 1,
|
||||
> q: "hello"
|
||||
> }
|
||||
>:=> (line 19, col 4) to (line 22, col 5)
|
||||
--------------------------------
|
||||
21 > q: "hello"
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (280 to 298) SpanInfo: {"start":254,"length":50}
|
||||
>var obj = {
|
||||
> z: 1,
|
||||
> q: "hello"
|
||||
> }
|
||||
>:=> (line 19, col 4) to (line 22, col 5)
|
||||
--------------------------------
|
||||
22 > };
|
||||
|
||||
~~~~~~~ => Pos: (299 to 305) SpanInfo: {"start":254,"length":50}
|
||||
>var obj = {
|
||||
> z: 1,
|
||||
> q: "hello"
|
||||
> }
|
||||
>:=> (line 19, col 4) to (line 22, col 5)
|
||||
--------------------------------
|
||||
23 > for (var j in a) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (306 to 328) SpanInfo: {"start":310,"length":16}
|
||||
>for (var j in a)
|
||||
>:=> (line 23, col 4) to (line 23, col 20)
|
||||
--------------------------------
|
||||
24 > obj.z = a[j];
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~ => Pos: (329 to 350) SpanInfo: {"start":337,"length":12}
|
||||
>obj.z = a[j]
|
||||
>:=> (line 24, col 8) to (line 24, col 20)
|
||||
--------------------------------
|
||||
25 > var v = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (351 to 370) SpanInfo: {"start":359,"length":10}
|
||||
>var v = 10
|
||||
>:=> (line 25, col 8) to (line 25, col 18)
|
||||
--------------------------------
|
||||
26 > }
|
||||
|
||||
~~~~~~ => Pos: (371 to 376) SpanInfo: {"start":359,"length":10}
|
||||
>var v = 10
|
||||
>:=> (line 25, col 8) to (line 25, col 18)
|
||||
--------------------------------
|
||||
27 > try {
|
||||
|
||||
~~~~~~~~~~ => Pos: (377 to 386) SpanInfo: {"start":395,"length":14}
|
||||
>obj.q = "ohhh"
|
||||
>:=> (line 28, col 8) to (line 28, col 22)
|
||||
--------------------------------
|
||||
28 > obj.q = "ohhh";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (387 to 410) SpanInfo: {"start":395,"length":14}
|
||||
>obj.q = "ohhh"
|
||||
>:=> (line 28, col 8) to (line 28, col 22)
|
||||
--------------------------------
|
||||
29 > } catch (e) {
|
||||
|
||||
~~~~~ => Pos: (411 to 415) SpanInfo: {"start":395,"length":14}
|
||||
>obj.q = "ohhh"
|
||||
>:=> (line 28, col 8) to (line 28, col 22)
|
||||
29 > } catch (e) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (416 to 428) SpanInfo: {"start":437,"length":15}
|
||||
>if (obj.z < 10)
|
||||
>:=> (line 30, col 8) to (line 30, col 23)
|
||||
--------------------------------
|
||||
30 > if (obj.z < 10) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (429 to 454) SpanInfo: {"start":437,"length":15}
|
||||
>if (obj.z < 10)
|
||||
>:=> (line 30, col 8) to (line 30, col 23)
|
||||
--------------------------------
|
||||
31 > obj.z = 12;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (455 to 478) SpanInfo: {"start":467,"length":10}
|
||||
>obj.z = 12
|
||||
>:=> (line 31, col 12) to (line 31, col 22)
|
||||
--------------------------------
|
||||
32 > } else {
|
||||
|
||||
~~~~~~~~~ => Pos: (479 to 487) SpanInfo: {"start":467,"length":10}
|
||||
>obj.z = 12
|
||||
>:=> (line 31, col 12) to (line 31, col 22)
|
||||
32 > } else {
|
||||
|
||||
~~~~~~~~ => Pos: (488 to 495) SpanInfo: {"start":508,"length":13}
|
||||
>obj.q = "hmm"
|
||||
>:=> (line 33, col 12) to (line 33, col 25)
|
||||
--------------------------------
|
||||
33 > obj.q = "hmm";
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (496 to 522) SpanInfo: {"start":508,"length":13}
|
||||
>obj.q = "hmm"
|
||||
>:=> (line 33, col 12) to (line 33, col 25)
|
||||
--------------------------------
|
||||
34 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (523 to 532) SpanInfo: {"start":508,"length":13}
|
||||
>obj.q = "hmm"
|
||||
>:=> (line 33, col 12) to (line 33, col 25)
|
||||
--------------------------------
|
||||
35 > }
|
||||
|
||||
~~~~~~ => Pos: (533 to 538) SpanInfo: {"start":437,"length":15}
|
||||
>if (obj.z < 10)
|
||||
>:=> (line 30, col 8) to (line 30, col 23)
|
||||
--------------------------------
|
||||
36 > try {
|
||||
|
||||
~~~~~~~~~~ => Pos: (539 to 548) SpanInfo: {"start":557,"length":17}
|
||||
>throw new Error()
|
||||
>:=> (line 37, col 8) to (line 37, col 25)
|
||||
--------------------------------
|
||||
37 > throw new Error();
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (549 to 561) SpanInfo: {"start":557,"length":17}
|
||||
>throw new Error()
|
||||
>:=> (line 37, col 8) to (line 37, col 25)
|
||||
37 > throw new Error();
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (562 to 575) SpanInfo: {"start":563,"length":11}
|
||||
>new Error()
|
||||
>:=> (line 37, col 14) to (line 37, col 25)
|
||||
--------------------------------
|
||||
38 > } catch (e1) {
|
||||
|
||||
~~~~~ => Pos: (576 to 580) SpanInfo: {"start":557,"length":17}
|
||||
>throw new Error()
|
||||
>:=> (line 37, col 8) to (line 37, col 25)
|
||||
38 > } catch (e1) {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (581 to 594) SpanInfo: {"start":603,"length":10}
|
||||
>var b = e1
|
||||
>:=> (line 39, col 8) to (line 39, col 18)
|
||||
--------------------------------
|
||||
39 > var b = e1;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (595 to 614) SpanInfo: {"start":603,"length":10}
|
||||
>var b = e1
|
||||
>:=> (line 39, col 8) to (line 39, col 18)
|
||||
--------------------------------
|
||||
40 > } finally {
|
||||
|
||||
~~~~~ => Pos: (615 to 619) SpanInfo: {"start":603,"length":10}
|
||||
>var b = e1
|
||||
>:=> (line 39, col 8) to (line 39, col 18)
|
||||
40 > } finally {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (620 to 630) SpanInfo: {"start":639,"length":6}
|
||||
>y = 70
|
||||
>:=> (line 41, col 8) to (line 41, col 14)
|
||||
--------------------------------
|
||||
41 > y = 70;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (631 to 646) SpanInfo: {"start":639,"length":6}
|
||||
>y = 70
|
||||
>:=> (line 41, col 8) to (line 41, col 14)
|
||||
--------------------------------
|
||||
42 > }
|
||||
|
||||
~~~~~~ => Pos: (647 to 652) SpanInfo: {"start":639,"length":6}
|
||||
>y = 70
|
||||
>:=> (line 41, col 8) to (line 41, col 14)
|
||||
--------------------------------
|
||||
43 > with (obj) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (653 to 669) SpanInfo: {"start":678,"length":5}
|
||||
>i = 2
|
||||
>:=> (line 44, col 8) to (line 44, col 13)
|
||||
--------------------------------
|
||||
44 > i = 2;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (670 to 684) SpanInfo: {"start":678,"length":5}
|
||||
>i = 2
|
||||
>:=> (line 44, col 8) to (line 44, col 13)
|
||||
--------------------------------
|
||||
45 > z = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (685 to 700) SpanInfo: {"start":693,"length":6}
|
||||
>z = 10
|
||||
>:=> (line 45, col 8) to (line 45, col 14)
|
||||
--------------------------------
|
||||
46 > }
|
||||
|
||||
~~~~~~ => Pos: (701 to 706) SpanInfo: {"start":693,"length":6}
|
||||
>z = 10
|
||||
>:=> (line 45, col 8) to (line 45, col 14)
|
||||
--------------------------------
|
||||
47 > switch (obj.z) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (707 to 727) SpanInfo: {"start":711,"length":14}
|
||||
>switch (obj.z)
|
||||
>:=> (line 47, col 4) to (line 47, col 18)
|
||||
--------------------------------
|
||||
48 > case 0: {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (728 to 745) SpanInfo: {"start":758,"length":3}
|
||||
>x++
|
||||
>:=> (line 49, col 12) to (line 49, col 15)
|
||||
--------------------------------
|
||||
49 > x++;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (746 to 762) SpanInfo: {"start":758,"length":3}
|
||||
>x++
|
||||
>:=> (line 49, col 12) to (line 49, col 15)
|
||||
--------------------------------
|
||||
50 > break;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (763 to 781) SpanInfo: {"start":775,"length":5}
|
||||
>break
|
||||
>:=> (line 50, col 12) to (line 50, col 17)
|
||||
--------------------------------
|
||||
51 >
|
||||
|
||||
~ => Pos: (782 to 782) SpanInfo: undefined
|
||||
--------------------------------
|
||||
52 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (783 to 792) SpanInfo: {"start":775,"length":5}
|
||||
>break
|
||||
>:=> (line 50, col 12) to (line 50, col 17)
|
||||
--------------------------------
|
||||
53 > case 1: {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (793 to 810) SpanInfo: {"start":823,"length":3}
|
||||
>x--
|
||||
>:=> (line 54, col 12) to (line 54, col 15)
|
||||
--------------------------------
|
||||
54 > x--;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (811 to 827) SpanInfo: {"start":823,"length":3}
|
||||
>x--
|
||||
>:=> (line 54, col 12) to (line 54, col 15)
|
||||
--------------------------------
|
||||
55 > break;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (828 to 846) SpanInfo: {"start":840,"length":5}
|
||||
>break
|
||||
>:=> (line 55, col 12) to (line 55, col 17)
|
||||
--------------------------------
|
||||
56 >
|
||||
|
||||
~ => Pos: (847 to 847) SpanInfo: undefined
|
||||
--------------------------------
|
||||
57 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (848 to 857) SpanInfo: {"start":840,"length":5}
|
||||
>break
|
||||
>:=> (line 55, col 12) to (line 55, col 17)
|
||||
--------------------------------
|
||||
58 > default: {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (858 to 876) SpanInfo: {"start":889,"length":6}
|
||||
>x *= 2
|
||||
>:=> (line 59, col 12) to (line 59, col 18)
|
||||
--------------------------------
|
||||
59 > x *= 2;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (877 to 896) SpanInfo: {"start":889,"length":6}
|
||||
>x *= 2
|
||||
>:=> (line 59, col 12) to (line 59, col 18)
|
||||
--------------------------------
|
||||
60 > x = 50;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (897 to 916) SpanInfo: {"start":909,"length":6}
|
||||
>x = 50
|
||||
>:=> (line 60, col 12) to (line 60, col 18)
|
||||
--------------------------------
|
||||
61 > break;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (917 to 935) SpanInfo: {"start":929,"length":5}
|
||||
>break
|
||||
>:=> (line 61, col 12) to (line 61, col 17)
|
||||
--------------------------------
|
||||
62 >
|
||||
|
||||
~ => Pos: (936 to 936) SpanInfo: undefined
|
||||
--------------------------------
|
||||
63 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (937 to 946) SpanInfo: {"start":929,"length":5}
|
||||
>break
|
||||
>:=> (line 61, col 12) to (line 61, col 17)
|
||||
--------------------------------
|
||||
64 > }
|
||||
|
||||
~~~~~~ => Pos: (947 to 952) SpanInfo: {"start":889,"length":6}
|
||||
>x *= 2
|
||||
>:=> (line 59, col 12) to (line 59, col 18)
|
||||
--------------------------------
|
||||
65 > while (x < 10) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (953 to 973) SpanInfo: {"start":957,"length":14}
|
||||
>while (x < 10)
|
||||
>:=> (line 65, col 4) to (line 65, col 18)
|
||||
--------------------------------
|
||||
66 > x++;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (974 to 986) SpanInfo: {"start":982,"length":3}
|
||||
>x++
|
||||
>:=> (line 66, col 8) to (line 66, col 11)
|
||||
--------------------------------
|
||||
67 > }
|
||||
|
||||
~~~~~~ => Pos: (987 to 992) SpanInfo: {"start":982,"length":3}
|
||||
>x++
|
||||
>:=> (line 66, col 8) to (line 66, col 11)
|
||||
--------------------------------
|
||||
68 > do {
|
||||
|
||||
~~~~~~~~~ => Pos: (993 to 1001) SpanInfo: {"start":1010,"length":3}
|
||||
>x--
|
||||
>:=> (line 69, col 8) to (line 69, col 11)
|
||||
--------------------------------
|
||||
69 > x--;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (1002 to 1014) SpanInfo: {"start":1010,"length":3}
|
||||
>x--
|
||||
>:=> (line 69, col 8) to (line 69, col 11)
|
||||
--------------------------------
|
||||
70 > } while (x > 4)
|
||||
|
||||
~~~~~ => Pos: (1015 to 1019) SpanInfo: {"start":1010,"length":3}
|
||||
>x--
|
||||
>:=> (line 69, col 8) to (line 69, col 11)
|
||||
70 > } while (x > 4)
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (1020 to 1034) SpanInfo: {"start":1021,"length":13}
|
||||
>while (x > 4)
|
||||
>:=> (line 70, col 6) to (line 70, col 19)
|
||||
--------------------------------
|
||||
71 > x = y;
|
||||
|
||||
~~~~~~~~~~~ => Pos: (1035 to 1045) SpanInfo: {"start":1039,"length":5}
|
||||
>x = y
|
||||
>:=> (line 71, col 4) to (line 71, col 9)
|
||||
--------------------------------
|
||||
72 > var z = (x == 1) ? x + 1 : x - 1;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1046 to 1083) SpanInfo: {"start":1050,"length":32}
|
||||
>var z = (x == 1) ? x + 1 : x - 1
|
||||
>:=> (line 72, col 4) to (line 72, col 36)
|
||||
--------------------------------
|
||||
73 > (x == 1) ? x + 1 : x - 1;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1084 to 1113) SpanInfo: {"start":1088,"length":24}
|
||||
>(x == 1) ? x + 1 : x - 1
|
||||
>:=> (line 73, col 4) to (line 73, col 28)
|
||||
--------------------------------
|
||||
74 > x === 1;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (1114 to 1126) SpanInfo: {"start":1118,"length":7}
|
||||
>x === 1
|
||||
>:=> (line 74, col 4) to (line 74, col 11)
|
||||
--------------------------------
|
||||
75 > x = z = 40;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (1127 to 1142) SpanInfo: {"start":1131,"length":10}
|
||||
>x = z = 40
|
||||
>:=> (line 75, col 4) to (line 75, col 14)
|
||||
--------------------------------
|
||||
76 > eval("y");
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (1143 to 1157) SpanInfo: {"start":1147,"length":9}
|
||||
>eval("y")
|
||||
>:=> (line 76, col 4) to (line 76, col 13)
|
||||
--------------------------------
|
||||
77 > return;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (1158 to 1169) SpanInfo: {"start":1162,"length":6}
|
||||
>return
|
||||
>:=> (line 77, col 4) to (line 77, col 10)
|
||||
--------------------------------
|
||||
78 >}
|
||||
|
||||
~~ => Pos: (1170 to 1171) SpanInfo: {"start":1170,"length":1}
|
||||
>}
|
||||
>:=> (line 78, col 0) to (line 78, col 1)
|
||||
--------------------------------
|
||||
79 >var b = function () {
|
||||
|
||||
~~~~~~~ => Pos: (1172 to 1178) SpanInfo: {"start":1172,"length":54}
|
||||
>var b = function () {
|
||||
> var x = 10;
|
||||
> x = x + 1;
|
||||
>}
|
||||
>:=> (line 79, col 0) to (line 82, col 1)
|
||||
79 >var b = function () {
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (1179 to 1193) SpanInfo: {"start":1198,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 80, col 4) to (line 80, col 14)
|
||||
--------------------------------
|
||||
80 > var x = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (1194 to 1209) SpanInfo: {"start":1198,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 80, col 4) to (line 80, col 14)
|
||||
--------------------------------
|
||||
81 > x = x + 1;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (1210 to 1224) SpanInfo: {"start":1214,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 81, col 4) to (line 81, col 13)
|
||||
--------------------------------
|
||||
82 >};
|
||||
|
||||
~~~ => Pos: (1225 to 1227) SpanInfo: {"start":1225,"length":1}
|
||||
>}
|
||||
>:=> (line 82, col 0) to (line 82, col 1)
|
||||
--------------------------------
|
||||
83 >f();
|
||||
~~~~ => Pos: (1228 to 1231) SpanInfo: {"start":1228,"length":3}
|
||||
>f()
|
||||
>:=> (line 83, col 0) to (line 83, col 3)
|
||||
272
tests/baselines/reference/bpSpan_switch.baseline
Normal file
272
tests/baselines/reference/bpSpan_switch.baseline
Normal file
@ -0,0 +1,272 @@
|
||||
|
||||
1 >var x = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >switch (x) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (12 to 24) SpanInfo: {"start":12,"length":10}
|
||||
>switch (x)
|
||||
>:=> (line 2, col 0) to (line 2, col 10)
|
||||
--------------------------------
|
||||
3 > case 5:
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (25 to 36) SpanInfo: {"start":45,"length":3}
|
||||
>x++
|
||||
>:=> (line 4, col 8) to (line 4, col 11)
|
||||
--------------------------------
|
||||
4 > x++;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (37 to 49) SpanInfo: {"start":45,"length":3}
|
||||
>x++
|
||||
>:=> (line 4, col 8) to (line 4, col 11)
|
||||
--------------------------------
|
||||
5 > break;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (50 to 64) SpanInfo: {"start":58,"length":5}
|
||||
>break
|
||||
>:=> (line 5, col 8) to (line 5, col 13)
|
||||
--------------------------------
|
||||
6 > case 10:
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (65 to 77) SpanInfo: {"start":100,"length":3}
|
||||
>x--
|
||||
>:=> (line 8, col 12) to (line 8, col 15)
|
||||
--------------------------------
|
||||
7 > {
|
||||
|
||||
~~~~~~~~~~ => Pos: (78 to 87) SpanInfo: {"start":100,"length":3}
|
||||
>x--
|
||||
>:=> (line 8, col 12) to (line 8, col 15)
|
||||
--------------------------------
|
||||
8 > x--;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (88 to 104) SpanInfo: {"start":100,"length":3}
|
||||
>x--
|
||||
>:=> (line 8, col 12) to (line 8, col 15)
|
||||
--------------------------------
|
||||
9 > break;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (105 to 123) SpanInfo: {"start":117,"length":5}
|
||||
>break
|
||||
>:=> (line 9, col 12) to (line 9, col 17)
|
||||
--------------------------------
|
||||
10 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (124 to 133) SpanInfo: {"start":117,"length":5}
|
||||
>break
|
||||
>:=> (line 9, col 12) to (line 9, col 17)
|
||||
--------------------------------
|
||||
11 > default:
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (134 to 146) SpanInfo: {"start":155,"length":9}
|
||||
>x = x *10
|
||||
>:=> (line 12, col 8) to (line 12, col 17)
|
||||
--------------------------------
|
||||
12 > x = x *10;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (147 to 165) SpanInfo: {"start":155,"length":9}
|
||||
>x = x *10
|
||||
>:=> (line 12, col 8) to (line 12, col 17)
|
||||
--------------------------------
|
||||
13 >}
|
||||
|
||||
~~ => Pos: (166 to 167) SpanInfo: {"start":155,"length":9}
|
||||
>x = x *10
|
||||
>:=> (line 12, col 8) to (line 12, col 17)
|
||||
--------------------------------
|
||||
14 >switch (x)
|
||||
|
||||
~~~~~~~~~~~ => Pos: (168 to 178) SpanInfo: {"start":168,"length":10}
|
||||
>switch (x)
|
||||
>:=> (line 14, col 0) to (line 14, col 10)
|
||||
--------------------------------
|
||||
15 >{
|
||||
|
||||
~~ => Pos: (179 to 180) SpanInfo: {"start":201,"length":3}
|
||||
>x++
|
||||
>:=> (line 17, col 8) to (line 17, col 11)
|
||||
--------------------------------
|
||||
16 > case 5:
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (181 to 192) SpanInfo: {"start":201,"length":3}
|
||||
>x++
|
||||
>:=> (line 17, col 8) to (line 17, col 11)
|
||||
--------------------------------
|
||||
17 > x++;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (193 to 205) SpanInfo: {"start":201,"length":3}
|
||||
>x++
|
||||
>:=> (line 17, col 8) to (line 17, col 11)
|
||||
--------------------------------
|
||||
18 > break;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (206 to 220) SpanInfo: {"start":214,"length":5}
|
||||
>break
|
||||
>:=> (line 18, col 8) to (line 18, col 13)
|
||||
--------------------------------
|
||||
19 > case 10:
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (221 to 233) SpanInfo: {"start":256,"length":3}
|
||||
>x--
|
||||
>:=> (line 21, col 12) to (line 21, col 15)
|
||||
--------------------------------
|
||||
20 > {
|
||||
|
||||
~~~~~~~~~~ => Pos: (234 to 243) SpanInfo: {"start":256,"length":3}
|
||||
>x--
|
||||
>:=> (line 21, col 12) to (line 21, col 15)
|
||||
--------------------------------
|
||||
21 > x--;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (244 to 260) SpanInfo: {"start":256,"length":3}
|
||||
>x--
|
||||
>:=> (line 21, col 12) to (line 21, col 15)
|
||||
--------------------------------
|
||||
22 > break;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (261 to 279) SpanInfo: {"start":273,"length":5}
|
||||
>break
|
||||
>:=> (line 22, col 12) to (line 22, col 17)
|
||||
--------------------------------
|
||||
23 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (280 to 289) SpanInfo: {"start":273,"length":5}
|
||||
>break
|
||||
>:=> (line 22, col 12) to (line 22, col 17)
|
||||
--------------------------------
|
||||
24 > default:
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (290 to 302) SpanInfo: {"start":325,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 26, col 12) to (line 26, col 22)
|
||||
--------------------------------
|
||||
25 > {
|
||||
|
||||
~~~~~~~~~~ => Pos: (303 to 312) SpanInfo: {"start":325,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 26, col 12) to (line 26, col 22)
|
||||
--------------------------------
|
||||
26 > x = x * 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (313 to 336) SpanInfo: {"start":325,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 26, col 12) to (line 26, col 22)
|
||||
--------------------------------
|
||||
27 > }
|
||||
|
||||
~~~~~~~~~~ => Pos: (337 to 346) SpanInfo: {"start":325,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 26, col 12) to (line 26, col 22)
|
||||
--------------------------------
|
||||
28 >}
|
||||
|
||||
~~ => Pos: (347 to 348) SpanInfo: {"start":325,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 26, col 12) to (line 26, col 22)
|
||||
--------------------------------
|
||||
29 >switch ((function foo() {
|
||||
|
||||
~~~~~~~~ => Pos: (349 to 356) SpanInfo: {"start":349,"length":50}
|
||||
>switch ((function foo() {
|
||||
> return x * 30;
|
||||
>})())
|
||||
>:=> (line 29, col 0) to (line 31, col 5)
|
||||
29 >switch ((function foo() {
|
||||
|
||||
~ => Pos: (357 to 357) SpanInfo: {"start":357,"length":41}
|
||||
>(function foo() {
|
||||
> return x * 30;
|
||||
>})()
|
||||
>:=> (line 29, col 8) to (line 31, col 4)
|
||||
29 >switch ((function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (358 to 374) SpanInfo: {"start":379,"length":13}
|
||||
>return x * 30
|
||||
>:=> (line 30, col 4) to (line 30, col 17)
|
||||
--------------------------------
|
||||
30 > return x * 30;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (375 to 393) SpanInfo: {"start":379,"length":13}
|
||||
>return x * 30
|
||||
>:=> (line 30, col 4) to (line 30, col 17)
|
||||
--------------------------------
|
||||
31 >})()) {
|
||||
|
||||
~ => Pos: (394 to 394) SpanInfo: {"start":394,"length":1}
|
||||
>}
|
||||
>:=> (line 31, col 0) to (line 31, col 1)
|
||||
31 >})()) {
|
||||
|
||||
~~~ => Pos: (395 to 397) SpanInfo: {"start":357,"length":41}
|
||||
>(function foo() {
|
||||
> return x * 30;
|
||||
>})()
|
||||
>:=> (line 29, col 8) to (line 31, col 4)
|
||||
31 >})()) {
|
||||
|
||||
~ => Pos: (398 to 398) SpanInfo: {"start":349,"length":50}
|
||||
>switch ((function foo() {
|
||||
> return x * 30;
|
||||
>})())
|
||||
>:=> (line 29, col 0) to (line 31, col 5)
|
||||
31 >})()) {
|
||||
|
||||
~~~ => Pos: (399 to 401) SpanInfo: {"start":466,"length":3}
|
||||
>x++
|
||||
>:=> (line 35, col 8) to (line 35, col 11)
|
||||
--------------------------------
|
||||
32 > case (function bar() {
|
||||
|
||||
~~~~~~~~ => Pos: (402 to 409) SpanInfo: {"start":466,"length":3}
|
||||
>x++
|
||||
>:=> (line 35, col 8) to (line 35, col 11)
|
||||
32 > case (function bar() {
|
||||
|
||||
~~ => Pos: (410 to 411) SpanInfo: {"start":411,"length":45}
|
||||
>(function bar() {
|
||||
> return 30;
|
||||
> })()
|
||||
>:=> (line 32, col 9) to (line 34, col 8)
|
||||
32 > case (function bar() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (412 to 428) SpanInfo: {"start":437,"length":9}
|
||||
>return 30
|
||||
>:=> (line 33, col 8) to (line 33, col 17)
|
||||
--------------------------------
|
||||
33 > return 30;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (429 to 447) SpanInfo: {"start":437,"length":9}
|
||||
>return 30
|
||||
>:=> (line 33, col 8) to (line 33, col 17)
|
||||
--------------------------------
|
||||
34 > })():
|
||||
|
||||
~~~~~ => Pos: (448 to 452) SpanInfo: {"start":452,"length":1}
|
||||
>}
|
||||
>:=> (line 34, col 4) to (line 34, col 5)
|
||||
34 > })():
|
||||
|
||||
~~~ => Pos: (453 to 455) SpanInfo: {"start":411,"length":45}
|
||||
>(function bar() {
|
||||
> return 30;
|
||||
> })()
|
||||
>:=> (line 32, col 9) to (line 34, col 8)
|
||||
34 > })():
|
||||
|
||||
~~ => Pos: (456 to 457) SpanInfo: {"start":466,"length":3}
|
||||
>x++
|
||||
>:=> (line 35, col 8) to (line 35, col 11)
|
||||
--------------------------------
|
||||
35 > x++;
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (458 to 470) SpanInfo: {"start":466,"length":3}
|
||||
>x++
|
||||
>:=> (line 35, col 8) to (line 35, col 11)
|
||||
--------------------------------
|
||||
36 >}
|
||||
~ => Pos: (471 to 471) SpanInfo: {"start":466,"length":3}
|
||||
>x++
|
||||
>:=> (line 35, col 8) to (line 35, col 11)
|
||||
223
tests/baselines/reference/bpSpan_tryCatchFinally.baseline
Normal file
223
tests/baselines/reference/bpSpan_tryCatchFinally.baseline
Normal file
@ -0,0 +1,223 @@
|
||||
|
||||
1 >var x = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >try {
|
||||
|
||||
~~~~~~ => Pos: (12 to 17) SpanInfo: {"start":22,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 3, col 4) to (line 3, col 13)
|
||||
--------------------------------
|
||||
3 > x = x + 1;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (18 to 32) SpanInfo: {"start":22,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 3, col 4) to (line 3, col 13)
|
||||
--------------------------------
|
||||
4 >} catch (e) {
|
||||
|
||||
~ => Pos: (33 to 33) SpanInfo: {"start":22,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 3, col 4) to (line 3, col 13)
|
||||
4 >} catch (e) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (34 to 46) SpanInfo: {"start":51,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 5, col 4) to (line 5, col 13)
|
||||
--------------------------------
|
||||
5 > x = x - 1;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (47 to 61) SpanInfo: {"start":51,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 5, col 4) to (line 5, col 13)
|
||||
--------------------------------
|
||||
6 >} finally {
|
||||
|
||||
~ => Pos: (62 to 62) SpanInfo: {"start":51,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 5, col 4) to (line 5, col 13)
|
||||
6 >} finally {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (63 to 73) SpanInfo: {"start":78,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 7, col 4) to (line 7, col 14)
|
||||
--------------------------------
|
||||
7 > x = x * 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (74 to 89) SpanInfo: {"start":78,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 7, col 4) to (line 7, col 14)
|
||||
--------------------------------
|
||||
8 >}
|
||||
|
||||
~~ => Pos: (90 to 91) SpanInfo: {"start":78,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 7, col 4) to (line 7, col 14)
|
||||
--------------------------------
|
||||
9 >try
|
||||
|
||||
~~~~ => Pos: (92 to 95) SpanInfo: {"start":102,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 11, col 4) to (line 11, col 13)
|
||||
--------------------------------
|
||||
10 >{
|
||||
|
||||
~~ => Pos: (96 to 97) SpanInfo: {"start":102,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 11, col 4) to (line 11, col 13)
|
||||
--------------------------------
|
||||
11 > x = x + 1;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (98 to 112) SpanInfo: {"start":102,"length":9}
|
||||
>x = x + 1
|
||||
>:=> (line 11, col 4) to (line 11, col 13)
|
||||
--------------------------------
|
||||
12 > throw new Error();
|
||||
|
||||
~~~~~~~~~ => Pos: (113 to 121) SpanInfo: {"start":117,"length":17}
|
||||
>throw new Error()
|
||||
>:=> (line 12, col 4) to (line 12, col 21)
|
||||
12 > throw new Error();
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (122 to 135) SpanInfo: {"start":123,"length":11}
|
||||
>new Error()
|
||||
>:=> (line 12, col 10) to (line 12, col 21)
|
||||
--------------------------------
|
||||
13 >}
|
||||
|
||||
~~ => Pos: (136 to 137) SpanInfo: {"start":117,"length":17}
|
||||
>throw new Error()
|
||||
>:=> (line 12, col 4) to (line 12, col 21)
|
||||
--------------------------------
|
||||
14 >catch (e)
|
||||
|
||||
~~~~~~~~~~ => Pos: (138 to 147) SpanInfo: {"start":154,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 16, col 4) to (line 16, col 13)
|
||||
--------------------------------
|
||||
15 >{
|
||||
|
||||
~~ => Pos: (148 to 149) SpanInfo: {"start":154,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 16, col 4) to (line 16, col 13)
|
||||
--------------------------------
|
||||
16 > x = x - 1;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (150 to 164) SpanInfo: {"start":154,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 16, col 4) to (line 16, col 13)
|
||||
--------------------------------
|
||||
17 >}
|
||||
|
||||
~~ => Pos: (165 to 166) SpanInfo: {"start":154,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 16, col 4) to (line 16, col 13)
|
||||
--------------------------------
|
||||
18 >finally
|
||||
|
||||
~~~~~~~~ => Pos: (167 to 174) SpanInfo: {"start":181,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 20, col 4) to (line 20, col 14)
|
||||
--------------------------------
|
||||
19 >{
|
||||
|
||||
~~ => Pos: (175 to 176) SpanInfo: {"start":181,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 20, col 4) to (line 20, col 14)
|
||||
--------------------------------
|
||||
20 > x = x * 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (177 to 192) SpanInfo: {"start":181,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 20, col 4) to (line 20, col 14)
|
||||
--------------------------------
|
||||
21 >}
|
||||
|
||||
~~ => Pos: (193 to 194) SpanInfo: {"start":181,"length":10}
|
||||
>x = x * 10
|
||||
>:=> (line 20, col 4) to (line 20, col 14)
|
||||
--------------------------------
|
||||
22 >try {
|
||||
|
||||
~~~~~~ => Pos: (195 to 200) SpanInfo: {"start":205,"length":65}
|
||||
>throw (function foo() {
|
||||
> new Error(x.toString());
|
||||
> })()
|
||||
>:=> (line 23, col 4) to (line 25, col 8)
|
||||
--------------------------------
|
||||
23 > throw (function foo() {
|
||||
|
||||
~~~~~~~~~ => Pos: (201 to 209) SpanInfo: {"start":205,"length":65}
|
||||
>throw (function foo() {
|
||||
> new Error(x.toString());
|
||||
> })()
|
||||
>:=> (line 23, col 4) to (line 25, col 8)
|
||||
23 > throw (function foo() {
|
||||
|
||||
~~ => Pos: (210 to 211) SpanInfo: {"start":211,"length":59}
|
||||
>(function foo() {
|
||||
> new Error(x.toString());
|
||||
> })()
|
||||
>:=> (line 23, col 10) to (line 25, col 8)
|
||||
23 > throw (function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (212 to 228) SpanInfo: {"start":237,"length":23}
|
||||
>new Error(x.toString())
|
||||
>:=> (line 24, col 8) to (line 24, col 31)
|
||||
--------------------------------
|
||||
24 > new Error(x.toString());
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (229 to 246) SpanInfo: {"start":237,"length":23}
|
||||
>new Error(x.toString())
|
||||
>:=> (line 24, col 8) to (line 24, col 31)
|
||||
24 > new Error(x.toString());
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (247 to 258) SpanInfo: {"start":247,"length":12}
|
||||
>x.toString()
|
||||
>:=> (line 24, col 18) to (line 24, col 30)
|
||||
24 > new Error(x.toString());
|
||||
|
||||
~~~ => Pos: (259 to 261) SpanInfo: {"start":237,"length":23}
|
||||
>new Error(x.toString())
|
||||
>:=> (line 24, col 8) to (line 24, col 31)
|
||||
--------------------------------
|
||||
25 > })();
|
||||
|
||||
~~~~~ => Pos: (262 to 266) SpanInfo: {"start":266,"length":1}
|
||||
>}
|
||||
>:=> (line 25, col 4) to (line 25, col 5)
|
||||
25 > })();
|
||||
|
||||
~~~~~ => Pos: (267 to 271) SpanInfo: {"start":211,"length":59}
|
||||
>(function foo() {
|
||||
> new Error(x.toString());
|
||||
> })()
|
||||
>:=> (line 23, col 10) to (line 25, col 8)
|
||||
--------------------------------
|
||||
26 >}
|
||||
|
||||
~~ => Pos: (272 to 273) SpanInfo: {"start":205,"length":65}
|
||||
>throw (function foo() {
|
||||
> new Error(x.toString());
|
||||
> })()
|
||||
>:=> (line 23, col 4) to (line 25, col 8)
|
||||
--------------------------------
|
||||
27 >finally {
|
||||
|
||||
~~~~~~~~~~ => Pos: (274 to 283) SpanInfo: {"start":288,"length":3}
|
||||
>x++
|
||||
>:=> (line 28, col 4) to (line 28, col 7)
|
||||
--------------------------------
|
||||
28 > x++;
|
||||
|
||||
~~~~~~~~~ => Pos: (284 to 292) SpanInfo: {"start":288,"length":3}
|
||||
>x++
|
||||
>:=> (line 28, col 4) to (line 28, col 7)
|
||||
--------------------------------
|
||||
29 >}
|
||||
~ => Pos: (293 to 293) SpanInfo: {"start":288,"length":3}
|
||||
>x++
|
||||
>:=> (line 28, col 4) to (line 28, col 7)
|
||||
@ -0,0 +1,82 @@
|
||||
|
||||
1 >class Greeter {
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (0 to 15) SpanInfo: {"start":0,"length":17}
|
||||
>class Greeter {
|
||||
>}
|
||||
>:=> (line 1, col 0) to (line 2, col 1)
|
||||
--------------------------------
|
||||
2 >}
|
||||
|
||||
~~ => Pos: (16 to 17) SpanInfo: {"start":16,"length":1}
|
||||
>}
|
||||
>:=> (line 2, col 0) to (line 2, col 1)
|
||||
--------------------------------
|
||||
3 >var a = <Greeter>new Greeter();
|
||||
|
||||
~~~~~~~ => Pos: (18 to 24) SpanInfo: {"start":18,"length":30}
|
||||
>var a = <Greeter>new Greeter()
|
||||
>:=> (line 3, col 0) to (line 3, col 30)
|
||||
3 >var a = <Greeter>new Greeter();
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 49) SpanInfo: {"start":35,"length":13}
|
||||
>new Greeter()
|
||||
>:=> (line 3, col 17) to (line 3, col 30)
|
||||
--------------------------------
|
||||
4 >a = (<Greeter> new Greeter());
|
||||
|
||||
~~~~~ => Pos: (50 to 54) SpanInfo: {"start":50,"length":29}
|
||||
>a = (<Greeter> new Greeter())
|
||||
>:=> (line 4, col 0) to (line 4, col 29)
|
||||
4 >a = (<Greeter> new Greeter());
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (55 to 77) SpanInfo: {"start":65,"length":13}
|
||||
>new Greeter()
|
||||
>:=> (line 4, col 15) to (line 4, col 28)
|
||||
4 >a = (<Greeter> new Greeter());
|
||||
|
||||
~~~ => Pos: (78 to 80) SpanInfo: {"start":50,"length":29}
|
||||
>a = (<Greeter> new Greeter())
|
||||
>:=> (line 4, col 0) to (line 4, col 29)
|
||||
--------------------------------
|
||||
5 >a = <Greeter>(function foo() {
|
||||
|
||||
~~~ => Pos: (81 to 83) SpanInfo: {"start":81,"length":61}
|
||||
>a = <Greeter>(function foo() {
|
||||
> return new Greeter();
|
||||
>})()
|
||||
>:=> (line 5, col 0) to (line 7, col 4)
|
||||
5 >a = <Greeter>(function foo() {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (84 to 94) SpanInfo: {"start":94,"length":48}
|
||||
>(function foo() {
|
||||
> return new Greeter();
|
||||
>})()
|
||||
>:=> (line 5, col 13) to (line 7, col 4)
|
||||
5 >a = <Greeter>(function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (95 to 111) SpanInfo: {"start":116,"length":20}
|
||||
>return new Greeter()
|
||||
>:=> (line 6, col 4) to (line 6, col 24)
|
||||
--------------------------------
|
||||
6 > return new Greeter();
|
||||
|
||||
~~~~~~~~~~ => Pos: (112 to 121) SpanInfo: {"start":116,"length":20}
|
||||
>return new Greeter()
|
||||
>:=> (line 6, col 4) to (line 6, col 24)
|
||||
6 > return new Greeter();
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (122 to 137) SpanInfo: {"start":123,"length":13}
|
||||
>new Greeter()
|
||||
>:=> (line 6, col 11) to (line 6, col 24)
|
||||
--------------------------------
|
||||
7 >})();
|
||||
~ => Pos: (138 to 138) SpanInfo: {"start":138,"length":1}
|
||||
>}
|
||||
>:=> (line 7, col 0) to (line 7, col 1)
|
||||
7 >})();
|
||||
~~~~ => Pos: (139 to 142) SpanInfo: {"start":94,"length":48}
|
||||
>(function foo() {
|
||||
> return new Greeter();
|
||||
>})()
|
||||
>:=> (line 5, col 13) to (line 7, col 4)
|
||||
74
tests/baselines/reference/bpSpan_unaryExpressions.baseline
Normal file
74
tests/baselines/reference/bpSpan_unaryExpressions.baseline
Normal file
@ -0,0 +1,74 @@
|
||||
|
||||
1 >var x = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var x = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >var y = 20;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (12 to 23) SpanInfo: {"start":12,"length":10}
|
||||
>var y = 20
|
||||
>:=> (line 2, col 0) to (line 2, col 10)
|
||||
--------------------------------
|
||||
3 >x++;
|
||||
|
||||
~~~~~ => Pos: (24 to 28) SpanInfo: {"start":24,"length":3}
|
||||
>x++
|
||||
>:=> (line 3, col 0) to (line 3, col 3)
|
||||
--------------------------------
|
||||
4 >y--;
|
||||
|
||||
~~~~~ => Pos: (29 to 33) SpanInfo: {"start":29,"length":3}
|
||||
>y--
|
||||
>:=> (line 4, col 0) to (line 4, col 3)
|
||||
--------------------------------
|
||||
5 >typeof (function foo() {
|
||||
|
||||
~~~~~~ => Pos: (34 to 39) SpanInfo: {"start":34,"length":43}
|
||||
>typeof (function foo() {
|
||||
> return y;
|
||||
>})()
|
||||
>:=> (line 5, col 0) to (line 7, col 4)
|
||||
5 >typeof (function foo() {
|
||||
|
||||
~~ => Pos: (40 to 41) SpanInfo: {"start":41,"length":36}
|
||||
>(function foo() {
|
||||
> return y;
|
||||
>})()
|
||||
>:=> (line 5, col 7) to (line 7, col 4)
|
||||
5 >typeof (function foo() {
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (42 to 58) SpanInfo: {"start":63,"length":8}
|
||||
>return y
|
||||
>:=> (line 6, col 4) to (line 6, col 12)
|
||||
--------------------------------
|
||||
6 > return y;
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (59 to 72) SpanInfo: {"start":63,"length":8}
|
||||
>return y
|
||||
>:=> (line 6, col 4) to (line 6, col 12)
|
||||
--------------------------------
|
||||
7 >})();
|
||||
|
||||
~ => Pos: (73 to 73) SpanInfo: {"start":73,"length":1}
|
||||
>}
|
||||
>:=> (line 7, col 0) to (line 7, col 1)
|
||||
7 >})();
|
||||
|
||||
~~~~~ => Pos: (74 to 78) SpanInfo: {"start":41,"length":36}
|
||||
>(function foo() {
|
||||
> return y;
|
||||
>})()
|
||||
>:=> (line 5, col 7) to (line 7, col 4)
|
||||
--------------------------------
|
||||
8 >++x;
|
||||
|
||||
~~~~~ => Pos: (79 to 83) SpanInfo: {"start":79,"length":3}
|
||||
>++x
|
||||
>:=> (line 8, col 0) to (line 8, col 3)
|
||||
--------------------------------
|
||||
9 >++y;
|
||||
~~~~ => Pos: (84 to 87) SpanInfo: {"start":84,"length":3}
|
||||
>++y
|
||||
>:=> (line 9, col 0) to (line 9, col 3)
|
||||
90
tests/baselines/reference/bpSpan_variables.baseline
Normal file
90
tests/baselines/reference/bpSpan_variables.baseline
Normal file
@ -0,0 +1,90 @@
|
||||
|
||||
1 >var a = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var a = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >var b;
|
||||
|
||||
~~~~~~~ => Pos: (12 to 18) SpanInfo: undefined
|
||||
--------------------------------
|
||||
3 >var c = 10, d, e;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (19 to 36) SpanInfo: {"start":19,"length":10}
|
||||
>var c = 10
|
||||
>:=> (line 3, col 0) to (line 3, col 10)
|
||||
--------------------------------
|
||||
4 >var c2, d2 = 10;
|
||||
|
||||
~~~~~~~ => Pos: (37 to 43) SpanInfo: undefined
|
||||
4 >var c2, d2 = 10;
|
||||
|
||||
~~~~~~~~~~ => Pos: (44 to 53) SpanInfo: {"start":45,"length":7}
|
||||
>d2 = 10
|
||||
>:=> (line 4, col 8) to (line 4, col 15)
|
||||
--------------------------------
|
||||
5 >module m {
|
||||
|
||||
~~~~~~~~~~~ => Pos: (54 to 64) SpanInfo: {"start":54,"length":146}
|
||||
>module m {
|
||||
> var x1;
|
||||
> var x2 = 10, x3 = 10;
|
||||
> var x4, x5;
|
||||
> export var xx1;
|
||||
> export var xx2 = 10, xx3 = 10;
|
||||
> export var xx4, xx5;
|
||||
>}
|
||||
>:=> (line 5, col 0) to (line 12, col 1)
|
||||
--------------------------------
|
||||
6 > var x1;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (65 to 76) SpanInfo: undefined
|
||||
--------------------------------
|
||||
7 > var x2 = 10, x3 = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (77 to 92) SpanInfo: {"start":81,"length":11}
|
||||
>var x2 = 10
|
||||
>:=> (line 7, col 4) to (line 7, col 15)
|
||||
7 > var x2 = 10, x3 = 10;
|
||||
|
||||
~~~~~~~~~~ => Pos: (93 to 102) SpanInfo: {"start":94,"length":7}
|
||||
>x3 = 10
|
||||
>:=> (line 7, col 17) to (line 7, col 24)
|
||||
--------------------------------
|
||||
8 > var x4, x5;
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (103 to 118) SpanInfo: undefined
|
||||
--------------------------------
|
||||
9 > export var xx1;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (119 to 138) SpanInfo: {"start":123,"length":14}
|
||||
>export var xx1
|
||||
>:=> (line 9, col 4) to (line 9, col 18)
|
||||
--------------------------------
|
||||
10 > export var xx2 = 10, xx3 = 10;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (139 to 162) SpanInfo: {"start":143,"length":19}
|
||||
>export var xx2 = 10
|
||||
>:=> (line 10, col 4) to (line 10, col 23)
|
||||
10 > export var xx2 = 10, xx3 = 10;
|
||||
|
||||
~~~~~~~~~~~ => Pos: (163 to 173) SpanInfo: {"start":164,"length":8}
|
||||
>xx3 = 10
|
||||
>:=> (line 10, col 25) to (line 10, col 33)
|
||||
--------------------------------
|
||||
11 > export var xx4, xx5;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (174 to 192) SpanInfo: {"start":178,"length":14}
|
||||
>export var xx4
|
||||
>:=> (line 11, col 4) to (line 11, col 18)
|
||||
11 > export var xx4, xx5;
|
||||
|
||||
~~~~~~ => Pos: (193 to 198) SpanInfo: {"start":194,"length":3}
|
||||
>xx5
|
||||
>:=> (line 11, col 20) to (line 11, col 23)
|
||||
--------------------------------
|
||||
12 >}
|
||||
~ => Pos: (199 to 199) SpanInfo: {"start":199,"length":1}
|
||||
>}
|
||||
>:=> (line 12, col 0) to (line 12, col 1)
|
||||
133
tests/baselines/reference/bpSpan_while.baseline
Normal file
133
tests/baselines/reference/bpSpan_while.baseline
Normal file
@ -0,0 +1,133 @@
|
||||
|
||||
1 >var a = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10}
|
||||
>var a = 10
|
||||
>:=> (line 1, col 0) to (line 1, col 10)
|
||||
--------------------------------
|
||||
2 >while (a == 10) {
|
||||
|
||||
~~~~~~~~~~~~~~~~~~ => Pos: (12 to 29) SpanInfo: {"start":12,"length":15}
|
||||
>while (a == 10)
|
||||
>:=> (line 2, col 0) to (line 2, col 15)
|
||||
--------------------------------
|
||||
3 > a++;
|
||||
|
||||
~~~~~~~~~ => Pos: (30 to 38) SpanInfo: {"start":34,"length":3}
|
||||
>a++
|
||||
>:=> (line 3, col 4) to (line 3, col 7)
|
||||
--------------------------------
|
||||
4 >}
|
||||
|
||||
~~ => Pos: (39 to 40) SpanInfo: {"start":34,"length":3}
|
||||
>a++
|
||||
>:=> (line 3, col 4) to (line 3, col 7)
|
||||
--------------------------------
|
||||
5 >while (a == 10)
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (41 to 57) SpanInfo: {"start":41,"length":15}
|
||||
>while (a == 10)
|
||||
>:=> (line 5, col 0) to (line 5, col 15)
|
||||
--------------------------------
|
||||
6 >{
|
||||
|
||||
~~ => Pos: (58 to 59) SpanInfo: {"start":64,"length":3}
|
||||
>a++
|
||||
>:=> (line 7, col 4) to (line 7, col 7)
|
||||
--------------------------------
|
||||
7 > a++;
|
||||
|
||||
~~~~~~~~~ => Pos: (60 to 68) SpanInfo: {"start":64,"length":3}
|
||||
>a++
|
||||
>:=> (line 7, col 4) to (line 7, col 7)
|
||||
--------------------------------
|
||||
8 >}
|
||||
|
||||
~~ => Pos: (69 to 70) SpanInfo: {"start":64,"length":3}
|
||||
>a++
|
||||
>:=> (line 7, col 4) to (line 7, col 7)
|
||||
--------------------------------
|
||||
9 >while (a == 10) a++;
|
||||
|
||||
~~~~~~~~~~~~~~~ => Pos: (71 to 85) SpanInfo: {"start":71,"length":15}
|
||||
>while (a == 10)
|
||||
>:=> (line 9, col 0) to (line 9, col 15)
|
||||
9 >while (a == 10) a++;
|
||||
|
||||
~~~~~~~ => Pos: (86 to 92) SpanInfo: {"start":88,"length":3}
|
||||
>a++
|
||||
>:=> (line 9, col 17) to (line 9, col 20)
|
||||
--------------------------------
|
||||
10 >while (a == 10)
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (93 to 109) SpanInfo: {"start":93,"length":15}
|
||||
>while (a == 10)
|
||||
>:=> (line 10, col 0) to (line 10, col 15)
|
||||
--------------------------------
|
||||
11 > a++;
|
||||
|
||||
~~~~~~~~~ => Pos: (110 to 118) SpanInfo: {"start":114,"length":3}
|
||||
>a++
|
||||
>:=> (line 11, col 4) to (line 11, col 7)
|
||||
--------------------------------
|
||||
12 >while ((function () {
|
||||
|
||||
~~~~~~~ => Pos: (119 to 125) SpanInfo: {"start":119,"length":52}
|
||||
>while ((function () {
|
||||
> return 30 * a;
|
||||
>})() !== a)
|
||||
>:=> (line 12, col 0) to (line 14, col 11)
|
||||
12 >while ((function () {
|
||||
|
||||
~ => Pos: (126 to 126) SpanInfo: {"start":126,"length":38}
|
||||
>(function () {
|
||||
> return 30 * a;
|
||||
>})()
|
||||
>:=> (line 12, col 7) to (line 14, col 4)
|
||||
12 >while ((function () {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (127 to 140) SpanInfo: {"start":145,"length":13}
|
||||
>return 30 * a
|
||||
>:=> (line 13, col 4) to (line 13, col 17)
|
||||
--------------------------------
|
||||
13 > return 30 * a;
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (141 to 159) SpanInfo: {"start":145,"length":13}
|
||||
>return 30 * a
|
||||
>:=> (line 13, col 4) to (line 13, col 17)
|
||||
--------------------------------
|
||||
14 >})() !== a) {
|
||||
|
||||
~ => Pos: (160 to 160) SpanInfo: {"start":160,"length":1}
|
||||
>}
|
||||
>:=> (line 14, col 0) to (line 14, col 1)
|
||||
14 >})() !== a) {
|
||||
|
||||
~~~ => Pos: (161 to 163) SpanInfo: {"start":126,"length":38}
|
||||
>(function () {
|
||||
> return 30 * a;
|
||||
>})()
|
||||
>:=> (line 12, col 7) to (line 14, col 4)
|
||||
14 >})() !== a) {
|
||||
|
||||
~~~~~~~ => Pos: (164 to 170) SpanInfo: {"start":119,"length":52}
|
||||
>while ((function () {
|
||||
> return 30 * a;
|
||||
>})() !== a)
|
||||
>:=> (line 12, col 0) to (line 14, col 11)
|
||||
14 >})() !== a) {
|
||||
|
||||
~~~ => Pos: (171 to 173) SpanInfo: {"start":178,"length":3}
|
||||
>a--
|
||||
>:=> (line 15, col 4) to (line 15, col 7)
|
||||
--------------------------------
|
||||
15 > a--;
|
||||
|
||||
~~~~~~~~~ => Pos: (174 to 182) SpanInfo: {"start":178,"length":3}
|
||||
>a--
|
||||
>:=> (line 15, col 4) to (line 15, col 7)
|
||||
--------------------------------
|
||||
16 >}
|
||||
~ => Pos: (183 to 183) SpanInfo: {"start":178,"length":3}
|
||||
>a--
|
||||
>:=> (line 15, col 4) to (line 15, col 7)
|
||||
21
tests/baselines/reference/bpSpan_with.baseline
Normal file
21
tests/baselines/reference/bpSpan_with.baseline
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
1 >var obj: string;
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (0 to 16) SpanInfo: undefined
|
||||
--------------------------------
|
||||
2 >with (obj) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (17 to 29) SpanInfo: {"start":34,"length":6}
|
||||
>x = 10
|
||||
>:=> (line 3, col 4) to (line 3, col 10)
|
||||
--------------------------------
|
||||
3 > x = 10;
|
||||
|
||||
~~~~~~~~~~~~ => Pos: (30 to 41) SpanInfo: {"start":34,"length":6}
|
||||
>x = 10
|
||||
>:=> (line 3, col 4) to (line 3, col 10)
|
||||
--------------------------------
|
||||
4 >}
|
||||
~ => Pos: (42 to 42) SpanInfo: {"start":34,"length":6}
|
||||
>x = 10
|
||||
>:=> (line 3, col 4) to (line 3, col 10)
|
||||
@ -1,215 +0,0 @@
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(40,12): error TS2365: Operator '<' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(49,12): error TS2365: Operator '>' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(57,12): error TS2365: Operator '>' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(66,12): error TS2365: Operator '<=' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(74,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(83,12): error TS2365: Operator '>=' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(91,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(100,12): error TS2365: Operator '==' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(108,12): error TS2365: Operator '==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(117,12): error TS2365: Operator '!=' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(125,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(134,12): error TS2365: Operator '===' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(142,12): error TS2365: Operator '===' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(151,12): error TS2365: Operator '!==' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(159,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts (16 errors) ====
|
||||
class Base {
|
||||
public a: string;
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
public b: string;
|
||||
}
|
||||
|
||||
var a1: { fn<T>(x: T): T };
|
||||
var b1: { fn(x: string): string };
|
||||
|
||||
var a2: { fn<T>(x: T): T };
|
||||
var b2: { fn(x: string, y: number): string };
|
||||
|
||||
var a3: { fn<T, U>(x: T, y: U): T };
|
||||
var b3: { fn(x: string, y: number): string };
|
||||
|
||||
var a4: { fn<T>(x?: T): T };
|
||||
var b4: { fn(x?: string): string };
|
||||
|
||||
var a5: { fn<T>(...x: T[]): T };
|
||||
var b5: { fn(...x: string[]): string };
|
||||
|
||||
var a6: { fn<T>(x: T, y: T): T };
|
||||
var b6: { fn(x: string, y: number): {} };
|
||||
|
||||
//var a7: { fn<T, U extends T>(x: T, y: U): T };
|
||||
var b7: { fn(x: Base, y: Derived): Base };
|
||||
|
||||
// operator <
|
||||
var r1a1 = a1 < b1;
|
||||
var r1a2 = a2 < b2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r1a3 = a3 < b3;
|
||||
var r1a4 = a4 < b4;
|
||||
var r1a5 = a5 < b5;
|
||||
var r1a6 = a6 < b6;
|
||||
//var r1a7 = a7 < b7;
|
||||
|
||||
var r1b1 = b1 < a1;
|
||||
var r1b2 = b2 < a2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r1b3 = b3 < a3;
|
||||
var r1b4 = b4 < a4;
|
||||
var r1b5 = b5 < a5;
|
||||
var r1b6 = b6 < a6;
|
||||
//var r1b7 = b7 < a7;
|
||||
|
||||
// operator >
|
||||
var r2a1 = a1 > b1;
|
||||
var r2a2 = a2 > b2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r2a3 = a3 > b3;
|
||||
var r2a4 = a4 > b4;
|
||||
var r2a5 = a5 > b5;
|
||||
var r2a6 = a6 > b6;
|
||||
//var r2a7 = a7 > b7;
|
||||
|
||||
var r2b1 = b1 > a1;
|
||||
var r2b2 = b2 > a2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r2b3 = b3 > a3;
|
||||
var r2b4 = b4 > a4;
|
||||
var r2b5 = b5 > a5;
|
||||
var r2b6 = b6 > a6;
|
||||
//var r2b7 = b7 > a7;
|
||||
|
||||
// operator <=
|
||||
var r3a1 = a1 <= b1;
|
||||
var r3a2 = a2 <= b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '<=' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r3a3 = a3 <= b3;
|
||||
var r3a4 = a4 <= b4;
|
||||
var r3a5 = a5 <= b5;
|
||||
var r3a6 = a6 <= b6;
|
||||
//var r3a7 = a7 <= b7;
|
||||
|
||||
var r3b1 = b1 <= a1;
|
||||
var r3b2 = b2 <= a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r3b3 = b3 <= a3;
|
||||
var r3b4 = b4 <= a4;
|
||||
var r3b5 = b5 <= a5;
|
||||
var r3b6 = b6 <= a6;
|
||||
//var r3b7 = b7 <= a7;
|
||||
|
||||
// operator >=
|
||||
var r4a1 = a1 >= b1;
|
||||
var r4a2 = a2 >= b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '>=' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r4a3 = a3 >= b3;
|
||||
var r4a4 = a4 >= b4;
|
||||
var r4a5 = a5 >= b5;
|
||||
var r4a6 = a6 >= b6;
|
||||
//var r4a7 = a7 >= b7;
|
||||
|
||||
var r4b1 = b1 >= a1;
|
||||
var r4b2 = b2 >= a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r4b3 = b3 >= a3;
|
||||
var r4b4 = b4 >= a4;
|
||||
var r4b5 = b5 >= a5;
|
||||
var r4b6 = b6 >= a6;
|
||||
//var r4b7 = b7 >= a7;
|
||||
|
||||
// operator ==
|
||||
var r5a1 = a1 == b1;
|
||||
var r5a2 = a2 == b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '==' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r5a3 = a3 == b3;
|
||||
var r5a4 = a4 == b4;
|
||||
var r5a5 = a5 == b5;
|
||||
var r5a6 = a6 == b6;
|
||||
//var r5a7 = a7 == b7;
|
||||
|
||||
var r5b1 = b1 == a1;
|
||||
var r5b2 = b2 == a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r5b3 = b3 == a3;
|
||||
var r5b4 = b4 == a4;
|
||||
var r5b5 = b5 == a5;
|
||||
var r5b6 = b6 == a6;
|
||||
//var r5b7 = b7 == a7;
|
||||
|
||||
// operator !=
|
||||
var r6a1 = a1 != b1;
|
||||
var r6a2 = a2 != b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r6a3 = a3 != b3;
|
||||
var r6a4 = a4 != b4;
|
||||
var r6a5 = a5 != b5;
|
||||
var r6a6 = a6 != b6;
|
||||
//var r6a7 = a7 != b7;
|
||||
|
||||
var r6b1 = b1 != a1;
|
||||
var r6b2 = b2 != a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r6b3 = b3 != a3;
|
||||
var r6b4 = b4 != a4;
|
||||
var r6b5 = b5 != a5;
|
||||
var r6b6 = b6 != a6;
|
||||
//var r6b7 = b7 != a7;
|
||||
|
||||
// operator ===
|
||||
var r7a1 = a1 === b1;
|
||||
var r7a2 = a2 === b2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r7a3 = a3 === b3;
|
||||
var r7a4 = a4 === b4;
|
||||
var r7a5 = a5 === b5;
|
||||
var r7a6 = a6 === b6;
|
||||
//var r7a7 = a7 === b7;
|
||||
|
||||
var r7b1 = b1 === a1;
|
||||
var r7b2 = b2 === a2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r7b3 = b3 === a3;
|
||||
var r7b4 = b4 === a4;
|
||||
var r7b5 = b5 === a5;
|
||||
var r7b6 = b6 === a6;
|
||||
//var r7b7 = b7 === a7;
|
||||
|
||||
// operator !==
|
||||
var r8a1 = a1 !== b1;
|
||||
var r8a2 = a2 !== b2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types '{ fn<T>(x: T): T; }' and '{ fn(x: string, y: number): string; }'.
|
||||
var r8a3 = a3 !== b3;
|
||||
var r8a4 = a4 !== b4;
|
||||
var r8a5 = a5 !== b5;
|
||||
var r8a6 = a6 !== b6;
|
||||
//var r8a7 = a7 !== b7;
|
||||
|
||||
var r8b1 = b1 !== a1;
|
||||
var r8b2 = b2 !== a2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn<T>(x: T): T; }'.
|
||||
var r8b3 = b3 !== a3;
|
||||
var r8b4 = b4 !== a4;
|
||||
var r8b5 = b5 !== a5;
|
||||
var r8b6 = b6 !== a6;
|
||||
//var r8b7 = b7 !== a7;
|
||||
@ -0,0 +1,727 @@
|
||||
=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts ===
|
||||
class Base {
|
||||
>Base : Base
|
||||
|
||||
public a: string;
|
||||
>a : string
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
>Derived : Derived
|
||||
>Base : Base
|
||||
|
||||
public b: string;
|
||||
>b : string
|
||||
}
|
||||
|
||||
var a1: { fn<T>(x: T): T };
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>fn : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b1: { fn(x: string): string };
|
||||
>b1 : { fn(x: string): string; }
|
||||
>fn : (x: string) => string
|
||||
>x : string
|
||||
|
||||
var a2: { fn<T>(x: T): T };
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>fn : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b2: { fn(x: string, y: number): string };
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>fn : (x: string, y: number) => string
|
||||
>x : string
|
||||
>y : number
|
||||
|
||||
var a3: { fn<T, U>(x: T, y: U): T };
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>fn : <T, U>(x: T, y: U) => T
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
>T : T
|
||||
>y : U
|
||||
>U : U
|
||||
>T : T
|
||||
|
||||
var b3: { fn(x: string, y: number): string };
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>fn : (x: string, y: number) => string
|
||||
>x : string
|
||||
>y : number
|
||||
|
||||
var a4: { fn<T>(x?: T): T };
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>fn : <T>(x?: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b4: { fn(x?: string): string };
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>fn : (x?: string) => string
|
||||
>x : string
|
||||
|
||||
var a5: { fn<T>(...x: T[]): T };
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>fn : <T>(...x: T[]) => T
|
||||
>T : T
|
||||
>x : T[]
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b5: { fn(...x: string[]): string };
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>fn : (...x: string[]) => string
|
||||
>x : string[]
|
||||
|
||||
var a6: { fn<T>(x: T, y: T): T };
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>fn : <T>(x: T, y: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>y : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b6: { fn(x: string, y: number): {} };
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>fn : (x: string, y: number) => {}
|
||||
>x : string
|
||||
>y : number
|
||||
|
||||
//var a7: { fn<T, U extends T>(x: T, y: U): T };
|
||||
var b7: { fn(x: Base, y: Derived): Base };
|
||||
>b7 : { fn(x: Base, y: Derived): Base; }
|
||||
>fn : (x: Base, y: Derived) => Base
|
||||
>x : Base
|
||||
>Base : Base
|
||||
>y : Derived
|
||||
>Derived : Derived
|
||||
>Base : Base
|
||||
|
||||
// operator <
|
||||
var r1a1 = a1 < b1;
|
||||
>r1a1 : boolean
|
||||
>a1 < b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r1a2 = a2 < b2;
|
||||
>r1a2 : boolean
|
||||
>a2 < b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r1a3 = a3 < b3;
|
||||
>r1a3 : boolean
|
||||
>a3 < b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r1a4 = a4 < b4;
|
||||
>r1a4 : boolean
|
||||
>a4 < b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r1a5 = a5 < b5;
|
||||
>r1a5 : boolean
|
||||
>a5 < b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r1a6 = a6 < b6;
|
||||
>r1a6 : boolean
|
||||
>a6 < b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r1a7 = a7 < b7;
|
||||
|
||||
var r1b1 = b1 < a1;
|
||||
>r1b1 : boolean
|
||||
>b1 < a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r1b2 = b2 < a2;
|
||||
>r1b2 : boolean
|
||||
>b2 < a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r1b3 = b3 < a3;
|
||||
>r1b3 : boolean
|
||||
>b3 < a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r1b4 = b4 < a4;
|
||||
>r1b4 : boolean
|
||||
>b4 < a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r1b5 = b5 < a5;
|
||||
>r1b5 : boolean
|
||||
>b5 < a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r1b6 = b6 < a6;
|
||||
>r1b6 : boolean
|
||||
>b6 < a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r1b7 = b7 < a7;
|
||||
|
||||
// operator >
|
||||
var r2a1 = a1 > b1;
|
||||
>r2a1 : boolean
|
||||
>a1 > b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r2a2 = a2 > b2;
|
||||
>r2a2 : boolean
|
||||
>a2 > b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r2a3 = a3 > b3;
|
||||
>r2a3 : boolean
|
||||
>a3 > b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r2a4 = a4 > b4;
|
||||
>r2a4 : boolean
|
||||
>a4 > b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r2a5 = a5 > b5;
|
||||
>r2a5 : boolean
|
||||
>a5 > b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r2a6 = a6 > b6;
|
||||
>r2a6 : boolean
|
||||
>a6 > b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r2a7 = a7 > b7;
|
||||
|
||||
var r2b1 = b1 > a1;
|
||||
>r2b1 : boolean
|
||||
>b1 > a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r2b2 = b2 > a2;
|
||||
>r2b2 : boolean
|
||||
>b2 > a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r2b3 = b3 > a3;
|
||||
>r2b3 : boolean
|
||||
>b3 > a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r2b4 = b4 > a4;
|
||||
>r2b4 : boolean
|
||||
>b4 > a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r2b5 = b5 > a5;
|
||||
>r2b5 : boolean
|
||||
>b5 > a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r2b6 = b6 > a6;
|
||||
>r2b6 : boolean
|
||||
>b6 > a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r2b7 = b7 > a7;
|
||||
|
||||
// operator <=
|
||||
var r3a1 = a1 <= b1;
|
||||
>r3a1 : boolean
|
||||
>a1 <= b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r3a2 = a2 <= b2;
|
||||
>r3a2 : boolean
|
||||
>a2 <= b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r3a3 = a3 <= b3;
|
||||
>r3a3 : boolean
|
||||
>a3 <= b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r3a4 = a4 <= b4;
|
||||
>r3a4 : boolean
|
||||
>a4 <= b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r3a5 = a5 <= b5;
|
||||
>r3a5 : boolean
|
||||
>a5 <= b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r3a6 = a6 <= b6;
|
||||
>r3a6 : boolean
|
||||
>a6 <= b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r3a7 = a7 <= b7;
|
||||
|
||||
var r3b1 = b1 <= a1;
|
||||
>r3b1 : boolean
|
||||
>b1 <= a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r3b2 = b2 <= a2;
|
||||
>r3b2 : boolean
|
||||
>b2 <= a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r3b3 = b3 <= a3;
|
||||
>r3b3 : boolean
|
||||
>b3 <= a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r3b4 = b4 <= a4;
|
||||
>r3b4 : boolean
|
||||
>b4 <= a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r3b5 = b5 <= a5;
|
||||
>r3b5 : boolean
|
||||
>b5 <= a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r3b6 = b6 <= a6;
|
||||
>r3b6 : boolean
|
||||
>b6 <= a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r3b7 = b7 <= a7;
|
||||
|
||||
// operator >=
|
||||
var r4a1 = a1 >= b1;
|
||||
>r4a1 : boolean
|
||||
>a1 >= b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r4a2 = a2 >= b2;
|
||||
>r4a2 : boolean
|
||||
>a2 >= b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r4a3 = a3 >= b3;
|
||||
>r4a3 : boolean
|
||||
>a3 >= b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r4a4 = a4 >= b4;
|
||||
>r4a4 : boolean
|
||||
>a4 >= b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r4a5 = a5 >= b5;
|
||||
>r4a5 : boolean
|
||||
>a5 >= b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r4a6 = a6 >= b6;
|
||||
>r4a6 : boolean
|
||||
>a6 >= b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r4a7 = a7 >= b7;
|
||||
|
||||
var r4b1 = b1 >= a1;
|
||||
>r4b1 : boolean
|
||||
>b1 >= a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r4b2 = b2 >= a2;
|
||||
>r4b2 : boolean
|
||||
>b2 >= a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r4b3 = b3 >= a3;
|
||||
>r4b3 : boolean
|
||||
>b3 >= a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r4b4 = b4 >= a4;
|
||||
>r4b4 : boolean
|
||||
>b4 >= a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r4b5 = b5 >= a5;
|
||||
>r4b5 : boolean
|
||||
>b5 >= a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r4b6 = b6 >= a6;
|
||||
>r4b6 : boolean
|
||||
>b6 >= a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r4b7 = b7 >= a7;
|
||||
|
||||
// operator ==
|
||||
var r5a1 = a1 == b1;
|
||||
>r5a1 : boolean
|
||||
>a1 == b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r5a2 = a2 == b2;
|
||||
>r5a2 : boolean
|
||||
>a2 == b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r5a3 = a3 == b3;
|
||||
>r5a3 : boolean
|
||||
>a3 == b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r5a4 = a4 == b4;
|
||||
>r5a4 : boolean
|
||||
>a4 == b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r5a5 = a5 == b5;
|
||||
>r5a5 : boolean
|
||||
>a5 == b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r5a6 = a6 == b6;
|
||||
>r5a6 : boolean
|
||||
>a6 == b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r5a7 = a7 == b7;
|
||||
|
||||
var r5b1 = b1 == a1;
|
||||
>r5b1 : boolean
|
||||
>b1 == a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r5b2 = b2 == a2;
|
||||
>r5b2 : boolean
|
||||
>b2 == a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r5b3 = b3 == a3;
|
||||
>r5b3 : boolean
|
||||
>b3 == a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r5b4 = b4 == a4;
|
||||
>r5b4 : boolean
|
||||
>b4 == a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r5b5 = b5 == a5;
|
||||
>r5b5 : boolean
|
||||
>b5 == a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r5b6 = b6 == a6;
|
||||
>r5b6 : boolean
|
||||
>b6 == a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r5b7 = b7 == a7;
|
||||
|
||||
// operator !=
|
||||
var r6a1 = a1 != b1;
|
||||
>r6a1 : boolean
|
||||
>a1 != b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r6a2 = a2 != b2;
|
||||
>r6a2 : boolean
|
||||
>a2 != b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r6a3 = a3 != b3;
|
||||
>r6a3 : boolean
|
||||
>a3 != b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r6a4 = a4 != b4;
|
||||
>r6a4 : boolean
|
||||
>a4 != b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r6a5 = a5 != b5;
|
||||
>r6a5 : boolean
|
||||
>a5 != b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r6a6 = a6 != b6;
|
||||
>r6a6 : boolean
|
||||
>a6 != b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r6a7 = a7 != b7;
|
||||
|
||||
var r6b1 = b1 != a1;
|
||||
>r6b1 : boolean
|
||||
>b1 != a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r6b2 = b2 != a2;
|
||||
>r6b2 : boolean
|
||||
>b2 != a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r6b3 = b3 != a3;
|
||||
>r6b3 : boolean
|
||||
>b3 != a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r6b4 = b4 != a4;
|
||||
>r6b4 : boolean
|
||||
>b4 != a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r6b5 = b5 != a5;
|
||||
>r6b5 : boolean
|
||||
>b5 != a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r6b6 = b6 != a6;
|
||||
>r6b6 : boolean
|
||||
>b6 != a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r6b7 = b7 != a7;
|
||||
|
||||
// operator ===
|
||||
var r7a1 = a1 === b1;
|
||||
>r7a1 : boolean
|
||||
>a1 === b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r7a2 = a2 === b2;
|
||||
>r7a2 : boolean
|
||||
>a2 === b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r7a3 = a3 === b3;
|
||||
>r7a3 : boolean
|
||||
>a3 === b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r7a4 = a4 === b4;
|
||||
>r7a4 : boolean
|
||||
>a4 === b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r7a5 = a5 === b5;
|
||||
>r7a5 : boolean
|
||||
>a5 === b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r7a6 = a6 === b6;
|
||||
>r7a6 : boolean
|
||||
>a6 === b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r7a7 = a7 === b7;
|
||||
|
||||
var r7b1 = b1 === a1;
|
||||
>r7b1 : boolean
|
||||
>b1 === a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r7b2 = b2 === a2;
|
||||
>r7b2 : boolean
|
||||
>b2 === a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r7b3 = b3 === a3;
|
||||
>r7b3 : boolean
|
||||
>b3 === a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r7b4 = b4 === a4;
|
||||
>r7b4 : boolean
|
||||
>b4 === a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r7b5 = b5 === a5;
|
||||
>r7b5 : boolean
|
||||
>b5 === a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r7b6 = b6 === a6;
|
||||
>r7b6 : boolean
|
||||
>b6 === a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r7b7 = b7 === a7;
|
||||
|
||||
// operator !==
|
||||
var r8a1 = a1 !== b1;
|
||||
>r8a1 : boolean
|
||||
>a1 !== b1 : boolean
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
>b1 : { fn(x: string): string; }
|
||||
|
||||
var r8a2 = a2 !== b2;
|
||||
>r8a2 : boolean
|
||||
>a2 !== b2 : boolean
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r8a3 = a3 !== b3;
|
||||
>r8a3 : boolean
|
||||
>a3 !== b3 : boolean
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
|
||||
var r8a4 = a4 !== b4;
|
||||
>r8a4 : boolean
|
||||
>a4 !== b4 : boolean
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
>b4 : { fn(x?: string): string; }
|
||||
|
||||
var r8a5 = a5 !== b5;
|
||||
>r8a5 : boolean
|
||||
>a5 !== b5 : boolean
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
|
||||
var r8a6 = a6 !== b6;
|
||||
>r8a6 : boolean
|
||||
>a6 !== b6 : boolean
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
|
||||
//var r8a7 = a7 !== b7;
|
||||
|
||||
var r8b1 = b1 !== a1;
|
||||
>r8b1 : boolean
|
||||
>b1 !== a1 : boolean
|
||||
>b1 : { fn(x: string): string; }
|
||||
>a1 : { fn<T>(x: T): T; }
|
||||
|
||||
var r8b2 = b2 !== a2;
|
||||
>r8b2 : boolean
|
||||
>b2 !== a2 : boolean
|
||||
>b2 : { fn(x: string, y: number): string; }
|
||||
>a2 : { fn<T>(x: T): T; }
|
||||
|
||||
var r8b3 = b3 !== a3;
|
||||
>r8b3 : boolean
|
||||
>b3 !== a3 : boolean
|
||||
>b3 : { fn(x: string, y: number): string; }
|
||||
>a3 : { fn<T, U>(x: T, y: U): T; }
|
||||
|
||||
var r8b4 = b4 !== a4;
|
||||
>r8b4 : boolean
|
||||
>b4 !== a4 : boolean
|
||||
>b4 : { fn(x?: string): string; }
|
||||
>a4 : { fn<T>(x?: T): T; }
|
||||
|
||||
var r8b5 = b5 !== a5;
|
||||
>r8b5 : boolean
|
||||
>b5 !== a5 : boolean
|
||||
>b5 : { fn(...x: string[]): string; }
|
||||
>a5 : { fn<T>(...x: T[]): T; }
|
||||
|
||||
var r8b6 = b6 !== a6;
|
||||
>r8b6 : boolean
|
||||
>b6 !== a6 : boolean
|
||||
>b6 : { fn(x: string, y: number): {}; }
|
||||
>a6 : { fn<T>(x: T, y: T): T; }
|
||||
|
||||
//var r8b7 = b7 !== a7;
|
||||
@ -1,215 +0,0 @@
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(40,12): error TS2365: Operator '<' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(49,12): error TS2365: Operator '>' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(57,12): error TS2365: Operator '>' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(66,12): error TS2365: Operator '<=' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(74,12): error TS2365: Operator '<=' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(83,12): error TS2365: Operator '>=' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(91,12): error TS2365: Operator '>=' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(100,12): error TS2365: Operator '==' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(108,12): error TS2365: Operator '==' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(117,12): error TS2365: Operator '!=' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(125,12): error TS2365: Operator '!=' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(134,12): error TS2365: Operator '===' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(142,12): error TS2365: Operator '===' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(151,12): error TS2365: Operator '!==' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(159,12): error TS2365: Operator '!==' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts (16 errors) ====
|
||||
class Base {
|
||||
public a: string;
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
public b: string;
|
||||
}
|
||||
|
||||
var a1: { new <T>(x: T): T };
|
||||
var b1: { new (x: string): string };
|
||||
|
||||
var a2: { new <T>(x: T): T };
|
||||
var b2: { new (x: string, y: number): string };
|
||||
|
||||
var a3: { new <T, U>(x: T, y: U): T };
|
||||
var b3: { new (x: string, y: number): string };
|
||||
|
||||
var a4: { new <T>(x?: T): T };
|
||||
var b4: { new (x?: string): string };
|
||||
|
||||
var a5: { new <T>(...x: T[]): T };
|
||||
var b5: { new (...x: string[]): string };
|
||||
|
||||
var a6: { new <T>(x: T, y: T): T };
|
||||
var b6: { new (x: string, y: number): {} };
|
||||
|
||||
//var a7: { new <T, U extends T>(x: T, y: U): T };
|
||||
var b7: { new (x: Base, y: Derived): Base };
|
||||
|
||||
// operator <
|
||||
var r1a1 = a1 < b1;
|
||||
var r1a2 = a2 < b2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r1a3 = a3 < b3;
|
||||
var r1a4 = a4 < b4;
|
||||
var r1a5 = a5 < b5;
|
||||
var r1a6 = a6 < b6;
|
||||
//var r1a7 = a7 < b7;
|
||||
|
||||
var r1b1 = b1 < a1;
|
||||
var r1b2 = b2 < a2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r1b3 = b3 < a3;
|
||||
var r1b4 = b4 < a4;
|
||||
var r1b5 = b5 < a5;
|
||||
var r1b6 = b6 < a6;
|
||||
//var r1b7 = b7 < a7;
|
||||
|
||||
// operator >
|
||||
var r2a1 = a1 > b1;
|
||||
var r2a2 = a2 > b2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r2a3 = a3 > b3;
|
||||
var r2a4 = a4 > b4;
|
||||
var r2a5 = a5 > b5;
|
||||
var r2a6 = a6 > b6;
|
||||
//var r2a7 = a7 > b7;
|
||||
|
||||
var r2b1 = b1 > a1;
|
||||
var r2b2 = b2 > a2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r2b3 = b3 > a3;
|
||||
var r2b4 = b4 > a4;
|
||||
var r2b5 = b5 > a5;
|
||||
var r2b6 = b6 > a6;
|
||||
//var r2b7 = b7 > a7;
|
||||
|
||||
// operator <=
|
||||
var r3a1 = a1 <= b1;
|
||||
var r3a2 = a2 <= b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '<=' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r3a3 = a3 <= b3;
|
||||
var r3a4 = a4 <= b4;
|
||||
var r3a5 = a5 <= b5;
|
||||
var r3a6 = a6 <= b6;
|
||||
//var r3a7 = a7 <= b7;
|
||||
|
||||
var r3b1 = b1 <= a1;
|
||||
var r3b2 = b2 <= a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '<=' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r3b3 = b3 <= a3;
|
||||
var r3b4 = b4 <= a4;
|
||||
var r3b5 = b5 <= a5;
|
||||
var r3b6 = b6 <= a6;
|
||||
//var r3b7 = b7 <= a7;
|
||||
|
||||
// operator >=
|
||||
var r4a1 = a1 >= b1;
|
||||
var r4a2 = a2 >= b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '>=' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r4a3 = a3 >= b3;
|
||||
var r4a4 = a4 >= b4;
|
||||
var r4a5 = a5 >= b5;
|
||||
var r4a6 = a6 >= b6;
|
||||
//var r4a7 = a7 >= b7;
|
||||
|
||||
var r4b1 = b1 >= a1;
|
||||
var r4b2 = b2 >= a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '>=' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r4b3 = b3 >= a3;
|
||||
var r4b4 = b4 >= a4;
|
||||
var r4b5 = b5 >= a5;
|
||||
var r4b6 = b6 >= a6;
|
||||
//var r4b7 = b7 >= a7;
|
||||
|
||||
// operator ==
|
||||
var r5a1 = a1 == b1;
|
||||
var r5a2 = a2 == b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '==' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r5a3 = a3 == b3;
|
||||
var r5a4 = a4 == b4;
|
||||
var r5a5 = a5 == b5;
|
||||
var r5a6 = a6 == b6;
|
||||
//var r5a7 = a7 == b7;
|
||||
|
||||
var r5b1 = b1 == a1;
|
||||
var r5b2 = b2 == a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '==' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r5b3 = b3 == a3;
|
||||
var r5b4 = b4 == a4;
|
||||
var r5b5 = b5 == a5;
|
||||
var r5b6 = b6 == a6;
|
||||
//var r5b7 = b7 == a7;
|
||||
|
||||
// operator !=
|
||||
var r6a1 = a1 != b1;
|
||||
var r6a2 = a2 != b2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r6a3 = a3 != b3;
|
||||
var r6a4 = a4 != b4;
|
||||
var r6a5 = a5 != b5;
|
||||
var r6a6 = a6 != b6;
|
||||
//var r6a7 = a7 != b7;
|
||||
|
||||
var r6b1 = b1 != a1;
|
||||
var r6b2 = b2 != a2;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r6b3 = b3 != a3;
|
||||
var r6b4 = b4 != a4;
|
||||
var r6b5 = b5 != a5;
|
||||
var r6b6 = b6 != a6;
|
||||
//var r6b7 = b7 != a7;
|
||||
|
||||
// operator ===
|
||||
var r7a1 = a1 === b1;
|
||||
var r7a2 = a2 === b2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r7a3 = a3 === b3;
|
||||
var r7a4 = a4 === b4;
|
||||
var r7a5 = a5 === b5;
|
||||
var r7a6 = a6 === b6;
|
||||
//var r7a7 = a7 === b7;
|
||||
|
||||
var r7b1 = b1 === a1;
|
||||
var r7b2 = b2 === a2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r7b3 = b3 === a3;
|
||||
var r7b4 = b4 === a4;
|
||||
var r7b5 = b5 === a5;
|
||||
var r7b6 = b6 === a6;
|
||||
//var r7b7 = b7 === a7;
|
||||
|
||||
// operator !==
|
||||
var r8a1 = a1 !== b1;
|
||||
var r8a2 = a2 !== b2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types 'new <T>(x: T) => T' and 'new (x: string, y: number) => string'.
|
||||
var r8a3 = a3 !== b3;
|
||||
var r8a4 = a4 !== b4;
|
||||
var r8a5 = a5 !== b5;
|
||||
var r8a6 = a6 !== b6;
|
||||
//var r8a7 = a7 !== b7;
|
||||
|
||||
var r8b1 = b1 !== a1;
|
||||
var r8b2 = b2 !== a2;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types 'new (x: string, y: number) => string' and 'new <T>(x: T) => T'.
|
||||
var r8b3 = b3 !== a3;
|
||||
var r8b4 = b4 !== a4;
|
||||
var r8b5 = b5 !== a5;
|
||||
var r8b6 = b6 !== a6;
|
||||
//var r8b7 = b7 !== a7;
|
||||
@ -0,0 +1,714 @@
|
||||
=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts ===
|
||||
class Base {
|
||||
>Base : Base
|
||||
|
||||
public a: string;
|
||||
>a : string
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
>Derived : Derived
|
||||
>Base : Base
|
||||
|
||||
public b: string;
|
||||
>b : string
|
||||
}
|
||||
|
||||
var a1: { new <T>(x: T): T };
|
||||
>a1 : new <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b1: { new (x: string): string };
|
||||
>b1 : new (x: string) => string
|
||||
>x : string
|
||||
|
||||
var a2: { new <T>(x: T): T };
|
||||
>a2 : new <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b2: { new (x: string, y: number): string };
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>x : string
|
||||
>y : number
|
||||
|
||||
var a3: { new <T, U>(x: T, y: U): T };
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
>T : T
|
||||
>y : U
|
||||
>U : U
|
||||
>T : T
|
||||
|
||||
var b3: { new (x: string, y: number): string };
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>x : string
|
||||
>y : number
|
||||
|
||||
var a4: { new <T>(x?: T): T };
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b4: { new (x?: string): string };
|
||||
>b4 : new (x?: string) => string
|
||||
>x : string
|
||||
|
||||
var a5: { new <T>(...x: T[]): T };
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>T : T
|
||||
>x : T[]
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b5: { new (...x: string[]): string };
|
||||
>b5 : new (...x: string[]) => string
|
||||
>x : string[]
|
||||
|
||||
var a6: { new <T>(x: T, y: T): T };
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>y : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b6: { new (x: string, y: number): {} };
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>x : string
|
||||
>y : number
|
||||
|
||||
//var a7: { new <T, U extends T>(x: T, y: U): T };
|
||||
var b7: { new (x: Base, y: Derived): Base };
|
||||
>b7 : new (x: Base, y: Derived) => Base
|
||||
>x : Base
|
||||
>Base : Base
|
||||
>y : Derived
|
||||
>Derived : Derived
|
||||
>Base : Base
|
||||
|
||||
// operator <
|
||||
var r1a1 = a1 < b1;
|
||||
>r1a1 : boolean
|
||||
>a1 < b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r1a2 = a2 < b2;
|
||||
>r1a2 : boolean
|
||||
>a2 < b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r1a3 = a3 < b3;
|
||||
>r1a3 : boolean
|
||||
>a3 < b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r1a4 = a4 < b4;
|
||||
>r1a4 : boolean
|
||||
>a4 < b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r1a5 = a5 < b5;
|
||||
>r1a5 : boolean
|
||||
>a5 < b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r1a6 = a6 < b6;
|
||||
>r1a6 : boolean
|
||||
>a6 < b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r1a7 = a7 < b7;
|
||||
|
||||
var r1b1 = b1 < a1;
|
||||
>r1b1 : boolean
|
||||
>b1 < a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r1b2 = b2 < a2;
|
||||
>r1b2 : boolean
|
||||
>b2 < a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r1b3 = b3 < a3;
|
||||
>r1b3 : boolean
|
||||
>b3 < a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r1b4 = b4 < a4;
|
||||
>r1b4 : boolean
|
||||
>b4 < a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r1b5 = b5 < a5;
|
||||
>r1b5 : boolean
|
||||
>b5 < a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r1b6 = b6 < a6;
|
||||
>r1b6 : boolean
|
||||
>b6 < a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r1b7 = b7 < a7;
|
||||
|
||||
// operator >
|
||||
var r2a1 = a1 > b1;
|
||||
>r2a1 : boolean
|
||||
>a1 > b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r2a2 = a2 > b2;
|
||||
>r2a2 : boolean
|
||||
>a2 > b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r2a3 = a3 > b3;
|
||||
>r2a3 : boolean
|
||||
>a3 > b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r2a4 = a4 > b4;
|
||||
>r2a4 : boolean
|
||||
>a4 > b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r2a5 = a5 > b5;
|
||||
>r2a5 : boolean
|
||||
>a5 > b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r2a6 = a6 > b6;
|
||||
>r2a6 : boolean
|
||||
>a6 > b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r2a7 = a7 > b7;
|
||||
|
||||
var r2b1 = b1 > a1;
|
||||
>r2b1 : boolean
|
||||
>b1 > a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r2b2 = b2 > a2;
|
||||
>r2b2 : boolean
|
||||
>b2 > a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r2b3 = b3 > a3;
|
||||
>r2b3 : boolean
|
||||
>b3 > a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r2b4 = b4 > a4;
|
||||
>r2b4 : boolean
|
||||
>b4 > a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r2b5 = b5 > a5;
|
||||
>r2b5 : boolean
|
||||
>b5 > a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r2b6 = b6 > a6;
|
||||
>r2b6 : boolean
|
||||
>b6 > a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r2b7 = b7 > a7;
|
||||
|
||||
// operator <=
|
||||
var r3a1 = a1 <= b1;
|
||||
>r3a1 : boolean
|
||||
>a1 <= b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r3a2 = a2 <= b2;
|
||||
>r3a2 : boolean
|
||||
>a2 <= b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r3a3 = a3 <= b3;
|
||||
>r3a3 : boolean
|
||||
>a3 <= b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r3a4 = a4 <= b4;
|
||||
>r3a4 : boolean
|
||||
>a4 <= b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r3a5 = a5 <= b5;
|
||||
>r3a5 : boolean
|
||||
>a5 <= b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r3a6 = a6 <= b6;
|
||||
>r3a6 : boolean
|
||||
>a6 <= b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r3a7 = a7 <= b7;
|
||||
|
||||
var r3b1 = b1 <= a1;
|
||||
>r3b1 : boolean
|
||||
>b1 <= a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r3b2 = b2 <= a2;
|
||||
>r3b2 : boolean
|
||||
>b2 <= a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r3b3 = b3 <= a3;
|
||||
>r3b3 : boolean
|
||||
>b3 <= a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r3b4 = b4 <= a4;
|
||||
>r3b4 : boolean
|
||||
>b4 <= a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r3b5 = b5 <= a5;
|
||||
>r3b5 : boolean
|
||||
>b5 <= a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r3b6 = b6 <= a6;
|
||||
>r3b6 : boolean
|
||||
>b6 <= a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r3b7 = b7 <= a7;
|
||||
|
||||
// operator >=
|
||||
var r4a1 = a1 >= b1;
|
||||
>r4a1 : boolean
|
||||
>a1 >= b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r4a2 = a2 >= b2;
|
||||
>r4a2 : boolean
|
||||
>a2 >= b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r4a3 = a3 >= b3;
|
||||
>r4a3 : boolean
|
||||
>a3 >= b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r4a4 = a4 >= b4;
|
||||
>r4a4 : boolean
|
||||
>a4 >= b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r4a5 = a5 >= b5;
|
||||
>r4a5 : boolean
|
||||
>a5 >= b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r4a6 = a6 >= b6;
|
||||
>r4a6 : boolean
|
||||
>a6 >= b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r4a7 = a7 >= b7;
|
||||
|
||||
var r4b1 = b1 >= a1;
|
||||
>r4b1 : boolean
|
||||
>b1 >= a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r4b2 = b2 >= a2;
|
||||
>r4b2 : boolean
|
||||
>b2 >= a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r4b3 = b3 >= a3;
|
||||
>r4b3 : boolean
|
||||
>b3 >= a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r4b4 = b4 >= a4;
|
||||
>r4b4 : boolean
|
||||
>b4 >= a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r4b5 = b5 >= a5;
|
||||
>r4b5 : boolean
|
||||
>b5 >= a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r4b6 = b6 >= a6;
|
||||
>r4b6 : boolean
|
||||
>b6 >= a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r4b7 = b7 >= a7;
|
||||
|
||||
// operator ==
|
||||
var r5a1 = a1 == b1;
|
||||
>r5a1 : boolean
|
||||
>a1 == b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r5a2 = a2 == b2;
|
||||
>r5a2 : boolean
|
||||
>a2 == b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r5a3 = a3 == b3;
|
||||
>r5a3 : boolean
|
||||
>a3 == b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r5a4 = a4 == b4;
|
||||
>r5a4 : boolean
|
||||
>a4 == b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r5a5 = a5 == b5;
|
||||
>r5a5 : boolean
|
||||
>a5 == b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r5a6 = a6 == b6;
|
||||
>r5a6 : boolean
|
||||
>a6 == b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r5a7 = a7 == b7;
|
||||
|
||||
var r5b1 = b1 == a1;
|
||||
>r5b1 : boolean
|
||||
>b1 == a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r5b2 = b2 == a2;
|
||||
>r5b2 : boolean
|
||||
>b2 == a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r5b3 = b3 == a3;
|
||||
>r5b3 : boolean
|
||||
>b3 == a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r5b4 = b4 == a4;
|
||||
>r5b4 : boolean
|
||||
>b4 == a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r5b5 = b5 == a5;
|
||||
>r5b5 : boolean
|
||||
>b5 == a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r5b6 = b6 == a6;
|
||||
>r5b6 : boolean
|
||||
>b6 == a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r5b7 = b7 == a7;
|
||||
|
||||
// operator !=
|
||||
var r6a1 = a1 != b1;
|
||||
>r6a1 : boolean
|
||||
>a1 != b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r6a2 = a2 != b2;
|
||||
>r6a2 : boolean
|
||||
>a2 != b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r6a3 = a3 != b3;
|
||||
>r6a3 : boolean
|
||||
>a3 != b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r6a4 = a4 != b4;
|
||||
>r6a4 : boolean
|
||||
>a4 != b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r6a5 = a5 != b5;
|
||||
>r6a5 : boolean
|
||||
>a5 != b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r6a6 = a6 != b6;
|
||||
>r6a6 : boolean
|
||||
>a6 != b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r6a7 = a7 != b7;
|
||||
|
||||
var r6b1 = b1 != a1;
|
||||
>r6b1 : boolean
|
||||
>b1 != a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r6b2 = b2 != a2;
|
||||
>r6b2 : boolean
|
||||
>b2 != a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r6b3 = b3 != a3;
|
||||
>r6b3 : boolean
|
||||
>b3 != a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r6b4 = b4 != a4;
|
||||
>r6b4 : boolean
|
||||
>b4 != a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r6b5 = b5 != a5;
|
||||
>r6b5 : boolean
|
||||
>b5 != a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r6b6 = b6 != a6;
|
||||
>r6b6 : boolean
|
||||
>b6 != a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r6b7 = b7 != a7;
|
||||
|
||||
// operator ===
|
||||
var r7a1 = a1 === b1;
|
||||
>r7a1 : boolean
|
||||
>a1 === b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r7a2 = a2 === b2;
|
||||
>r7a2 : boolean
|
||||
>a2 === b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r7a3 = a3 === b3;
|
||||
>r7a3 : boolean
|
||||
>a3 === b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r7a4 = a4 === b4;
|
||||
>r7a4 : boolean
|
||||
>a4 === b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r7a5 = a5 === b5;
|
||||
>r7a5 : boolean
|
||||
>a5 === b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r7a6 = a6 === b6;
|
||||
>r7a6 : boolean
|
||||
>a6 === b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r7a7 = a7 === b7;
|
||||
|
||||
var r7b1 = b1 === a1;
|
||||
>r7b1 : boolean
|
||||
>b1 === a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r7b2 = b2 === a2;
|
||||
>r7b2 : boolean
|
||||
>b2 === a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r7b3 = b3 === a3;
|
||||
>r7b3 : boolean
|
||||
>b3 === a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r7b4 = b4 === a4;
|
||||
>r7b4 : boolean
|
||||
>b4 === a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r7b5 = b5 === a5;
|
||||
>r7b5 : boolean
|
||||
>b5 === a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r7b6 = b6 === a6;
|
||||
>r7b6 : boolean
|
||||
>b6 === a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r7b7 = b7 === a7;
|
||||
|
||||
// operator !==
|
||||
var r8a1 = a1 !== b1;
|
||||
>r8a1 : boolean
|
||||
>a1 !== b1 : boolean
|
||||
>a1 : new <T>(x: T) => T
|
||||
>b1 : new (x: string) => string
|
||||
|
||||
var r8a2 = a2 !== b2;
|
||||
>r8a2 : boolean
|
||||
>a2 !== b2 : boolean
|
||||
>a2 : new <T>(x: T) => T
|
||||
>b2 : new (x: string, y: number) => string
|
||||
|
||||
var r8a3 = a3 !== b3;
|
||||
>r8a3 : boolean
|
||||
>a3 !== b3 : boolean
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
>b3 : new (x: string, y: number) => string
|
||||
|
||||
var r8a4 = a4 !== b4;
|
||||
>r8a4 : boolean
|
||||
>a4 !== b4 : boolean
|
||||
>a4 : new <T>(x?: T) => T
|
||||
>b4 : new (x?: string) => string
|
||||
|
||||
var r8a5 = a5 !== b5;
|
||||
>r8a5 : boolean
|
||||
>a5 !== b5 : boolean
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
>b5 : new (...x: string[]) => string
|
||||
|
||||
var r8a6 = a6 !== b6;
|
||||
>r8a6 : boolean
|
||||
>a6 !== b6 : boolean
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
|
||||
//var r8a7 = a7 !== b7;
|
||||
|
||||
var r8b1 = b1 !== a1;
|
||||
>r8b1 : boolean
|
||||
>b1 !== a1 : boolean
|
||||
>b1 : new (x: string) => string
|
||||
>a1 : new <T>(x: T) => T
|
||||
|
||||
var r8b2 = b2 !== a2;
|
||||
>r8b2 : boolean
|
||||
>b2 !== a2 : boolean
|
||||
>b2 : new (x: string, y: number) => string
|
||||
>a2 : new <T>(x: T) => T
|
||||
|
||||
var r8b3 = b3 !== a3;
|
||||
>r8b3 : boolean
|
||||
>b3 !== a3 : boolean
|
||||
>b3 : new (x: string, y: number) => string
|
||||
>a3 : new <T, U>(x: T, y: U) => T
|
||||
|
||||
var r8b4 = b4 !== a4;
|
||||
>r8b4 : boolean
|
||||
>b4 !== a4 : boolean
|
||||
>b4 : new (x?: string) => string
|
||||
>a4 : new <T>(x?: T) => T
|
||||
|
||||
var r8b5 = b5 !== a5;
|
||||
>r8b5 : boolean
|
||||
>b5 !== a5 : boolean
|
||||
>b5 : new (...x: string[]) => string
|
||||
>a5 : new <T>(...x: T[]) => T
|
||||
|
||||
var r8b6 = b6 !== a6;
|
||||
>r8b6 : boolean
|
||||
>b6 !== a6 : boolean
|
||||
>b6 : new (x: string, y: number) => {}
|
||||
>a6 : new <T>(x: T, y: T) => T
|
||||
|
||||
//var r8b7 = b7 !== a7;
|
||||
@ -169,7 +169,7 @@ var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
>result10 : (t: X) => any
|
||||
>t : X
|
||||
>X : X
|
||||
>true ? (m) => m.propertyX1 : (n) => n.propertyX2 : { (m: X): number; } | { (n: X): string; }
|
||||
>true ? (m) => m.propertyX1 : (n) => n.propertyX2 : ((m: X) => number) | ((n: X) => string)
|
||||
>(m) => m.propertyX1 : (m: X) => number
|
||||
>m : X
|
||||
>m.propertyX1 : number
|
||||
|
||||
@ -4,13 +4,13 @@ tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithou
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(16,5): error TS2322: Type 'A | B' is not assignable to type 'B':
|
||||
Type 'A' is not assignable to type 'B':
|
||||
Property 'propertyB' is missing in type 'A'.
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(18,5): error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => number':
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(18,5): error TS2322: Type '((m: X) => number) | ((n: X) => string)' is not assignable to type '(t: X) => number':
|
||||
Type '(n: X) => string' is not assignable to type '(t: X) => number':
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(19,5): error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => string':
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(19,5): error TS2322: Type '((m: X) => number) | ((n: X) => string)' is not assignable to type '(t: X) => string':
|
||||
Type '(m: X) => number' is not assignable to type '(t: X) => string':
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(20,5): error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => boolean':
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(20,5): error TS2322: Type '((m: X) => number) | ((n: X) => string)' is not assignable to type '(t: X) => boolean':
|
||||
Type '(m: X) => number' is not assignable to type '(t: X) => boolean':
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
|
||||
@ -43,16 +43,16 @@ tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithou
|
||||
|
||||
var result4: (t: X) => number = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => number':
|
||||
!!! error TS2322: Type '((m: X) => number) | ((n: X) => string)' is not assignable to type '(t: X) => number':
|
||||
!!! error TS2322: Type '(n: X) => string' is not assignable to type '(t: X) => number':
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
var result5: (t: X) => string = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => string':
|
||||
!!! error TS2322: Type '((m: X) => number) | ((n: X) => string)' is not assignable to type '(t: X) => string':
|
||||
!!! error TS2322: Type '(m: X) => number' is not assignable to type '(t: X) => string':
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
var result6: (t: X) => boolean = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => boolean':
|
||||
!!! error TS2322: Type '((m: X) => number) | ((n: X) => string)' is not assignable to type '(t: X) => boolean':
|
||||
!!! error TS2322: Type '(m: X) => number' is not assignable to type '(t: X) => boolean':
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
|
||||
@ -0,0 +1,35 @@
|
||||
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2451: Cannot redeclare block-scoped variable 'x'.
|
||||
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2451: Cannot redeclare block-scoped variable 'y'.
|
||||
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2451: Cannot redeclare block-scoped variable 'z'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ====
|
||||
|
||||
// Error as declaration of var would cause a write to the const value
|
||||
var x = 0;
|
||||
{
|
||||
const x = 0;
|
||||
|
||||
var x = 0;
|
||||
~
|
||||
!!! error TS2451: Cannot redeclare block-scoped variable 'x'.
|
||||
}
|
||||
|
||||
|
||||
var y = 0;
|
||||
{
|
||||
const y = 0;
|
||||
{
|
||||
var y = 0;
|
||||
~
|
||||
!!! error TS2451: Cannot redeclare block-scoped variable 'y'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const z = 0;
|
||||
var z = 0
|
||||
~
|
||||
!!! error TS2451: Cannot redeclare block-scoped variable 'z'.
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
//// [constDeclarationShadowedByVarDeclaration2.ts]
|
||||
|
||||
// No errors, const declaration is not shadowed
|
||||
function outer() {
|
||||
const x = 0;
|
||||
function inner() {
|
||||
var x = "inner";
|
||||
}
|
||||
}
|
||||
|
||||
//// [constDeclarationShadowedByVarDeclaration2.js]
|
||||
// No errors, const declaration is not shadowed
|
||||
function outer() {
|
||||
const x = 0;
|
||||
function inner() {
|
||||
var x = "inner";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/constDeclarationShadowedByVarDeclaration2.ts ===
|
||||
|
||||
// No errors, const declaration is not shadowed
|
||||
function outer() {
|
||||
>outer : () => void
|
||||
|
||||
const x = 0;
|
||||
>x : number
|
||||
|
||||
function inner() {
|
||||
>inner : () => void
|
||||
|
||||
var x = "inner";
|
||||
>x : string
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
//// [constDeclarationShadowedByVarDeclaration3.ts]
|
||||
// Ensure only checking for const declarations shadowed by vars
|
||||
class Rule {
|
||||
public regex: RegExp = new RegExp('');
|
||||
public name: string = '';
|
||||
|
||||
constructor(name: string) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
//// [constDeclarationShadowedByVarDeclaration3.js]
|
||||
// Ensure only checking for const declarations shadowed by vars
|
||||
var Rule = (function () {
|
||||
function Rule(name) {
|
||||
this.regex = new RegExp('');
|
||||
this.name = '';
|
||||
this.name = name;
|
||||
}
|
||||
return Rule;
|
||||
})();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user