Merge branch 'master' into taggedTemplates

This commit is contained in:
Ivo Gabe de Wolff 2015-02-26 08:12:52 +01:00
commit 80ff139e4a
202 changed files with 1803 additions and 453 deletions

View file

@ -10287,11 +10287,12 @@ module ts {
case SyntaxKind.StringLiteral:
// External module name in an import declaration
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) {
var importSymbol = getSymbolOfNode(node.parent.parent);
var moduleType = getTypeOfSymbol(importSymbol);
return moduleType ? moduleType.symbol : undefined;
var moduleName: Expression;
if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) &&
(<ImportDeclaration>node.parent).moduleSpecifier === node)) {
return resolveExternalModuleName(node, <LiteralExpression>node);
}
// Intentional fall-through

View file

@ -607,7 +607,7 @@ module ts {
}
var backslashOrDoubleQuote = /[\"\\]/g;
var escapedCharsRegExp = /[\0-\19\t\v\f\b\0\r\n\u2028\u2029\u0085]/g;
var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
var escapedCharsMap: Map<string> = {
"\0": "\\0",
"\t": "\\t",
@ -624,7 +624,7 @@ module ts {
};
/**
* Based heavily on the abstract 'Quote' operation from ECMA-262 (24.3.2.2),
* Based heavily on the abstract 'Quote'/ 'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
* but augmented for a few select characters.
* Note that this doesn't actually wrap the input in double quotes.
*/

View file

@ -3160,71 +3160,21 @@ module ts {
write(tokenToString(node.operatorToken.kind));
// We'd like to preserve newlines found in the original binary expression. i.e. if a user has:
//
// Foo() ||
// Bar();
//
// Then we'd like to emit it as such. It seems like we'd only need to check for a newline and
// then just indent and emit. However, that will lead to a problem with deeply nested code.
// i.e. if you have:
//
// Foo() ||
// Bar() ||
// Baz();
//
// Then we don't want to emit it as:
//
// Foo() ||
// Bar() ||
// Baz();
//
// So we only indent if the right side of the binary expression starts further in on the line
// versus the left.
var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end);
var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos));
// Check if the right expression is on a different line versus the operator itself. If so,
// we'll emit newline.
var onDifferentLine = operatorEnd.line !== rightStart.line;
if (onDifferentLine) {
// Also, if the right expression starts further in on the line than the left, then we'll indent.
var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos));
var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line);
var shouldIndent = rightStart.character > firstCharOfExpr;
if (shouldIndent) {
increaseIndent();
}
if (!nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right)) {
increaseIndent();
writeLine();
emit(node.right);
decreaseIndent();
}
else {
write(" ");
}
emit(node.right);
if (shouldIndent) {
decreaseIndent();
emit(node.right);
}
}
}
function getFirstNonWhitespaceCharacterIndexOnLine(line: number): number {
var lineStart = getLineStarts(currentSourceFile)[line];
var text = currentSourceFile.text;
for (var i = lineStart; i < text.length; i++) {
var ch = text.charCodeAt(i);
if (!isWhiteSpace(text.charCodeAt(i)) || isLineBreak(ch)) {
break;
}
}
return i - lineStart;
}
function emitConditionalExpression(node: ConditionalExpression) {
emit(node.condition);
write(" ? ");
@ -4064,58 +4014,21 @@ module ts {
}
function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) {
// If the body has no statements, and we know there's no code that would cause any
// prologue to be emitted, then just do a simple emit if the empty block.
if (body.statements.length === 0 && !anyParameterHasBindingPatternOrInitializer(node)) {
emitFunctionBodyWithNoStatements(node, body);
}
else {
emitFunctionBodyWithStatements(node, body);
}
}
function anyParameterHasBindingPatternOrInitializer(func: FunctionLikeDeclaration) {
return forEach(func.parameters, hasBindingPatternOrInitializer);
}
function hasBindingPatternOrInitializer(parameter: ParameterDeclaration) {
return parameter.initializer || isBindingPattern(parameter.name);
}
function emitFunctionBodyWithNoStatements(node: FunctionLikeDeclaration, body: Block) {
var singleLine = isSingleLineEmptyBlock(node.body);
write(" {");
if (singleLine) {
write(" ");
}
else {
increaseIndent();
writeLine();
}
emitLeadingCommentsOfPosition(body.statements.end);
if (!singleLine) {
decreaseIndent();
}
emitToken(SyntaxKind.CloseBraceToken, body.statements.end);
}
function emitFunctionBodyWithStatements(node: FunctionLikeDeclaration, body: Block) {
write(" {");
scopeEmitStart(node);
var outPos = writer.getTextPos();
var initialTextPos = writer.getTextPos();
increaseIndent();
emitDetachedComments(body.statements);
// Emit all the directive prologues (like "use strict"). These have to come before
// any other preamble code we write (like parameter initializers).
var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true);
emitFunctionBodyPreamble(node);
decreaseIndent();
var preambleEmitted = writer.getTextPos() !== outPos;
var preambleEmitted = writer.getTextPos() !== initialTextPos;
if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) {
for (var i = 0, n = body.statements.length; i < n; i++) {

View file

@ -177,10 +177,15 @@ module ts {
return { diagnostics: [], sourceMaps: undefined, emitSkipped: true };
}
// Create the emit resolver outside of the "emitTime" tracking code below. That way
// any cost associated with it (like type checking) are appropriate associated with
// the type-checking counter.
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
var start = new Date().getTime();
var emitResult = emitFiles(
getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile),
emitResolver,
getEmitHost(writeFileCallback),
sourceFile);

View file

@ -745,6 +745,12 @@ module ts {
}
var parent = name.parent;
if (parent.kind === SyntaxKind.ImportSpecifier || parent.kind === SyntaxKind.ExportSpecifier) {
if ((<ImportOrExportSpecifier>parent).propertyName) {
return true;
}
}
if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) {
return (<Declaration>parent).name === name;
}

View file

@ -101,13 +101,7 @@ module ts.server {
}
getScriptFileNames() {
var filenames: string[] = [];
for (var filename in this.filenameToScript) {
if (this.filenameToScript[filename] && this.filenameToScript[filename].isOpen) {
filenames.push(filename);
}
}
return filenames;
return this.roots.map(root => root.fileName);
}
getScriptVersion(filename: string) {
@ -536,15 +530,35 @@ module ts.server {
updateProjectStructure() {
this.log("updating project structure from ...", "Info");
this.printProjects();
// First loop through all open files that are referenced by projects but are not
// project roots. For each referenced file, see if the default project still
// references that file. If so, then just keep the file in the referenced list.
// If not, add the file to an unattached list, to be rechecked later.
var openFilesReferenced: ScriptInfo[] = [];
var unattachedOpenFiles: ScriptInfo[] = [];
for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) {
var refdFile = this.openFilesReferenced[i];
refdFile.defaultProject.updateGraph();
var sourceFile = refdFile.defaultProject.getSourceFile(refdFile);
if (!sourceFile) {
this.openFilesReferenced = copyListRemovingItem(refdFile, this.openFilesReferenced);
this.addOpenFile(refdFile);
var referencedFile = this.openFilesReferenced[i];
referencedFile.defaultProject.updateGraph();
var sourceFile = referencedFile.defaultProject.getSourceFile(referencedFile);
if (sourceFile) {
openFilesReferenced.push(referencedFile);
}
else {
unattachedOpenFiles.push(referencedFile);
}
}
this.openFilesReferenced = openFilesReferenced;
// Then, loop through all of the open files that are project roots.
// For each root file, note the project that it roots. Then see if
// any other projects newly reference the file. If zero projects
// newly reference the file, keep it as a root. If one or more
// projects newly references the file, remove its project from the
// inferred projects list (since it is no longer a root) and add
// the file to the open, referenced file list.
var openFileRoots: ScriptInfo[] = [];
for (var i = 0, len = this.openFileRoots.length; i < len; i++) {
var rootFile = this.openFileRoots[i];
@ -555,12 +569,19 @@ module ts.server {
openFileRoots.push(rootFile);
}
else {
// remove project from inferred projects list
// remove project from inferred projects list because root captured
this.inferredProjects = copyListRemovingItem(rootedProject, this.inferredProjects);
this.openFilesReferenced.push(rootFile);
}
}
this.openFileRoots = openFileRoots;
// Finally, if we found any open, referenced files that are no longer
// referenced by their default project, treat them as newly opened
// by the editor.
for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) {
this.addOpenFile(unattachedOpenFiles[i]);
}
this.printProjects();
}

View file

@ -206,7 +206,10 @@ module ts.server {
}
};
var ioSession = new IOSession(ts.sys, logger);
process.on('uncaughtException', function(err: Error) {
ioSession.logError(err, "unknown");
});
// Start listening
new IOSession(ts.sys, logger).listen();
ioSession.listen();
}

View file

@ -181,18 +181,29 @@ module ts.server {
}
semanticCheck(file: string, project: Project) {
var diags = project.compilerService.languageService.getSemanticDiagnostics(file);
if (diags) {
var bakedDiags = diags.map((diag) => formatDiag(file, project, diag));
this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag");
try {
var diags = project.compilerService.languageService.getSemanticDiagnostics(file);
if (diags) {
var bakedDiags = diags.map((diag) => formatDiag(file, project, diag));
this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag");
}
}
catch (err) {
this.logError(err, "semantic check");
}
}
syntacticCheck(file: string, project: Project) {
var diags = project.compilerService.languageService.getSyntacticDiagnostics(file);
if (diags) {
var bakedDiags = diags.map((diag) => formatDiag(file, project, diag));
this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag");
try {
var diags = project.compilerService.languageService.getSyntacticDiagnostics(file);
if (diags) {
var bakedDiags = diags.map((diag) => formatDiag(file, project, diag));
this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag");
}
}
catch (err) {
this.logError(err, "syntactic check");
}
}
@ -553,10 +564,7 @@ module ts.server {
compilerService.host.editScript(file, start, end, insertString);
this.changeSeq++;
}
// update project structure on idle commented out
// until we can have the host return only the root files
// from getScriptFileNames()
//this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq);
this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq);
}
}

View file

@ -178,7 +178,15 @@ module ts.BreakpointResolver {
case SyntaxKind.ImportEqualsDeclaration:
// import statement without including semicolon
return textSpan(node,(<ImportEqualsDeclaration>node).moduleReference);
return textSpan(node, (<ImportEqualsDeclaration>node).moduleReference);
case SyntaxKind.ImportDeclaration:
// import statement without including semicolon
return textSpan(node, (<ImportDeclaration>node).moduleSpecifier);
case SyntaxKind.ExportDeclaration:
// import statement without including semicolon
return textSpan(node, (<ExportDeclaration>node).moduleSpecifier);
case SyntaxKind.ModuleDeclaration:
// span on complete module if it is instantiated

View file

@ -50,6 +50,38 @@ module ts.NavigationBar {
case SyntaxKind.ArrayBindingPattern:
forEach((<BindingPattern>node).elements, visit);
break;
case SyntaxKind.ExportDeclaration:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if ((<ExportDeclaration>node).exportClause) {
forEach((<ExportDeclaration>node).exportClause.elements, visit);
}
break;
case SyntaxKind.ImportDeclaration:
var importClause = (<ImportDeclaration>node).importClause;
if (importClause) {
// Handle default import case e.g.:
// import d from "mod";
if (importClause.name) {
childNodes.push(importClause);
}
// Handle named bindings in imports e.g.:
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
childNodes.push(importClause.namedBindings);
}
else {
forEach((<NamedImports>importClause.namedBindings).elements, visit);
}
}
}
break;
case SyntaxKind.BindingElement:
case SyntaxKind.VariableDeclaration:
if (isBindingPattern((<VariableDeclaration>node).name)) {
@ -62,7 +94,11 @@ module ts.NavigationBar {
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ExportSpecifier:
childNodes.push(node);
break;
}
}
@ -291,9 +327,16 @@ module ts.NavigationBar {
else {
return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement);
}
case SyntaxKind.Constructor:
return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement);
case SyntaxKind.ExportSpecifier:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportClause:
case SyntaxKind.NamespaceImport:
return createItem(node, getTextOfNode((<Declaration>node).name), ts.ScriptElementKind.alias);
}
return undefined;

View file

@ -802,6 +802,11 @@ module ts {
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ExportSpecifier:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportClause:
case SyntaxKind.NamespaceImport:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.TypeLiteral:
@ -841,6 +846,37 @@ module ts {
case SyntaxKind.PropertySignature:
namedDeclarations.push(<Declaration>node);
break;
case SyntaxKind.ExportDeclaration:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if ((<ExportDeclaration>node).exportClause) {
forEach((<ExportDeclaration>node).exportClause.elements, visit);
}
break;
case SyntaxKind.ImportDeclaration:
var importClause = (<ImportDeclaration>node).importClause;
if (importClause) {
// Handle default import case e.g.:
// import d from "mod";
if (importClause.name) {
namedDeclarations.push(importClause);
}
// Handle named bindings in imports e.g.:
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
namedDeclarations.push(<NamespaceImport>importClause.namedBindings);
}
else {
forEach((<NamedImports>importClause.namedBindings).elements, visit);
}
}
}
break;
}
});
@ -2010,6 +2046,12 @@ module ts {
case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement;
case SyntaxKind.EnumMember: return ScriptElementKind.variableElement;
case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement;
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ImportClause:
case SyntaxKind.ExportSpecifier:
case SyntaxKind.NamespaceImport:
return ScriptElementKind.alias;
}
return ScriptElementKind.unknown;
}
@ -3292,6 +3334,17 @@ module ts {
return undefined;
}
// If this is an alias, and the request came at the declaration location
// get the aliased symbol instead. This allows for goto def on an import e.g.
// import {A, B} from "mod";
// to jump to the implementation directelly.
if (symbol.flags & SymbolFlags.Import) {
var declaration = symbol.declarations[0];
if (node.kind === SyntaxKind.Identifier && node.parent === declaration) {
symbol = typeInfoResolver.getAliasedSymbol(symbol);
}
}
var result: DefinitionInfo[] = [];
// Because name in short-hand property assignment has two different meanings: property name and property value,
@ -4022,7 +4075,7 @@ module ts {
var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations);
// Get the text to search for, we need to normalize it as external module names will have quote
var declaredName = getDeclaredName(symbol);
var declaredName = getDeclaredName(symbol, node);
// Try to get the smallest valid scope that we can limit our search to;
// otherwise we'll need to search globally (i.e. include each file).
@ -4039,7 +4092,7 @@ module ts {
getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result);
}
else {
var internedName = getInternedName(symbol, declarations)
var internedName = getInternedName(symbol, node, declarations)
forEach(sourceFiles, sourceFile => {
cancellationToken.throwIfCancellationRequested();
@ -4059,13 +4112,51 @@ module ts {
return result;
function getDeclaredName(symbol: Symbol) {
function isImportOrExportSpecifierName(location: Node): boolean {
return location.parent &&
(location.parent.kind === SyntaxKind.ImportSpecifier || location.parent.kind === SyntaxKind.ExportSpecifier) &&
(<ImportOrExportSpecifier>location.parent).propertyName === location;
}
function isImportOrExportSpecifierImportSymbol(symbol: Symbol) {
return (symbol.flags & SymbolFlags.Import) && forEach(symbol.declarations, declaration => {
return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier;
});
}
function getDeclaredName(symbol: Symbol, location: Node) {
// Special case for function expressions, whose names are solely local to their bodies.
var functionExpression = forEach(symbol.declarations, d => d.kind === SyntaxKind.FunctionExpression ? <FunctionExpression>d : undefined);
// When a name gets interned into a SourceFile's 'identifiers' Map,
// its name is escaped and stored in the same way its symbol name/identifier
// name should be stored. Function expressions, however, are a special case,
// because despite sometimes having a name, the binder unconditionally binds them
// to a symbol with the name "__function".
if (functionExpression && functionExpression.name) {
var name = functionExpression.name.text;
}
// If this is an export or import specifier it could have been renamed using the as syntax.
// if so we want to search for whatever under the cursor, the symbol is pointing to the alias (name)
// so check for the propertyName.
if (isImportOrExportSpecifierName(location)) {
return location.getText();
}
var name = typeInfoResolver.symbolToString(symbol);
return stripQuotes(name);
}
function getInternedName(symbol: Symbol, declarations: Declaration[]): string {
function getInternedName(symbol: Symbol, location: Node, declarations: Declaration[]): string {
// If this is an export or import specifier it could have been renamed using the as syntax.
// if so we want to search for whatever under the cursor, the symbol is pointing to the alias (name)
// so check for the propertyName.
if (isImportOrExportSpecifierName(location)) {
return location.getText();
}
// Special case for function expressions, whose names are solely local to their bodies.
var functionExpression = forEach(declarations, d => d.kind === SyntaxKind.FunctionExpression ? <FunctionExpression>d : undefined);
@ -4094,16 +4185,22 @@ module ts {
function getSymbolScope(symbol: Symbol): Node {
// If this is private property or method, the scope is the containing class
if (symbol.getFlags() && (SymbolFlags.Property | SymbolFlags.Method)) {
if (symbol.flags & (SymbolFlags.Property | SymbolFlags.Method)) {
var privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined);
if (privateDeclaration) {
return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration);
}
}
// If the symbol is an import we would like to find it if we are looking for what it imports.
// So consider it visibile outside its declaration scope.
if (symbol.flags & SymbolFlags.Import) {
return undefined;
}
// if this symbol is visible from its parent container, e.g. exported, then bail out
// if symbol correspond to the union property - bail out
if (symbol.parent || (symbol.getFlags() & SymbolFlags.UnionProperty)) {
if (symbol.parent || (symbol.flags & SymbolFlags.UnionProperty)) {
return undefined;
}
@ -4458,6 +4555,11 @@ module ts {
// The search set contains at least the current symbol
var result = [symbol];
// If the symbol is an alias, add what it alaises to the list
if (isImportOrExportSpecifierImportSymbol(symbol)) {
result.push(typeInfoResolver.getAliasedSymbol(symbol));
}
// If the location is in a context sensitive location (i.e. in an object literal) try
// to get a contextual type for it, and add the property symbol from the contextual
// type to the search set
@ -4534,6 +4636,13 @@ module ts {
return true;
}
// If the reference symbol is an alias, check if what it is aliasing is one of the search
// symbols.
if (isImportOrExportSpecifierImportSymbol(referenceSymbol) &&
searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) {
return true;
}
// If the reference location is in an object literal, try to get the contextual type for the
// object literal, lookup the property symbol in the contextual type, and use this symbol to
// compare to our searchSymbol
@ -4744,12 +4853,18 @@ module ts {
case SyntaxKind.NamedImports:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ExportAssignment:
case SyntaxKind.ExportDeclaration:
return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace;
// An external module can be a Value
case SyntaxKind.SourceFile:
return SemanticMeaning.Namespace | SemanticMeaning.Value;
}
return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace;
Debug.fail("Unknown declaration type");
}

View file

@ -13,7 +13,7 @@ obj[Symbol.foo];
//// [ES5SymbolProperty1.js]
var Symbol;
var obj = (_a = {}, _a[Symbol.foo] =
0,
_a);
0,
_a);
obj[Symbol.foo];
var _a;

View file

@ -3,6 +3,6 @@ var v = { [yield]: foo }
//// [FunctionDeclaration8_es6.js]
var v = (_a = {}, _a[yield] =
foo,
_a);
foo,
_a);
var _a;

View file

@ -6,7 +6,7 @@ function * foo() {
//// [FunctionDeclaration9_es6.js]
function foo() {
var v = (_a = {}, _a[] =
foo,
_a);
foo,
_a);
var _a;
}

View file

@ -3,5 +3,5 @@ var v = { *[foo()]() { } }
//// [FunctionPropertyAssignments5_es6.js]
var v = (_a = {}, _a[foo()] = function () { },
_a);
_a);
var _a;

View file

@ -10,12 +10,22 @@ var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function () { },
set: function () {
var v = [];
for (var _i = 0; _i < arguments.length; _i++) {
v[_i - 0] = arguments[_i];
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function () { },
set: function () {
var v2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
v2[_i - 0] = arguments[_i];
}
},
enumerable: true,
configurable: true
});

View file

@ -5,5 +5,10 @@ panic([], 'one', 'two');
//// [arrayLiteralInNonVarArgParameter.js]
function panic(val) { }
function panic(val) {
var opt = [];
for (var _i = 1; _i < arguments.length; _i++) {
opt[_i - 1] = arguments[_i];
}
}
panic([], 'one', 'two');

View file

@ -38,8 +38,8 @@ y
var x = 1;
var y = 1;
var z = x +
+ +y;
+ +y;
var a = 1;
var b = 1;
var c = x -
- -y;
- -y;

View file

@ -20,6 +20,11 @@ interface Base2 {
var Derived2 = (function () {
function Derived2() {
}
Derived2.prototype.method = function () { };
Derived2.prototype.method = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
};
return Derived2;
})();

View file

@ -0,0 +1,17 @@
1 >export * from "a";
~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17}
>export * from "a"
>:=> (line 1, col 0) to (line 1, col 17)
--------------------------------
2 >export {a as A} from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (19 to 44) SpanInfo: {"start":19,"length":24}
>export {a as A} from "a"
>:=> (line 2, col 0) to (line 2, col 24)
--------------------------------
3 >export import e = require("a");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (45 to 75) SpanInfo: {"start":45,"length":30}
>export import e = require("a")
>:=> (line 3, col 0) to (line 3, col 30)

View file

@ -0,0 +1,35 @@
1 >import * as NS from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 24) SpanInfo: {"start":0,"length":23}
>import * as NS from "a"
>:=> (line 1, col 0) to (line 1, col 23)
--------------------------------
2 >import {a as A} from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 50) SpanInfo: {"start":25,"length":24}
>import {a as A} from "a"
>:=> (line 2, col 0) to (line 2, col 24)
--------------------------------
3 > import d from "a";
~~~~~~~~~~~~~~~~~~~~ => Pos: (51 to 70) SpanInfo: {"start":52,"length":17}
>import d from "a"
>:=> (line 3, col 1) to (line 3, col 18)
--------------------------------
4 >import d2, {c, d as D} from "a";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (71 to 103) SpanInfo: {"start":71,"length":31}
>import d2, {c, d as D} from "a"
>:=> (line 4, col 0) to (line 4, col 31)
--------------------------------
5 >import "a";
~~~~~~~~~~~~ => Pos: (104 to 115) SpanInfo: {"start":104,"length":10}
>import "a"
>:=> (line 5, col 0) to (line 5, col 10)
--------------------------------
6 >import e = require("a");
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (116 to 139) SpanInfo: {"start":116,"length":23}
>import e = require("a")
>:=> (line 6, col 0) to (line 6, col 23)

View file

@ -61,6 +61,10 @@ var __extends = this.__extends || function (d, b) {
d.prototype = new __();
};
function foo(x, y) {
var z = [];
for (var _i = 2; _i < arguments.length; _i++) {
z[_i - 2] = arguments[_i];
}
}
var a;
var z;
@ -89,6 +93,10 @@ var C = (function () {
this.foo.apply(this, [x, y].concat(z));
}
C.prototype.foo = function (x, y) {
var z = [];
for (var _i = 2; _i < arguments.length; _i++) {
z[_i - 2] = arguments[_i];
}
};
return C;
})();

View file

@ -56,6 +56,10 @@ function f3NoError() {
var _i = 10; // no error
}
function f4(_i) {
var rest = [];
for (var _a = 1; _a < arguments.length; _a++) {
rest[_a - 1] = arguments[_a];
}
}
function f4NoError(_i) {
}

View file

@ -47,6 +47,10 @@ function foo() {
var _i = 10; // no error
}
function f4(_i) {
var rest = [];
for (var _a = 1; _a < arguments.length; _a++) {
rest[_a - 1] = arguments[_a];
}
}
function f4NoError(_i) {
}

View file

@ -21,5 +21,5 @@ var s;
var n;
var a;
var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { },
_a);
_a);
var _a;

View file

@ -21,5 +21,5 @@ var s;
var n;
var a;
var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a);
_a);
var _a;

View file

@ -8,7 +8,7 @@ function foo() {
//// [computedPropertyNames18_ES5.js]
function foo() {
var obj = (_a = {}, _a[this.bar] =
0,
_a);
0,
_a);
var _a;
}

View file

@ -9,7 +9,7 @@ module M {
var M;
(function (M) {
var obj = (_a = {}, _a[this.bar] =
0,
_a);
0,
_a);
var _a;
})(M || (M = {}));

View file

@ -6,5 +6,5 @@ var v = {
//// [computedPropertyNames1_ES5.js]
var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a);
_a);
var _a;

View file

@ -5,6 +5,6 @@ var obj = {
//// [computedPropertyNames20_ES5.js]
var obj = (_a = {}, _a[this.bar] =
0,
_a);
0,
_a);
var _a;

View file

@ -14,7 +14,7 @@ var C = (function () {
}
C.prototype.bar = function () {
var obj = (_a = {}, _a[this.bar()] = function () { },
_a);
_a);
return 0;
var _a;
};

View file

@ -16,8 +16,8 @@ var C = (function () {
return 0;
};
C.prototype[(_a = {}, _a[this.bar()] =
1,
_a)[0]] = function () { };
1,
_a)[0]] = function () { };
return C;
})();
var _a;

View file

@ -35,7 +35,7 @@ var C = (function (_super) {
}
C.prototype.foo = function () {
var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { },
_a);
_a);
return 0;
var _a;
};

View file

@ -35,8 +35,8 @@ var C = (function (_super) {
// Gets emitted as super, not _super, which is consistent with
// use of super in static properties initializers.
C.prototype[(_a = {}, _a[super.bar.call(this)] =
1,
_a)[0]] = function () { };
1,
_a)[0]] = function () { };
return C;
})(Base);
var _a;

View file

@ -27,7 +27,7 @@ var C = (function (_super) {
function C() {
_super.call(this);
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
_a);
_a);
var _a;
}
return C;

View file

@ -18,7 +18,7 @@ var C = (function () {
var _this = this;
(function () {
var obj = (_a = {}, _a[_this.bar()] = function () { },
_a);
_a);
var _a;
});
return 0;

View file

@ -33,7 +33,7 @@ var C = (function (_super) {
_super.call(this);
(function () {
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
_a);
_a);
var _a;
});
}

View file

@ -39,7 +39,7 @@ var C = (function (_super) {
var _this = this;
(function () {
var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { },
_a);
_a);
var _a;
});
return 0;

View file

@ -16,7 +16,7 @@ var C = (function () {
}
C.prototype.bar = function () {
var obj = (_a = {}, _a[foo()] = function () { },
_a);
_a);
return 0;
var _a;
};

View file

@ -16,7 +16,7 @@ var C = (function () {
}
C.bar = function () {
var obj = (_a = {}, _a[foo()] = function () { },
_a);
_a);
return 0;
var _a;
};

View file

@ -5,6 +5,6 @@ var o = {
//// [computedPropertyNames46_ES5.js]
var o = (_a = {}, _a["" || 0] =
0,
_a);
0,
_a);
var _a;

View file

@ -15,6 +15,6 @@ var E2;
E2[E2["x"] = 0] = "x";
})(E2 || (E2 = {}));
var o = (_a = {}, _a[0 /* x */ || 0 /* x */] =
0,
_a);
0,
_a);
var _a;

View file

@ -24,12 +24,12 @@ var E;
})(E || (E = {}));
var a;
extractIndexer((_a = {}, _a[a] =
"",
_a)); // Should return string
"",
_a)); // Should return string
extractIndexer((_b = {}, _b[0 /* x */] =
"",
_b)); // Should return string
"",
_b)); // Should return string
extractIndexer((_c = {}, _c["" || 0] =
"",
_c)); // Should return any (widened form of undefined)
"",
_c)); // Should return any (widened form of undefined)
var _a, _b, _c;

View file

@ -29,7 +29,7 @@ var x = {
var x = (_a = {
p1: 10
}, _a.p1 =
10, _a[1 + 1] = Object.defineProperty({ get: function () {
10, _a[1 + 1] = Object.defineProperty({ get: function () {
throw 10;
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () {
return 10;
@ -41,6 +41,6 @@ var x = (_a = {
return 10;
}
}, enumerable: true, configurable: true }), _a.p2 =
20,
_a);
20,
_a);
var _a;

View file

@ -21,16 +21,16 @@ var s;
var n;
var a;
var v = (_a = {}, _a[s] =
0, _a[n] =
n, _a[s + s] =
1, _a[s + n] =
2, _a[+s] =
s, _a[""] =
0, _a[0] =
0, _a[a] =
1, _a[true] =
0, _a["hello bye"] =
0, _a["hello " + a + " bye"] =
0,
_a);
0, _a[n] =
n, _a[s + s] =
1, _a[s + n] =
2, _a[+s] =
s, _a[""] =
0, _a[0] =
0, _a[a] =
1, _a[true] =
0, _a["hello bye"] =
0, _a["hello " + a + " bye"] =
0,
_a);
var _a;

View file

@ -34,7 +34,7 @@ var x = (_a = {
}
}
}, _a.p1 =
10, _a.foo = Object.defineProperty({ get: function () {
10, _a.foo = Object.defineProperty({ get: function () {
if (1 == 1) {
return 10;
}
@ -46,6 +46,6 @@ var x = (_a = {
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () {
return 10;
}, enumerable: true, configurable: true }), _a.p2 =
20,
_a);
20,
_a);
var _a;

View file

@ -12,11 +12,11 @@ var v = {
//// [computedPropertyNames5_ES5.js]
var b;
var v = (_a = {}, _a[b] =
0, _a[true] =
1, _a[[]] =
0, _a[{}] =
0, _a[undefined] =
undefined, _a[null] =
null,
_a);
0, _a[true] =
1, _a[[]] =
0, _a[{}] =
0, _a[undefined] =
undefined, _a[null] =
null,
_a);
var _a;

View file

@ -13,8 +13,8 @@ var p1;
var p2;
var p3;
var v = (_a = {}, _a[p1] =
0, _a[p2] =
1, _a[p3] =
2,
_a);
0, _a[p2] =
1, _a[p3] =
2,
_a);
var _a;

View file

@ -12,6 +12,6 @@ var E;
E[E["member"] = 0] = "member";
})(E || (E = {}));
var v = (_a = {}, _a[0 /* member */] =
0,
_a);
0,
_a);
var _a;

View file

@ -13,8 +13,8 @@ function f() {
var t;
var u;
var v = (_a = {}, _a[t] =
0, _a[u] =
1,
_a);
0, _a[u] =
1,
_a);
var _a;
}

View file

@ -13,8 +13,8 @@ var v = {
//// [computedPropertyNames9_ES5.js]
function f(x) { }
var v = (_a = {}, _a[f("")] =
0, _a[f(0)] =
0, _a[f(true)] =
0,
_a);
0, _a[f(0)] =
0, _a[f(true)] =
0,
_a);
var _a;

View file

@ -10,7 +10,7 @@ var o: I = {
//// [computedPropertyNamesContextualType10_ES5.js]
var o = (_a = {}, _a[+"foo"] =
"", _a[+"bar"] =
0,
_a);
"", _a[+"bar"] =
0,
_a);
var _a;

View file

@ -11,6 +11,6 @@ var o: I = {
//// [computedPropertyNamesContextualType1_ES5.js]
var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] =
function (y) { return y.length; },
_a);
function (y) { return y.length; },
_a);
var _a;

View file

@ -11,6 +11,6 @@ var o: I = {
//// [computedPropertyNamesContextualType2_ES5.js]
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] =
function (y) { return y.length; },
_a);
function (y) { return y.length; },
_a);
var _a;

View file

@ -10,6 +10,6 @@ var o: I = {
//// [computedPropertyNamesContextualType3_ES5.js]
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] =
function (y) { return y.length; },
_a);
function (y) { return y.length; },
_a);
var _a;

View file

@ -11,7 +11,7 @@ var o: I = {
//// [computedPropertyNamesContextualType4_ES5.js]
var o = (_a = {}, _a["" + "foo"] =
"", _a["" + "bar"] =
0,
_a);
"", _a["" + "bar"] =
0,
_a);
var _a;

View file

@ -11,7 +11,7 @@ var o: I = {
//// [computedPropertyNamesContextualType5_ES5.js]
var o = (_a = {}, _a[+"foo"] =
"", _a[+"bar"] =
0,
_a);
"", _a[+"bar"] =
0,
_a);
var _a;

View file

@ -18,10 +18,10 @@ foo((_a = {
p: "",
0: function () { }
}, _a.p =
"", _a[0] =
function () { }, _a["hi" + "bye"] =
true, _a[0 + 1] =
0, _a[+"hi"] =
[0],
_a));
"", _a[0] =
function () { }, _a["hi" + "bye"] =
true, _a[0 + 1] =
0, _a[+"hi"] =
[0],
_a));
var _a;

View file

@ -18,10 +18,10 @@ foo((_a = {
p: "",
0: function () { }
}, _a.p =
"", _a[0] =
function () { }, _a["hi" + "bye"] =
true, _a[0 + 1] =
0, _a[+"hi"] =
[0],
_a));
"", _a[0] =
function () { }, _a["hi" + "bye"] =
true, _a[0 + 1] =
0, _a[+"hi"] =
[0],
_a));
var _a;

View file

@ -11,7 +11,7 @@ var o: I = {
//// [computedPropertyNamesContextualType8_ES5.js]
var o = (_a = {}, _a["" + "foo"] =
"", _a["" + "bar"] =
0,
_a);
"", _a["" + "bar"] =
0,
_a);
var _a;

View file

@ -11,7 +11,7 @@ var o: I = {
//// [computedPropertyNamesContextualType9_ES5.js]
var o = (_a = {}, _a[+"foo"] =
"", _a[+"bar"] =
0,
_a);
"", _a[+"bar"] =
0,
_a);
var _a;

View file

@ -8,8 +8,8 @@ var v = {
//// [computedPropertyNamesDeclarationEmit5_ES5.js]
var v = (_a = {}, _a["" + ""] =
0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }),
_a);
0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }),
_a);
var _a;

View file

@ -9,6 +9,6 @@ var v = {
var v = (_a = {}, _a["hello"] = function () {
debugger;
},
_a);
_a);
var _a;
//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map

View file

@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;IACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"}

View file

@ -99,7 +99,7 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
1 >
2 >^
3 >
4 > ^^^^->
4 > ^^^^^^^^->
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1)
1 >
@ -114,45 +114,44 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0)
3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0)
---
>>>_a);
1->
2 >^^
3 >
4 > ^
5 > ^
6 > ^^^^->
1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1->
2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 >
3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
3 >
4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1)
4 >
5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1)
5 >
1->Emitted(4, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0)
3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0)
4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0)
5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0)
---
>>>var _a;
>>> _a);
1->^^^^
2 > ^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
3 >
4 > ^
5 > ^
1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1->
2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 >
1->Emitted(5, 5) Source(1, 1) + SourceIndex(0)
3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
3 >
4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1)
4 >
5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1)
5 >
1->Emitted(4, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0)
3 >Emitted(4, 7) Source(0, NaN) + SourceIndex(0)
4 >Emitted(4, 8) Source(5, 2) + SourceIndex(0)
5 >Emitted(4, 9) Source(5, 2) + SourceIndex(0)
---
>>>var _a;
1 >^^^^
2 > ^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1 >
2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 5) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 >
1 >Emitted(5, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0)
---
!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded

View file

@ -315,7 +315,7 @@ var TypeScriptAllInOne;
if (retValue === void 0) { retValue = != 0; }
return 1;
^
retValue;
retValue;
bfs.TYPES();
if (retValue != 0) {
return 1 &&
@ -543,7 +543,7 @@ while ()
rest: string[];
{
&
public;
public;
DefaultValue(value ? : string = "Hello");
{ }
}

File diff suppressed because one or more lines are too long

View file

@ -2210,8 +2210,8 @@ sourceFile:contextualTyping.ts
2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0)
3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0)
4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0)
5 >Emitted(87, 20) Source(146, 40) + SourceIndex(0)
6 >Emitted(87, 21) Source(146, 41) + SourceIndex(0)
5 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) name (c9t5)
6 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) name (c9t5)
---
>>>;
1 >

View file

@ -11,7 +11,12 @@ var f6 = () => { return [<any>10]; }
//// [declFileRestParametersOfFunctionAndFunctionType.js]
function f1() { }
function f1() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
}
function f2(x) { }
function f3(x) { }
function f4() { }

View file

@ -431,7 +431,7 @@ exports.tests = (function () {
}));
testRunner.addTest(new TestCase("Check binary file doesn't match", function () {
return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") &&
!FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll"));
!FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll"));
}));
// Command-line parameter tests
testRunner.addTest(new TestCase("Check App defaults", function () {

View file

@ -10,7 +10,12 @@ foo(() => { return false; });
//// [emitArrowFunction.js]
var f1 = function () { };
var f2 = function (x, y) { };
var f3 = function (x, y) { };
var f3 = function (x, y) {
var rest = [];
for (var _i = 2; _i < arguments.length; _i++) {
rest[_i - 2] = arguments[_i];
}
};
var f4 = function (x, y, z) {
if (z === void 0) { z = 10; }
};

View file

@ -3,5 +3,15 @@ function bar(...rest) { }
function foo(x: number, y: string, ...rest) { }
//// [emitRestParametersFunction.js]
function bar() { }
function foo(x, y) { }
function bar() {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
}
function foo(x, y) {
var rest = [];
for (var _i = 2; _i < arguments.length; _i++) {
rest[_i - 2] = arguments[_i];
}
}

View file

@ -6,7 +6,27 @@ var funcExp3 = (function (...rest) { })()
//// [emitRestParametersFunctionExpression.js]
var funcExp = function () { };
var funcExp1 = function (X) { };
var funcExp2 = function () { };
var funcExp3 = (function () { })();
var funcExp = function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
};
var funcExp1 = function (X) {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
};
var funcExp2 = function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
};
var funcExp3 = (function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
})();

View file

@ -10,5 +10,10 @@ var obj2 = {
//// [emitRestParametersFunctionProperty.js]
var obj;
var obj2 = {
func: function () { }
func: function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
}
};

View file

@ -21,8 +21,18 @@ var C = (function () {
rest[_i - 1] = arguments[_i];
}
}
C.prototype.bar = function () { };
C.prototype.foo = function (x) { };
C.prototype.bar = function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
};
C.prototype.foo = function (x) {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
};
return C;
})();
var D = (function () {
@ -32,7 +42,17 @@ var D = (function () {
rest[_i - 0] = arguments[_i];
}
}
D.prototype.bar = function () { };
D.prototype.foo = function (x) { };
D.prototype.bar = function () {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
};
D.prototype.foo = function (x) {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
};
return D;
})();

View file

@ -240,7 +240,12 @@ var SplatMonster = (function () {
args[_i - 0] = arguments[_i];
}
}
SplatMonster.prototype.roar = function (name) { };
SplatMonster.prototype.roar = function (name) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
};
return SplatMonster;
})();
function foo() { return true; }

View file

@ -23,16 +23,16 @@ import { a } from "es6ImportNamedImport_0";
>a : number
import { a as b } from "es6ImportNamedImport_0";
>a : unknown
>a : number
>b : number
import { x, a as y } from "es6ImportNamedImport_0";
>x : number
>a : unknown
>a : number
>y : number
import { x as z, } from "es6ImportNamedImport_0";
>x : unknown
>x : number
>z : number
import { m, } from "es6ImportNamedImport_0";
@ -43,8 +43,8 @@ import { a1, x1 } from "es6ImportNamedImport_0";
>x1 : number
import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0";
>a1 : unknown
>a1 : number
>a11 : number
>x1 : unknown
>x1 : number
>x11 : number

View file

@ -23,16 +23,16 @@ import { a } from "es6ImportNamedImportInEs5_0";
>a : number
import { a as b } from "es6ImportNamedImportInEs5_0";
>a : unknown
>a : number
>b : number
import { x, a as y } from "es6ImportNamedImportInEs5_0";
>x : number
>a : unknown
>a : number
>y : number
import { x as z, } from "es6ImportNamedImportInEs5_0";
>x : unknown
>x : number
>z : number
import { m, } from "es6ImportNamedImportInEs5_0";
@ -43,8 +43,8 @@ import { a1, x1 } from "es6ImportNamedImportInEs5_0";
>x1 : number
import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0";
>a1 : unknown
>a1 : number
>a11 : number
>x1 : unknown
>x1 : number
>x11 : number

View file

@ -33,4 +33,9 @@ false ? (function () { return null; }) : null;
var x1 = function () { };
var x2 = function (a) { };
var x3 = function (a) { };
var x4 = function () { };
var x4 = function () {
var a = [];
for (var _i = 0; _i < arguments.length; _i++) {
a[_i - 0] = arguments[_i];
}
};

View file

@ -351,7 +351,12 @@ false ? null : function () {
return 108;
});
// Function Parameters
function foo() { }
function foo() {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i - 0] = arguments[_i];
}
}
foo(function (a) { return 110; }, (function (a) { return 111; }), function (a) {
return 112;
}, function (a) { return 113; }, function (a, b) { return 114; }, function (a) { return 115; }, function (a) {

View file

@ -7,7 +7,12 @@ foo(1, 'bar');
//// [functionCall10.js]
function foo() { }
function foo() {
var a = [];
for (var _i = 0; _i < arguments.length; _i++) {
a[_i - 0] = arguments[_i];
}
}
;
foo(0, 1);
foo('foo');

View file

@ -8,7 +8,12 @@ foo('foo', 1, 3);
//// [functionCall13.js]
function foo(a) { }
function foo(a) {
var b = [];
for (var _i = 1; _i < arguments.length; _i++) {
b[_i - 1] = arguments[_i];
}
}
foo('foo', 1);
foo('foo');
foo();

View file

@ -8,7 +8,12 @@ foo('foo', 1, 3);
//// [functionCall14.js]
function foo(a) { }
function foo(a) {
var b = [];
for (var _i = 1; _i < arguments.length; _i++) {
b[_i - 1] = arguments[_i];
}
}
foo('foo', 1);
foo('foo');
foo();

View file

@ -2,4 +2,9 @@
function foo(a?:string, b?:number, ...b:number[]){}
//// [functionCall15.js]
function foo(a, b) { }
function foo(a, b) {
var b = [];
for (var _i = 2; _i < arguments.length; _i++) {
b[_i - 2] = arguments[_i];
}
}

View file

@ -9,7 +9,12 @@ foo('foo', 'bar', 3);
//// [functionCall16.js]
function foo(a, b) { }
function foo(a, b) {
var c = [];
for (var _i = 2; _i < arguments.length; _i++) {
c[_i - 2] = arguments[_i];
}
}
foo('foo', 1);
foo('foo');
foo('foo', 'bar');

View file

@ -9,7 +9,12 @@ foo('foo', 'bar', 3, 4);
//// [functionCall17.js]
function foo(a, b, c) { }
function foo(a, b, c) {
var d = [];
for (var _i = 3; _i < arguments.length; _i++) {
d[_i - 3] = arguments[_i];
}
}
foo('foo', 1);
foo('foo');
foo();

View file

@ -19,7 +19,12 @@ function bar(x, y) { }
; // error at "y"; no error at "x"
function func2(a, b, c) { }
; // error at "a,b,c"
function func3() { }
function func3() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
}
; // error at "args"
function func4(z, w) {
if (z === void 0) { z = null; }

View file

@ -12,9 +12,24 @@ i(a); // OK
//// [inferTypeArgumentsInSignatureWithRestParameters.js]
function f(array) { }
function g(array) { }
function h(nonarray) { }
function f(array) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
}
function g(array) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
}
function h(nonarray) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
}
function i(array, opt) { }
var a = [1, 2, 3, 4, 5];
f(a); // OK

View file

@ -56,9 +56,19 @@ function f4(x, y, z) { }
// Implicit-'any' errors for x, and z.
function f5(x, y, z) { }
// Implicit-'any[]' error for r.
function f6() { }
function f6() {
var r = [];
for (var _i = 0; _i < arguments.length; _i++) {
r[_i - 0] = arguments[_i];
}
}
// Implicit-'any'/'any[]' errors for x, r.
function f7(x) { }
function f7(x) {
var r = [];
for (var _i = 1; _i < arguments.length; _i++) {
r[_i - 1] = arguments[_i];
}
}
function f8(x3, y3) { }
// No implicit-'any' errors.
var f9 = function () { return ""; };

View file

@ -155,9 +155,19 @@ var C = (function () {
// Implicit-'any' errors for x, and z.
C.prototype.pub_f5 = function (x, y, z) { };
// Implicit-'any[]' errors for r.
C.prototype.pub_f6 = function () { };
C.prototype.pub_f6 = function () {
var r = [];
for (var _i = 0; _i < arguments.length; _i++) {
r[_i - 0] = arguments[_i];
}
};
// Implicit-'any'/'any[]' errors for x, r.
C.prototype.pub_f7 = function (x) { };
C.prototype.pub_f7 = function (x) {
var r = [];
for (var _i = 1; _i < arguments.length; _i++) {
r[_i - 1] = arguments[_i];
}
};
C.prototype.pub_f8 = function (x3, y3) { };
///////////////////////////////////////////
// No implicit-'any' errors.
@ -171,9 +181,19 @@ var C = (function () {
// Implicit-'any' errors for x, and z.
C.prototype.priv_f5 = function (x, y, z) { };
// Implicit-'any[]' errors for r.
C.prototype.priv_f6 = function () { };
C.prototype.priv_f6 = function () {
var r = [];
for (var _i = 0; _i < arguments.length; _i++) {
r[_i - 0] = arguments[_i];
}
};
// Implicit-'any'/'any[]' errors for x, r.
C.prototype.priv_f7 = function (x) { };
C.prototype.priv_f7 = function (x) {
var r = [];
for (var _i = 1; _i < arguments.length; _i++) {
r[_i - 1] = arguments[_i];
}
};
C.prototype.priv_f8 = function (x3, y3) { };
return C;
})();

View file

@ -60,9 +60,19 @@ var M;
// Implicit-'any' errors for x and z.
function m_f5(x, y, z) { }
// Implicit-'any[]' error for r.
function m_f6() { }
function m_f6() {
var r = [];
for (var _i = 0; _i < arguments.length; _i++) {
r[_i - 0] = arguments[_i];
}
}
// Implicit-'any'/'any[]' errors for x and r.
function m_f7(x) { }
function m_f7(x) {
var r = [];
for (var _i = 1; _i < arguments.length; _i++) {
r[_i - 1] = arguments[_i];
}
}
function m_f8(x3, y3) { }
// No implicit-'any' errors.
var m_f9 = function () { return ""; };

View file

@ -11,6 +11,10 @@ foo([false, 0, ""]);
//// [optionalBindingParametersInOverloads1.js]
function foo() {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
}
foo(["", 0, false]);
foo([false, 0, ""]);

View file

@ -11,6 +11,10 @@ foo({ x: false, y: 0, z: "" });
//// [optionalBindingParametersInOverloads2.js]
function foo() {
var rest = [];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
}
foo({ x: "", y: 0, z: false });
foo({ x: false, y: 0, z: "" });

View file

@ -1,2 +1,2 @@
//// [out-flag.js.map]
{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBA,EAAEA;IACNA,CAACA;IACLA,cAACA;AAADA,CAACA,AAZD,IAYC"}
{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"}

View file

@ -150,8 +150,8 @@ sourceFile:out-flag.ts
> {
>
2 > //
1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass)
2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass)
1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass.SetCount)
2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass.SetCount)
---
>>> };
1 >^^^^
@ -160,8 +160,8 @@ sourceFile:out-flag.ts
1 >
>
2 > }
1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass)
2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass)
1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass.SetCount)
2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass.SetCount)
---
>>> return MyClass;
1->^^^^

View file

@ -3,6 +3,6 @@ var v = { [e]: 1 };
//// [parserES5ComputedPropertyName2.js]
var v = (_a = {}, _a[e] =
1,
_a);
1,
_a);
var _a;

View file

@ -3,5 +3,5 @@ var v = { [e]() { } };
//// [parserES5ComputedPropertyName3.js]
var v = (_a = {}, _a[e] = function () { },
_a);
_a);
var _a;

View file

@ -3,5 +3,5 @@ var v = { get [e]() { } };
//// [parserES5ComputedPropertyName4.js]
var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }),
_a);
_a);
var _a;

View file

@ -6,4 +6,4 @@
//// [parserGreaterThanTokenAmbiguity10.js]
1 >>>
2;
2;

View file

@ -6,4 +6,4 @@
//// [parserGreaterThanTokenAmbiguity15.js]
1 >>=
2;
2;

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