mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into DtsExports_all
This commit is contained in:
+30
-4
@@ -37,12 +37,38 @@ if(!(Test-Path $tsRegKey)){
|
||||
}
|
||||
|
||||
if($tsScript -ne ""){
|
||||
if(!(Test-Path $tsScript)){
|
||||
Throw "Could not locate the TypeScript language service script at ${tsScript}"
|
||||
$tsScriptServices = "${tsScript}\typescriptServices.js"
|
||||
$tsScriptlib = "${tsScript}\lib.d.ts"
|
||||
$tsES6Scriptlib = "${tsScript}\lib.es6.d.ts"
|
||||
|
||||
if(!(Test-Path $tsScriptServices)){
|
||||
Throw "Could not locate the TypeScript language service script at ${tsScriptServices}"
|
||||
}
|
||||
else {
|
||||
$path = resolve-path ${tsScriptServices}
|
||||
Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${path}"
|
||||
Write-Host "Enabled custom TypeScript language service at ${path} for Dev${vsVersion}"
|
||||
}
|
||||
|
||||
if(!(Test-Path $tsScriptlib)){
|
||||
Throw "Could not locate the TypeScript default library at ${tsScriptlib}"
|
||||
}
|
||||
else {
|
||||
$path = resolve-path ${tsScriptlib}
|
||||
Set-ItemProperty -path $tsRegKey -name CustomDefaultLibraryLocation -value "${path}"
|
||||
Write-Host "Enabled custom TypeScript default library at ${path} for Dev${vsVersion}"
|
||||
}
|
||||
|
||||
if(!(Test-Path $tsES6Scriptlib)){
|
||||
Throw "Could not locate the TypeScript default ES6 library at ${tsES6Scriptlib}"
|
||||
}
|
||||
else {
|
||||
$path = resolve-path ${tsES6Scriptlib}
|
||||
Set-ItemProperty -path $tsRegKey -name CustomDefaultES6LibraryLocation -value "${path}"
|
||||
Write-Host "Enabled custom TypeScript default ES6 library at ${path} for Dev${vsVersion}"
|
||||
}
|
||||
Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${tsScript}"
|
||||
Write-Host "Enabled custom TypeScript language service at ${tsScript} for Dev${vsVersion}"
|
||||
}
|
||||
|
||||
if($enableDevMode){
|
||||
Set-ItemProperty -path $tsRegKey -name EnableDevMode -value 1
|
||||
Write-Host "Enabled developer mode for Dev${vsVersion}"
|
||||
|
||||
@@ -342,14 +342,7 @@ module ts {
|
||||
}
|
||||
|
||||
function bindCatchVariableDeclaration(node: CatchClause) {
|
||||
var symbol = createSymbol(SymbolFlags.FunctionScopedVariable, node.name.text || "__missing");
|
||||
addDeclarationToSymbol(symbol, node, SymbolFlags.FunctionScopedVariable);
|
||||
var saveParent = parent;
|
||||
var savedBlockScopeContainer = blockScopeContainer;
|
||||
parent = blockScopeContainer = node;
|
||||
forEachChild(node, bind);
|
||||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
bindChildren(node, /*symbolKind:*/ 0, /*isBlockScopeContainer:*/ true);
|
||||
}
|
||||
|
||||
function bindBlockScopedVariableDeclaration(node: Declaration) {
|
||||
@@ -377,6 +370,7 @@ module ts {
|
||||
|
||||
function bind(node: Node) {
|
||||
node.parent = parent;
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
@@ -389,7 +383,7 @@ module ts {
|
||||
if (isBindingPattern((<Declaration>node).name)) {
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
else if (getCombinedNodeFlags(node) & NodeFlags.BlockScoped) {
|
||||
else if (isBlockOrCatchScoped(<Declaration>node)) {
|
||||
bindBlockScopedVariableDeclaration(<Declaration>node);
|
||||
}
|
||||
else {
|
||||
|
||||
+52
-39
@@ -56,6 +56,7 @@ module ts {
|
||||
isImplementationOfOverload,
|
||||
getAliasedSymbol: resolveImport,
|
||||
getEmitResolver,
|
||||
getExportsOfExternalModule,
|
||||
};
|
||||
|
||||
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||
@@ -415,13 +416,6 @@ module ts {
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.CatchClause:
|
||||
var id = (<CatchClause>location).name;
|
||||
if (name === id.text) {
|
||||
result = location.symbol;
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
lastLocation = location;
|
||||
location = location.parent;
|
||||
@@ -450,7 +444,8 @@ module ts {
|
||||
}
|
||||
if (result.flags & SymbolFlags.BlockScopedVariable) {
|
||||
// Block-scoped variables cannot be used before their definition
|
||||
var declaration = forEach(result.declarations, d => getCombinedNodeFlags(d) & NodeFlags.BlockScoped ? d : undefined);
|
||||
var declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined);
|
||||
|
||||
Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
if (!isDefinedBefore(declaration, errorLocation)) {
|
||||
error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name));
|
||||
@@ -1997,7 +1992,7 @@ module ts {
|
||||
}
|
||||
// Handle catch clause variables
|
||||
var declaration = symbol.valueDeclaration;
|
||||
if (declaration.kind === SyntaxKind.CatchClause) {
|
||||
if (declaration.parent.kind === SyntaxKind.CatchClause) {
|
||||
return links.type = anyType;
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
@@ -2758,6 +2753,19 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getExportsOfExternalModule(node: ImportDeclaration): Symbol[]{
|
||||
if (!node.moduleSpecifier) {
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
var module = resolveExternalModuleName(node, node.moduleSpecifier);
|
||||
if (!module || !module.exports) {
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
return mapToArray(getExportsOfModule(module))
|
||||
}
|
||||
|
||||
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
|
||||
var links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
@@ -6755,11 +6763,6 @@ module ts {
|
||||
}
|
||||
|
||||
function checkTaggedTemplateExpression(node: TaggedTemplateExpression): Type {
|
||||
// Grammar checking
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
grammarErrorOnFirstToken(node.template, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
|
||||
return getReturnTypeOfSignature(getResolvedSignature(node));
|
||||
}
|
||||
|
||||
@@ -8927,18 +8930,29 @@ module ts {
|
||||
var catchClause = node.catchClause;
|
||||
if (catchClause) {
|
||||
// Grammar checking
|
||||
if (catchClause.type) {
|
||||
var sourceFile = getSourceFileOfNode(node);
|
||||
var colonStart = skipTrivia(sourceFile.text, catchClause.name.end);
|
||||
grammarErrorAtPos(sourceFile, colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation);
|
||||
if (catchClause.variableDeclaration) {
|
||||
if (catchClause.variableDeclaration.name.kind !== SyntaxKind.Identifier) {
|
||||
grammarErrorOnFirstToken(catchClause.variableDeclaration.name, Diagnostics.Catch_clause_variable_name_must_be_an_identifier);
|
||||
}
|
||||
else if (catchClause.variableDeclaration.type) {
|
||||
grammarErrorOnFirstToken(catchClause.variableDeclaration.type, Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation);
|
||||
}
|
||||
else if (catchClause.variableDeclaration.initializer) {
|
||||
grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, Diagnostics.Catch_clause_variable_cannot_have_an_initializer);
|
||||
}
|
||||
else {
|
||||
// It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the
|
||||
// Catch production is eval or arguments
|
||||
checkGrammarEvalOrArgumentsInStrictMode(node, <Identifier>catchClause.variableDeclaration.name);
|
||||
}
|
||||
}
|
||||
// It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the
|
||||
// Catch production is eval or arguments
|
||||
checkGrammarEvalOrArgumentsInStrictMode(node, catchClause.name);
|
||||
|
||||
checkBlock(catchClause.block);
|
||||
}
|
||||
if (node.finallyBlock) checkBlock(node.finallyBlock);
|
||||
|
||||
if (node.finallyBlock) {
|
||||
checkBlock(node.finallyBlock);
|
||||
}
|
||||
}
|
||||
|
||||
function checkIndexConstraints(type: Type) {
|
||||
@@ -10050,11 +10064,6 @@ module ts {
|
||||
copySymbol(location.symbol, meaning);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.CatchClause:
|
||||
if ((<CatchClause>location).name.text) {
|
||||
copySymbol(location.symbol, meaning);
|
||||
}
|
||||
break;
|
||||
}
|
||||
memberFlags = location.flags;
|
||||
location = location.parent;
|
||||
@@ -10191,7 +10200,7 @@ module ts {
|
||||
}
|
||||
|
||||
function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol {
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) {
|
||||
if (isDeclarationName(entityName)) {
|
||||
return getSymbolOfNode(entityName.parent);
|
||||
}
|
||||
|
||||
@@ -10256,7 +10265,7 @@ module ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (isDeclarationName(node)) {
|
||||
// This is a declaration, call getSymbolOfNode
|
||||
return getSymbolOfNode(node.parent);
|
||||
}
|
||||
@@ -10288,11 +10297,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
|
||||
@@ -10351,7 +10361,7 @@ module ts {
|
||||
return getTypeOfSymbol(symbol);
|
||||
}
|
||||
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (isDeclarationName(node)) {
|
||||
var symbol = getSymbolInfo(node);
|
||||
return symbol && getTypeOfSymbol(symbol);
|
||||
}
|
||||
@@ -11617,10 +11627,13 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkGrammarEvalOrArgumentsInStrictMode(contextNode: Node, identifier: Identifier): boolean {
|
||||
if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) {
|
||||
var name = declarationNameToString(identifier);
|
||||
return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, name);
|
||||
function checkGrammarEvalOrArgumentsInStrictMode(contextNode: Node, name: Node): boolean {
|
||||
if (name && name.kind === SyntaxKind.Identifier) {
|
||||
var identifier = <Identifier>name;
|
||||
if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) {
|
||||
var nameText = declarationNameToString(identifier);
|
||||
return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,6 @@ module ts {
|
||||
Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." },
|
||||
Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." },
|
||||
Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." },
|
||||
Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." },
|
||||
A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." },
|
||||
Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." },
|
||||
A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." },
|
||||
@@ -117,7 +116,6 @@ module ts {
|
||||
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." },
|
||||
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." },
|
||||
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
|
||||
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
|
||||
@@ -154,6 +152,9 @@ module ts {
|
||||
External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." },
|
||||
An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." },
|
||||
Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." },
|
||||
Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." },
|
||||
Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." },
|
||||
Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." },
|
||||
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." },
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
"category": "Error",
|
||||
"code": 1012
|
||||
},
|
||||
"Catch clause parameter cannot have a type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 1013
|
||||
},
|
||||
"A rest parameter must be last in a parameter list.": {
|
||||
"category": "Error",
|
||||
"code": 1014
|
||||
@@ -459,10 +455,6 @@
|
||||
"category": "Error",
|
||||
"code": 1157
|
||||
},
|
||||
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1159
|
||||
},
|
||||
"Unterminated template literal.": {
|
||||
"category": "Error",
|
||||
"code": 1160
|
||||
@@ -607,6 +599,18 @@
|
||||
"category": "Error",
|
||||
"code": 1194
|
||||
},
|
||||
"Catch clause variable name must be an identifier.": {
|
||||
"category": "Error",
|
||||
"code": 1195
|
||||
},
|
||||
"Catch clause variable cannot have a type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 1196
|
||||
},
|
||||
"Catch clause variable cannot have an initializer.": {
|
||||
"category": "Error",
|
||||
"code": 1197
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
@@ -1576,7 +1580,7 @@
|
||||
"Exported type alias '{0}' has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4081
|
||||
},
|
||||
},
|
||||
"The current host does not support the '{0}' option.": {
|
||||
"category": "Error",
|
||||
"code": 5001
|
||||
|
||||
+112
-114
@@ -1734,6 +1734,10 @@ module ts {
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
interface SynthesizedNode extends Node {
|
||||
startsOnNewLine: boolean;
|
||||
}
|
||||
|
||||
// @internal
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult {
|
||||
@@ -2283,7 +2287,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitParenthesized(node: Node, parenthesized: boolean) {
|
||||
function emitParenthesizedIf(node: Node, parenthesized: boolean) {
|
||||
if (parenthesized) {
|
||||
write("(");
|
||||
}
|
||||
@@ -2416,6 +2420,72 @@ module ts {
|
||||
function getTemplateLiteralAsStringLiteral(node: LiteralExpression): string {
|
||||
return '"' + escapeString(node.text) + '"';
|
||||
}
|
||||
|
||||
function emitDownlevelRawTemplateLiteral(node: LiteralExpression) {
|
||||
// Find original source text, since we need to emit the raw strings of the tagged template.
|
||||
// The raw strings contain the (escaped) strings of what the user wrote.
|
||||
// Examples: `\n` is converted to "\\n", a template string with a newline to "\n".
|
||||
var text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
|
||||
|
||||
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
|
||||
// thus we need to remove those characters.
|
||||
// First template piece starts with "`", others with "}"
|
||||
// Last template piece ends with "`", others with "${"
|
||||
var isLast = node.kind === SyntaxKind.NoSubstitutionTemplateLiteral || node.kind === SyntaxKind.TemplateTail;
|
||||
text = text.substring(1, text.length - (isLast ? 1 : 2));
|
||||
|
||||
// Newline normalization:
|
||||
// ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's
|
||||
// <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for both TV and TRV.
|
||||
text = text.replace(/\r\n?/g, "\n");
|
||||
text = escapeString(text);
|
||||
|
||||
write('"' + text + '"');
|
||||
}
|
||||
|
||||
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression) => void) {
|
||||
write("[");
|
||||
if (node.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral) {
|
||||
literalEmitter(<LiteralExpression>node.template);
|
||||
}
|
||||
else {
|
||||
literalEmitter((<TemplateExpression>node.template).head);
|
||||
forEach((<TemplateExpression>node.template).templateSpans, (child) => {
|
||||
write(", ");
|
||||
literalEmitter(child.literal);
|
||||
});
|
||||
}
|
||||
write("]");
|
||||
}
|
||||
|
||||
function emitDownlevelTaggedTemplate(node: TaggedTemplateExpression) {
|
||||
var tempVariable = createAndRecordTempVariable(node);
|
||||
write("(");
|
||||
emit(tempVariable);
|
||||
write(" = ");
|
||||
emitDownlevelTaggedTemplateArray(node, emit);
|
||||
write(", ");
|
||||
|
||||
emit(tempVariable);
|
||||
write(".raw = ");
|
||||
emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral);
|
||||
write(", ");
|
||||
|
||||
emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag));
|
||||
write("(");
|
||||
emit(tempVariable);
|
||||
|
||||
// Now we emit the expressions
|
||||
if (node.template.kind === SyntaxKind.TemplateExpression) {
|
||||
forEach((<TemplateExpression>node.template).templateSpans, templateSpan => {
|
||||
write(", ");
|
||||
var needsParens = templateSpan.expression.kind === SyntaxKind.BinaryExpression
|
||||
&& (<BinaryExpression>templateSpan.expression).operatorToken.kind === SyntaxKind.CommaToken;
|
||||
emitParenthesizedIf(templateSpan.expression, needsParens);
|
||||
});
|
||||
}
|
||||
write("))");
|
||||
}
|
||||
|
||||
function emitTemplateExpression(node: TemplateExpression): void {
|
||||
// In ES6 mode and above, we can simply emit each portion of a template in order, but in
|
||||
@@ -2460,7 +2530,8 @@ module ts {
|
||||
write(" + ");
|
||||
}
|
||||
|
||||
emitParenthesized(templateSpan.expression, needsParens);
|
||||
emitParenthesizedIf(templateSpan.expression, needsParens);
|
||||
|
||||
// Only emit if the literal is non-empty.
|
||||
// The binary '+' operator is left-associative, so the first string concatenation
|
||||
// with the head will force the result up to this point to be a string.
|
||||
@@ -2605,8 +2676,6 @@ module ts {
|
||||
return false;
|
||||
case SyntaxKind.LabeledStatement:
|
||||
return (<LabeledStatement>node.parent).label === node;
|
||||
case SyntaxKind.CatchClause:
|
||||
return (<CatchClause>node.parent).name === node;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2690,7 +2759,7 @@ module ts {
|
||||
emit((<SpreadElementExpression>node).expression);
|
||||
}
|
||||
|
||||
function needsParenthesisForPropertyAccess(node: Expression) {
|
||||
function needsParenthesisForPropertyAccessOrInvocation(node: Expression) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
@@ -2720,7 +2789,7 @@ module ts {
|
||||
var e = elements[pos];
|
||||
if (e.kind === SyntaxKind.SpreadElementExpression) {
|
||||
e = (<SpreadElementExpression>e).expression;
|
||||
emitParenthesized(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccess(e));
|
||||
emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
|
||||
pos++;
|
||||
}
|
||||
else {
|
||||
@@ -2766,14 +2835,19 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function createSynthesizedNode(kind: SyntaxKind): Node {
|
||||
var node = createNode(kind);
|
||||
function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node {
|
||||
var node = <SynthesizedNode>createNode(kind);
|
||||
node.pos = -1;
|
||||
node.end = -1;
|
||||
node.startsOnNewLine = startsOnNewLine;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function isSynthesized(node: Node) {
|
||||
return node.pos === -1 && node.end === -1;
|
||||
}
|
||||
|
||||
function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void {
|
||||
var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex);
|
||||
return emit(parenthesizedObjectLiteral);
|
||||
@@ -2807,7 +2881,7 @@ module ts {
|
||||
});
|
||||
|
||||
// Finally, return the temp variable.
|
||||
propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, tempVar);
|
||||
propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, createIdentifier(tempVar.text, /*startsOnNewLine:*/ true));
|
||||
|
||||
var result = createParenthesizedExpression(propertyPatches);
|
||||
|
||||
@@ -2830,7 +2904,7 @@ module ts {
|
||||
var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name);
|
||||
var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property);
|
||||
|
||||
return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide);
|
||||
return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide, /*startsOnNewLine:*/ true);
|
||||
}
|
||||
|
||||
function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) {
|
||||
@@ -2903,8 +2977,8 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression {
|
||||
var result = <BinaryExpression>createSynthesizedNode(SyntaxKind.BinaryExpression);
|
||||
function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression, startsOnNewLine?: boolean): BinaryExpression {
|
||||
var result = <BinaryExpression>createSynthesizedNode(SyntaxKind.BinaryExpression, startsOnNewLine);
|
||||
result.operatorToken = createSynthesizedNode(operator);
|
||||
result.left = left;
|
||||
result.right = right;
|
||||
@@ -2959,8 +3033,8 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function createIdentifier(name: string) {
|
||||
var result = <Identifier>createSynthesizedNode(SyntaxKind.Identifier);
|
||||
function createIdentifier(name: string, startsOnNewLine?: boolean) {
|
||||
var result = <Identifier>createSynthesizedNode(SyntaxKind.Identifier, startsOnNewLine);
|
||||
result.text = name;
|
||||
|
||||
return result;
|
||||
@@ -3196,9 +3270,14 @@ module ts {
|
||||
}
|
||||
|
||||
function emitTaggedTemplateExpression(node: TaggedTemplateExpression): void {
|
||||
emit(node.tag);
|
||||
write(" ");
|
||||
emit(node.template);
|
||||
if (compilerOptions.target >= ScriptTarget.ES6) {
|
||||
emit(node.tag);
|
||||
write(" ");
|
||||
emit(node.template);
|
||||
}
|
||||
else {
|
||||
emitDownlevelTaggedTemplate(node);
|
||||
}
|
||||
}
|
||||
|
||||
function emitParenExpression(node: ParenthesizedExpression) {
|
||||
@@ -3299,69 +3378,25 @@ 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));
|
||||
var shouldPlaceOnNewLine = !isSynthesized(node) && !nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right);
|
||||
|
||||
// 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 (shouldPlaceOnNewLine || synthesizedNodeStartsOnNewLine(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 synthesizedNodeStartsOnNewLine(node: Node) {
|
||||
return isSynthesized(node) && (<SynthesizedNode>node).startsOnNewLine;
|
||||
}
|
||||
|
||||
function emitConditionalExpression(node: ConditionalExpression) {
|
||||
@@ -3418,7 +3453,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitExpressionStatement(node: ExpressionStatement) {
|
||||
emitParenthesized(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction);
|
||||
emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction);
|
||||
write(";");
|
||||
}
|
||||
|
||||
@@ -3617,8 +3652,8 @@ module ts {
|
||||
var endPos = emitToken(SyntaxKind.CatchKeyword, node.pos);
|
||||
write(" ");
|
||||
emitToken(SyntaxKind.OpenParenToken, endPos);
|
||||
emit(node.name);
|
||||
emitToken(SyntaxKind.CloseParenToken, node.name.end);
|
||||
emit(node.variableDeclaration);
|
||||
emitToken(SyntaxKind.CloseParenToken, node.variableDeclaration ? node.variableDeclaration.end : endPos);
|
||||
write(" ");
|
||||
emitBlock(node.block);
|
||||
}
|
||||
@@ -4207,58 +4242,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++) {
|
||||
|
||||
@@ -222,8 +222,7 @@ module ts {
|
||||
visitNode(cbNode, (<TryStatement>node).catchClause) ||
|
||||
visitNode(cbNode, (<TryStatement>node).finallyBlock);
|
||||
case SyntaxKind.CatchClause:
|
||||
return visitNode(cbNode, (<CatchClause>node).name) ||
|
||||
visitNode(cbNode, (<CatchClause>node).type) ||
|
||||
return visitNode(cbNode, (<CatchClause>node).variableDeclaration) ||
|
||||
visitNode(cbNode, (<CatchClause>node).block);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return visitNodes(cbNodes, node.modifiers) ||
|
||||
@@ -3973,9 +3972,10 @@ module ts {
|
||||
function parseCatchClause(): CatchClause {
|
||||
var result = <CatchClause>createNode(SyntaxKind.CatchClause);
|
||||
parseExpected(SyntaxKind.CatchKeyword);
|
||||
parseExpected(SyntaxKind.OpenParenToken);
|
||||
result.name = parseIdentifier();
|
||||
result.type = parseTypeAnnotation();
|
||||
if (parseExpected(SyntaxKind.OpenParenToken)) {
|
||||
result.variableDeclaration = parseVariableDeclaration();
|
||||
}
|
||||
|
||||
parseExpected(SyntaxKind.CloseParenToken);
|
||||
result.block = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false);
|
||||
return finishNode(result);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
module ts {
|
||||
/* @internal */ export var emitTime = 0;
|
||||
/* @internal */ export var ioReadTime = 0;
|
||||
|
||||
export function createCompilerHost(options: CompilerOptions): CompilerHost {
|
||||
var currentDirectory: string;
|
||||
@@ -19,7 +20,9 @@ module ts {
|
||||
|
||||
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile {
|
||||
try {
|
||||
var start = new Date().getTime();
|
||||
var text = sys.readFile(fileName, options.charset);
|
||||
ioReadTime += new Date().getTime() - start;
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
@@ -177,10 +180,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);
|
||||
|
||||
|
||||
+14
-1
@@ -322,6 +322,7 @@ module ts {
|
||||
}
|
||||
|
||||
function compile(fileNames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) {
|
||||
ts.ioReadTime = 0;
|
||||
ts.parseTime = 0;
|
||||
ts.bindTime = 0;
|
||||
ts.checkTime = 0;
|
||||
@@ -330,9 +331,12 @@ module ts {
|
||||
var start = new Date().getTime();
|
||||
|
||||
var program = createProgram(fileNames, compilerOptions, compilerHost);
|
||||
var programTime = new Date().getTime() - start;
|
||||
|
||||
var exitStatus = compileProgram();
|
||||
|
||||
var end = new Date().getTime() - start;
|
||||
var compileTime = end - programTime;
|
||||
|
||||
if (compilerOptions.listFiles) {
|
||||
forEach(program.getSourceFiles(), file => {
|
||||
@@ -353,10 +357,19 @@ module ts {
|
||||
reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
|
||||
}
|
||||
|
||||
reportTimeStatistic("Parse time", ts.parseTime);
|
||||
// Individual component times.
|
||||
// Note: we output 'programTime' as parseTime to match the tsc 1.3 behavior. tsc 1.3
|
||||
// measured parse time along with read IO as a single counter. We preserve that
|
||||
// behavior so we can accurately compare times. For actual parse times (in isolation)
|
||||
// is reported below.
|
||||
reportTimeStatistic("Parse time", programTime);
|
||||
reportTimeStatistic("Bind time", ts.bindTime);
|
||||
reportTimeStatistic("Check time", ts.checkTime);
|
||||
reportTimeStatistic("Emit time", ts.emitTime);
|
||||
|
||||
reportTimeStatistic("Parse time w/o IO", ts.parseTime);
|
||||
reportTimeStatistic("IO read", ts.ioReadTime);
|
||||
reportTimeStatistic("Compile time", compileTime);
|
||||
reportTimeStatistic("Total time", end);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,6 @@ module ts {
|
||||
WithKeyword,
|
||||
// Strict mode reserved words
|
||||
AsKeyword,
|
||||
FromKeyword,
|
||||
ImplementsKeyword,
|
||||
InterfaceKeyword,
|
||||
LetKeyword,
|
||||
@@ -131,7 +130,7 @@ module ts {
|
||||
PublicKeyword,
|
||||
StaticKeyword,
|
||||
YieldKeyword,
|
||||
// TypeScript keywords
|
||||
// Contextual keywords
|
||||
AnyKeyword,
|
||||
BooleanKeyword,
|
||||
ConstructorKeyword,
|
||||
@@ -144,7 +143,9 @@ module ts {
|
||||
StringKeyword,
|
||||
SymbolKeyword,
|
||||
TypeKeyword,
|
||||
FromKeyword,
|
||||
OfKeyword, // LastKeyword and LastToken
|
||||
|
||||
// Parse tree nodes
|
||||
|
||||
// Names
|
||||
@@ -279,7 +280,7 @@ module ts {
|
||||
FirstPunctuation = OpenBraceToken,
|
||||
LastPunctuation = CaretEqualsToken,
|
||||
FirstToken = Unknown,
|
||||
LastToken = OfKeyword,
|
||||
LastToken = LastKeyword,
|
||||
FirstTriviaToken = SingleLineCommentTrivia,
|
||||
LastTriviaToken = ConflictMarkerTrivia,
|
||||
FirstLiteralToken = NumericLiteral,
|
||||
@@ -813,9 +814,8 @@ module ts {
|
||||
finallyBlock?: Block;
|
||||
}
|
||||
|
||||
export interface CatchClause extends Declaration {
|
||||
name: Identifier;
|
||||
type?: TypeNode;
|
||||
export interface CatchClause extends Node {
|
||||
variableDeclaration: VariableDeclaration;
|
||||
block: Block;
|
||||
}
|
||||
|
||||
@@ -1100,6 +1100,7 @@ module ts {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
|
||||
// Should not be called directly. Should only be accessed through the Program instance.
|
||||
/* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
|
||||
+40
-24
@@ -192,6 +192,18 @@ module ts {
|
||||
return getBaseFileName(moduleName).replace(/\W/g, "_");
|
||||
}
|
||||
|
||||
export function isBlockOrCatchScoped(declaration: Declaration) {
|
||||
return (getCombinedNodeFlags(declaration) & NodeFlags.BlockScoped) !== 0 ||
|
||||
isCatchClauseVariableDeclaration(declaration);
|
||||
}
|
||||
|
||||
export function isCatchClauseVariableDeclaration(declaration: Declaration) {
|
||||
return declaration &&
|
||||
declaration.kind === SyntaxKind.VariableDeclaration &&
|
||||
declaration.parent &&
|
||||
declaration.parent.kind === SyntaxKind.CatchClause;
|
||||
}
|
||||
|
||||
// Return display name of an identifier
|
||||
// Computed property names will just be emitted as "[<expr>]", where <expr> is the source
|
||||
// text of the expression in the computed property.
|
||||
@@ -681,31 +693,33 @@ module ts {
|
||||
|
||||
export function isDeclaration(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.ImportClause:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ImportClause:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -739,18 +753,20 @@ module ts {
|
||||
}
|
||||
|
||||
// True if the given identifier, string literal, or number literal is the name of a declaration node
|
||||
export function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean {
|
||||
export function isDeclarationName(name: Node): boolean {
|
||||
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var parent = name.parent;
|
||||
if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) {
|
||||
return (<Declaration>parent).name === name;
|
||||
if (parent.kind === SyntaxKind.ImportSpecifier || parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
if ((<ImportOrExportSpecifier>parent).propertyName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (parent.kind === SyntaxKind.CatchClause) {
|
||||
return (<CatchClause>parent).name === name;
|
||||
if (isDeclaration(parent)) {
|
||||
return (<Declaration>parent).name === name;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
+20
-12
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
module ts.formatting {
|
||||
export module SmartIndenter {
|
||||
|
||||
const enum Value {
|
||||
Unknown = -1
|
||||
}
|
||||
|
||||
export function getIndentation(position: number, sourceFile: SourceFile, options: EditorOptions): number {
|
||||
if (position > sourceFile.text.length) {
|
||||
return 0; // past EOF
|
||||
@@ -29,7 +34,7 @@ module ts.formatting {
|
||||
if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) {
|
||||
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
|
||||
var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
|
||||
if (actualIndentation !== -1) {
|
||||
if (actualIndentation !== Value.Unknown) {
|
||||
return actualIndentation;
|
||||
}
|
||||
}
|
||||
@@ -57,7 +62,7 @@ module ts.formatting {
|
||||
|
||||
// check if current node is a list item - if yes, take indentation from it
|
||||
var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);
|
||||
if (actualIndentation !== -1) {
|
||||
if (actualIndentation !== Value.Unknown) {
|
||||
return actualIndentation;
|
||||
}
|
||||
|
||||
@@ -101,7 +106,7 @@ module ts.formatting {
|
||||
if (useActualIndentation) {
|
||||
// check if current node is a list item - if yes, take indentation from it
|
||||
var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);
|
||||
if (actualIndentation !== -1) {
|
||||
if (actualIndentation !== Value.Unknown) {
|
||||
return actualIndentation + indentationDelta;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +118,7 @@ module ts.formatting {
|
||||
if (useActualIndentation) {
|
||||
// try to fetch actual indentation for current node from source text
|
||||
var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options);
|
||||
if (actualIndentation !== -1) {
|
||||
if (actualIndentation !== Value.Unknown) {
|
||||
return actualIndentation + indentationDelta;
|
||||
}
|
||||
}
|
||||
@@ -142,18 +147,22 @@ module ts.formatting {
|
||||
}
|
||||
|
||||
/*
|
||||
* Function returns -1 if indentation cannot be determined
|
||||
* Function returns Value.Unknown if indentation cannot be determined
|
||||
*/
|
||||
function getActualIndentationForListItemBeforeComma(commaToken: Node, sourceFile: SourceFile, options: EditorOptions): number {
|
||||
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
|
||||
var commaItemInfo = findListItemInfo(commaToken);
|
||||
Debug.assert(commaItemInfo && commaItemInfo.listItemIndex > 0);
|
||||
// The item we're interested in is right before the comma
|
||||
return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options);
|
||||
if (commaItemInfo && commaItemInfo.listItemIndex > 0) {
|
||||
return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options);
|
||||
}
|
||||
else {
|
||||
// handle broken code gracefully
|
||||
return Value.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function returns -1 if actual indentation for node should not be used (i.e because node is nested expression)
|
||||
* Function returns Value.Unknown if actual indentation for node should not be used (i.e because node is nested expression)
|
||||
*/
|
||||
function getActualIndentationForNode(current: Node,
|
||||
parent: Node,
|
||||
@@ -170,7 +179,7 @@ module ts.formatting {
|
||||
(parent.kind === SyntaxKind.SourceFile || !parentAndChildShareLine);
|
||||
|
||||
if (!useActualIndentation) {
|
||||
return -1;
|
||||
return Value.Unknown;
|
||||
}
|
||||
|
||||
return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options);
|
||||
@@ -271,11 +280,11 @@ module ts.formatting {
|
||||
|
||||
function getActualIndentationForListItem(node: Node, sourceFile: SourceFile, options: EditorOptions): number {
|
||||
var containingList = getContainingList(node, sourceFile);
|
||||
return containingList ? getActualIndentationFromList(containingList) : -1;
|
||||
return containingList ? getActualIndentationFromList(containingList) : Value.Unknown;
|
||||
|
||||
function getActualIndentationFromList(list: Node[]): number {
|
||||
var index = indexOf(list, node);
|
||||
return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1;
|
||||
return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : Value.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +307,7 @@ module ts.formatting {
|
||||
|
||||
lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile);
|
||||
}
|
||||
return -1;
|
||||
return Value.Unknown;
|
||||
}
|
||||
|
||||
function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number {
|
||||
|
||||
@@ -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;
|
||||
|
||||
+172
-8
@@ -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;
|
||||
}
|
||||
@@ -2403,6 +2445,19 @@ module ts {
|
||||
getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession);
|
||||
}
|
||||
}
|
||||
else if (getAncestor(previousToken, SyntaxKind.ImportClause)) {
|
||||
// cursor is in import clause
|
||||
// try to show exported member for imported module
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = true;
|
||||
if (showCompletionsInImportsClause(previousToken)) {
|
||||
var importDeclaration = <ImportDeclaration>getAncestor(previousToken, SyntaxKind.ImportDeclaration);
|
||||
Debug.assert(importDeclaration !== undefined);
|
||||
var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration);
|
||||
var filteredExports = filterModuleExports(exports, importDeclaration);
|
||||
getCompletionEntriesFromSymbols(filteredExports, activeCompletionSession);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Get scope members
|
||||
isMemberCompletion = false;
|
||||
@@ -2453,6 +2508,18 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function showCompletionsInImportsClause(node: Node): boolean {
|
||||
if (node) {
|
||||
// import {|
|
||||
// import {a,|
|
||||
if (node.kind === SyntaxKind.OpenBraceToken || node.kind === SyntaxKind.CommaToken) {
|
||||
return node.parent.kind === SyntaxKind.NamedImports;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isNewIdentifierDefinitionLocation(previousToken: Node): boolean {
|
||||
if (previousToken) {
|
||||
var containingNodeKind = previousToken.parent.kind;
|
||||
@@ -2664,6 +2731,28 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function filterModuleExports(exports: Symbol[], importDeclaration: ImportDeclaration): Symbol[] {
|
||||
var exisingImports: Map<boolean> = {};
|
||||
|
||||
if (!importDeclaration.importClause) {
|
||||
return exports;
|
||||
}
|
||||
|
||||
if (importDeclaration.importClause.namedBindings &&
|
||||
importDeclaration.importClause.namedBindings.kind === SyntaxKind.NamedImports) {
|
||||
|
||||
forEach((<NamedImports>importDeclaration.importClause.namedBindings).elements, el => {
|
||||
var name = el.propertyName || el.name;
|
||||
exisingImports[name.text] = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (isEmpty(exisingImports)) {
|
||||
return exports;
|
||||
}
|
||||
return filter(exports, e => !lookUp(exisingImports, e.name));
|
||||
}
|
||||
|
||||
function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {
|
||||
if (!existingMembers || existingMembers.length === 0) {
|
||||
return contextualMemberSymbols;
|
||||
@@ -3245,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,
|
||||
@@ -3975,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).
|
||||
@@ -3992,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();
|
||||
|
||||
@@ -4012,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);
|
||||
|
||||
@@ -4047,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;
|
||||
}
|
||||
|
||||
@@ -4411,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
|
||||
@@ -4487,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
|
||||
@@ -4600,7 +4756,7 @@ module ts {
|
||||
|
||||
/** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */
|
||||
function isWriteAccess(node: Node): boolean {
|
||||
if (node.kind === SyntaxKind.Identifier && isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (node.kind === SyntaxKind.Identifier && isDeclarationName(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4694,13 +4850,21 @@ module ts {
|
||||
return SemanticMeaning.Namespace;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -4754,7 +4918,7 @@ module ts {
|
||||
else if (isInRightSideOfImport(node)) {
|
||||
return getMeaningFromRightHandSideOfImportEquals(node);
|
||||
}
|
||||
else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
else if (isDeclarationName(node)) {
|
||||
return getMeaningFromDeclaration(node.parent);
|
||||
}
|
||||
else if (isTypeReference(node)) {
|
||||
|
||||
@@ -161,28 +161,28 @@ declare module "typescript" {
|
||||
WhileKeyword = 99,
|
||||
WithKeyword = 100,
|
||||
AsKeyword = 101,
|
||||
FromKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AnyKeyword = 111,
|
||||
BooleanKeyword = 112,
|
||||
ConstructorKeyword = 113,
|
||||
DeclareKeyword = 114,
|
||||
GetKeyword = 115,
|
||||
ModuleKeyword = 116,
|
||||
RequireKeyword = 117,
|
||||
NumberKeyword = 118,
|
||||
SetKeyword = 119,
|
||||
StringKeyword = 120,
|
||||
SymbolKeyword = 121,
|
||||
TypeKeyword = 122,
|
||||
FromKeyword = 123,
|
||||
OfKeyword = 124,
|
||||
QualifiedName = 125,
|
||||
ComputedPropertyName = 126,
|
||||
@@ -288,8 +288,8 @@ declare module "typescript" {
|
||||
LastReservedWord = 100,
|
||||
FirstKeyword = 65,
|
||||
LastKeyword = 124,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 139,
|
||||
LastTypeNode = 147,
|
||||
FirstPunctuation = 14,
|
||||
@@ -673,9 +673,8 @@ declare module "typescript" {
|
||||
catchClause?: CatchClause;
|
||||
finallyBlock?: Block;
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
name: Identifier;
|
||||
type?: TypeNode;
|
||||
interface CatchClause extends Node {
|
||||
variableDeclaration: VariableDeclaration;
|
||||
block: Block;
|
||||
}
|
||||
interface ModuleElement extends Node {
|
||||
@@ -869,6 +868,7 @@ declare module "typescript" {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
|
||||
@@ -501,72 +501,72 @@ declare module "typescript" {
|
||||
AsKeyword = 101,
|
||||
>AsKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 102,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
ImplementsKeyword = 103,
|
||||
ImplementsKeyword = 102,
|
||||
>ImplementsKeyword : SyntaxKind
|
||||
|
||||
InterfaceKeyword = 104,
|
||||
InterfaceKeyword = 103,
|
||||
>InterfaceKeyword : SyntaxKind
|
||||
|
||||
LetKeyword = 105,
|
||||
LetKeyword = 104,
|
||||
>LetKeyword : SyntaxKind
|
||||
|
||||
PackageKeyword = 106,
|
||||
PackageKeyword = 105,
|
||||
>PackageKeyword : SyntaxKind
|
||||
|
||||
PrivateKeyword = 107,
|
||||
PrivateKeyword = 106,
|
||||
>PrivateKeyword : SyntaxKind
|
||||
|
||||
ProtectedKeyword = 108,
|
||||
ProtectedKeyword = 107,
|
||||
>ProtectedKeyword : SyntaxKind
|
||||
|
||||
PublicKeyword = 109,
|
||||
PublicKeyword = 108,
|
||||
>PublicKeyword : SyntaxKind
|
||||
|
||||
StaticKeyword = 110,
|
||||
StaticKeyword = 109,
|
||||
>StaticKeyword : SyntaxKind
|
||||
|
||||
YieldKeyword = 111,
|
||||
YieldKeyword = 110,
|
||||
>YieldKeyword : SyntaxKind
|
||||
|
||||
AnyKeyword = 112,
|
||||
AnyKeyword = 111,
|
||||
>AnyKeyword : SyntaxKind
|
||||
|
||||
BooleanKeyword = 113,
|
||||
BooleanKeyword = 112,
|
||||
>BooleanKeyword : SyntaxKind
|
||||
|
||||
ConstructorKeyword = 114,
|
||||
ConstructorKeyword = 113,
|
||||
>ConstructorKeyword : SyntaxKind
|
||||
|
||||
DeclareKeyword = 115,
|
||||
DeclareKeyword = 114,
|
||||
>DeclareKeyword : SyntaxKind
|
||||
|
||||
GetKeyword = 116,
|
||||
GetKeyword = 115,
|
||||
>GetKeyword : SyntaxKind
|
||||
|
||||
ModuleKeyword = 117,
|
||||
ModuleKeyword = 116,
|
||||
>ModuleKeyword : SyntaxKind
|
||||
|
||||
RequireKeyword = 118,
|
||||
RequireKeyword = 117,
|
||||
>RequireKeyword : SyntaxKind
|
||||
|
||||
NumberKeyword = 119,
|
||||
NumberKeyword = 118,
|
||||
>NumberKeyword : SyntaxKind
|
||||
|
||||
SetKeyword = 120,
|
||||
SetKeyword = 119,
|
||||
>SetKeyword : SyntaxKind
|
||||
|
||||
StringKeyword = 121,
|
||||
StringKeyword = 120,
|
||||
>StringKeyword : SyntaxKind
|
||||
|
||||
SymbolKeyword = 122,
|
||||
SymbolKeyword = 121,
|
||||
>SymbolKeyword : SyntaxKind
|
||||
|
||||
TypeKeyword = 123,
|
||||
TypeKeyword = 122,
|
||||
>TypeKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 123,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
OfKeyword = 124,
|
||||
>OfKeyword : SyntaxKind
|
||||
|
||||
@@ -882,10 +882,10 @@ declare module "typescript" {
|
||||
LastKeyword = 124,
|
||||
>LastKeyword : SyntaxKind
|
||||
|
||||
FirstFutureReservedWord = 103,
|
||||
FirstFutureReservedWord = 102,
|
||||
>FirstFutureReservedWord : SyntaxKind
|
||||
|
||||
LastFutureReservedWord = 111,
|
||||
LastFutureReservedWord = 110,
|
||||
>LastFutureReservedWord : SyntaxKind
|
||||
|
||||
FirstTypeNode = 139,
|
||||
@@ -2030,17 +2030,13 @@ declare module "typescript" {
|
||||
>finallyBlock : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
interface CatchClause extends Node {
|
||||
>CatchClause : CatchClause
|
||||
>Declaration : Declaration
|
||||
>Node : Node
|
||||
|
||||
name: Identifier;
|
||||
>name : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
variableDeclaration: VariableDeclaration;
|
||||
>variableDeclaration : VariableDeclaration
|
||||
>VariableDeclaration : VariableDeclaration
|
||||
|
||||
block: Block;
|
||||
>block : Block
|
||||
@@ -2718,6 +2714,12 @@ declare module "typescript" {
|
||||
>getAliasedSymbol : (symbol: Symbol) => Symbol
|
||||
>symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
|
||||
@@ -192,28 +192,28 @@ declare module "typescript" {
|
||||
WhileKeyword = 99,
|
||||
WithKeyword = 100,
|
||||
AsKeyword = 101,
|
||||
FromKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AnyKeyword = 111,
|
||||
BooleanKeyword = 112,
|
||||
ConstructorKeyword = 113,
|
||||
DeclareKeyword = 114,
|
||||
GetKeyword = 115,
|
||||
ModuleKeyword = 116,
|
||||
RequireKeyword = 117,
|
||||
NumberKeyword = 118,
|
||||
SetKeyword = 119,
|
||||
StringKeyword = 120,
|
||||
SymbolKeyword = 121,
|
||||
TypeKeyword = 122,
|
||||
FromKeyword = 123,
|
||||
OfKeyword = 124,
|
||||
QualifiedName = 125,
|
||||
ComputedPropertyName = 126,
|
||||
@@ -319,8 +319,8 @@ declare module "typescript" {
|
||||
LastReservedWord = 100,
|
||||
FirstKeyword = 65,
|
||||
LastKeyword = 124,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 139,
|
||||
LastTypeNode = 147,
|
||||
FirstPunctuation = 14,
|
||||
@@ -704,9 +704,8 @@ declare module "typescript" {
|
||||
catchClause?: CatchClause;
|
||||
finallyBlock?: Block;
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
name: Identifier;
|
||||
type?: TypeNode;
|
||||
interface CatchClause extends Node {
|
||||
variableDeclaration: VariableDeclaration;
|
||||
block: Block;
|
||||
}
|
||||
interface ModuleElement extends Node {
|
||||
@@ -900,6 +899,7 @@ declare module "typescript" {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
|
||||
@@ -647,72 +647,72 @@ declare module "typescript" {
|
||||
AsKeyword = 101,
|
||||
>AsKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 102,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
ImplementsKeyword = 103,
|
||||
ImplementsKeyword = 102,
|
||||
>ImplementsKeyword : SyntaxKind
|
||||
|
||||
InterfaceKeyword = 104,
|
||||
InterfaceKeyword = 103,
|
||||
>InterfaceKeyword : SyntaxKind
|
||||
|
||||
LetKeyword = 105,
|
||||
LetKeyword = 104,
|
||||
>LetKeyword : SyntaxKind
|
||||
|
||||
PackageKeyword = 106,
|
||||
PackageKeyword = 105,
|
||||
>PackageKeyword : SyntaxKind
|
||||
|
||||
PrivateKeyword = 107,
|
||||
PrivateKeyword = 106,
|
||||
>PrivateKeyword : SyntaxKind
|
||||
|
||||
ProtectedKeyword = 108,
|
||||
ProtectedKeyword = 107,
|
||||
>ProtectedKeyword : SyntaxKind
|
||||
|
||||
PublicKeyword = 109,
|
||||
PublicKeyword = 108,
|
||||
>PublicKeyword : SyntaxKind
|
||||
|
||||
StaticKeyword = 110,
|
||||
StaticKeyword = 109,
|
||||
>StaticKeyword : SyntaxKind
|
||||
|
||||
YieldKeyword = 111,
|
||||
YieldKeyword = 110,
|
||||
>YieldKeyword : SyntaxKind
|
||||
|
||||
AnyKeyword = 112,
|
||||
AnyKeyword = 111,
|
||||
>AnyKeyword : SyntaxKind
|
||||
|
||||
BooleanKeyword = 113,
|
||||
BooleanKeyword = 112,
|
||||
>BooleanKeyword : SyntaxKind
|
||||
|
||||
ConstructorKeyword = 114,
|
||||
ConstructorKeyword = 113,
|
||||
>ConstructorKeyword : SyntaxKind
|
||||
|
||||
DeclareKeyword = 115,
|
||||
DeclareKeyword = 114,
|
||||
>DeclareKeyword : SyntaxKind
|
||||
|
||||
GetKeyword = 116,
|
||||
GetKeyword = 115,
|
||||
>GetKeyword : SyntaxKind
|
||||
|
||||
ModuleKeyword = 117,
|
||||
ModuleKeyword = 116,
|
||||
>ModuleKeyword : SyntaxKind
|
||||
|
||||
RequireKeyword = 118,
|
||||
RequireKeyword = 117,
|
||||
>RequireKeyword : SyntaxKind
|
||||
|
||||
NumberKeyword = 119,
|
||||
NumberKeyword = 118,
|
||||
>NumberKeyword : SyntaxKind
|
||||
|
||||
SetKeyword = 120,
|
||||
SetKeyword = 119,
|
||||
>SetKeyword : SyntaxKind
|
||||
|
||||
StringKeyword = 121,
|
||||
StringKeyword = 120,
|
||||
>StringKeyword : SyntaxKind
|
||||
|
||||
SymbolKeyword = 122,
|
||||
SymbolKeyword = 121,
|
||||
>SymbolKeyword : SyntaxKind
|
||||
|
||||
TypeKeyword = 123,
|
||||
TypeKeyword = 122,
|
||||
>TypeKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 123,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
OfKeyword = 124,
|
||||
>OfKeyword : SyntaxKind
|
||||
|
||||
@@ -1028,10 +1028,10 @@ declare module "typescript" {
|
||||
LastKeyword = 124,
|
||||
>LastKeyword : SyntaxKind
|
||||
|
||||
FirstFutureReservedWord = 103,
|
||||
FirstFutureReservedWord = 102,
|
||||
>FirstFutureReservedWord : SyntaxKind
|
||||
|
||||
LastFutureReservedWord = 111,
|
||||
LastFutureReservedWord = 110,
|
||||
>LastFutureReservedWord : SyntaxKind
|
||||
|
||||
FirstTypeNode = 139,
|
||||
@@ -2176,17 +2176,13 @@ declare module "typescript" {
|
||||
>finallyBlock : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
interface CatchClause extends Node {
|
||||
>CatchClause : CatchClause
|
||||
>Declaration : Declaration
|
||||
>Node : Node
|
||||
|
||||
name: Identifier;
|
||||
>name : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
variableDeclaration: VariableDeclaration;
|
||||
>variableDeclaration : VariableDeclaration
|
||||
>VariableDeclaration : VariableDeclaration
|
||||
|
||||
block: Block;
|
||||
>block : Block
|
||||
@@ -2864,6 +2860,12 @@ declare module "typescript" {
|
||||
>getAliasedSymbol : (symbol: Symbol) => Symbol
|
||||
>symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
|
||||
@@ -193,28 +193,28 @@ declare module "typescript" {
|
||||
WhileKeyword = 99,
|
||||
WithKeyword = 100,
|
||||
AsKeyword = 101,
|
||||
FromKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AnyKeyword = 111,
|
||||
BooleanKeyword = 112,
|
||||
ConstructorKeyword = 113,
|
||||
DeclareKeyword = 114,
|
||||
GetKeyword = 115,
|
||||
ModuleKeyword = 116,
|
||||
RequireKeyword = 117,
|
||||
NumberKeyword = 118,
|
||||
SetKeyword = 119,
|
||||
StringKeyword = 120,
|
||||
SymbolKeyword = 121,
|
||||
TypeKeyword = 122,
|
||||
FromKeyword = 123,
|
||||
OfKeyword = 124,
|
||||
QualifiedName = 125,
|
||||
ComputedPropertyName = 126,
|
||||
@@ -320,8 +320,8 @@ declare module "typescript" {
|
||||
LastReservedWord = 100,
|
||||
FirstKeyword = 65,
|
||||
LastKeyword = 124,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 139,
|
||||
LastTypeNode = 147,
|
||||
FirstPunctuation = 14,
|
||||
@@ -705,9 +705,8 @@ declare module "typescript" {
|
||||
catchClause?: CatchClause;
|
||||
finallyBlock?: Block;
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
name: Identifier;
|
||||
type?: TypeNode;
|
||||
interface CatchClause extends Node {
|
||||
variableDeclaration: VariableDeclaration;
|
||||
block: Block;
|
||||
}
|
||||
interface ModuleElement extends Node {
|
||||
@@ -901,6 +900,7 @@ declare module "typescript" {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
|
||||
@@ -597,72 +597,72 @@ declare module "typescript" {
|
||||
AsKeyword = 101,
|
||||
>AsKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 102,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
ImplementsKeyword = 103,
|
||||
ImplementsKeyword = 102,
|
||||
>ImplementsKeyword : SyntaxKind
|
||||
|
||||
InterfaceKeyword = 104,
|
||||
InterfaceKeyword = 103,
|
||||
>InterfaceKeyword : SyntaxKind
|
||||
|
||||
LetKeyword = 105,
|
||||
LetKeyword = 104,
|
||||
>LetKeyword : SyntaxKind
|
||||
|
||||
PackageKeyword = 106,
|
||||
PackageKeyword = 105,
|
||||
>PackageKeyword : SyntaxKind
|
||||
|
||||
PrivateKeyword = 107,
|
||||
PrivateKeyword = 106,
|
||||
>PrivateKeyword : SyntaxKind
|
||||
|
||||
ProtectedKeyword = 108,
|
||||
ProtectedKeyword = 107,
|
||||
>ProtectedKeyword : SyntaxKind
|
||||
|
||||
PublicKeyword = 109,
|
||||
PublicKeyword = 108,
|
||||
>PublicKeyword : SyntaxKind
|
||||
|
||||
StaticKeyword = 110,
|
||||
StaticKeyword = 109,
|
||||
>StaticKeyword : SyntaxKind
|
||||
|
||||
YieldKeyword = 111,
|
||||
YieldKeyword = 110,
|
||||
>YieldKeyword : SyntaxKind
|
||||
|
||||
AnyKeyword = 112,
|
||||
AnyKeyword = 111,
|
||||
>AnyKeyword : SyntaxKind
|
||||
|
||||
BooleanKeyword = 113,
|
||||
BooleanKeyword = 112,
|
||||
>BooleanKeyword : SyntaxKind
|
||||
|
||||
ConstructorKeyword = 114,
|
||||
ConstructorKeyword = 113,
|
||||
>ConstructorKeyword : SyntaxKind
|
||||
|
||||
DeclareKeyword = 115,
|
||||
DeclareKeyword = 114,
|
||||
>DeclareKeyword : SyntaxKind
|
||||
|
||||
GetKeyword = 116,
|
||||
GetKeyword = 115,
|
||||
>GetKeyword : SyntaxKind
|
||||
|
||||
ModuleKeyword = 117,
|
||||
ModuleKeyword = 116,
|
||||
>ModuleKeyword : SyntaxKind
|
||||
|
||||
RequireKeyword = 118,
|
||||
RequireKeyword = 117,
|
||||
>RequireKeyword : SyntaxKind
|
||||
|
||||
NumberKeyword = 119,
|
||||
NumberKeyword = 118,
|
||||
>NumberKeyword : SyntaxKind
|
||||
|
||||
SetKeyword = 120,
|
||||
SetKeyword = 119,
|
||||
>SetKeyword : SyntaxKind
|
||||
|
||||
StringKeyword = 121,
|
||||
StringKeyword = 120,
|
||||
>StringKeyword : SyntaxKind
|
||||
|
||||
SymbolKeyword = 122,
|
||||
SymbolKeyword = 121,
|
||||
>SymbolKeyword : SyntaxKind
|
||||
|
||||
TypeKeyword = 123,
|
||||
TypeKeyword = 122,
|
||||
>TypeKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 123,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
OfKeyword = 124,
|
||||
>OfKeyword : SyntaxKind
|
||||
|
||||
@@ -978,10 +978,10 @@ declare module "typescript" {
|
||||
LastKeyword = 124,
|
||||
>LastKeyword : SyntaxKind
|
||||
|
||||
FirstFutureReservedWord = 103,
|
||||
FirstFutureReservedWord = 102,
|
||||
>FirstFutureReservedWord : SyntaxKind
|
||||
|
||||
LastFutureReservedWord = 111,
|
||||
LastFutureReservedWord = 110,
|
||||
>LastFutureReservedWord : SyntaxKind
|
||||
|
||||
FirstTypeNode = 139,
|
||||
@@ -2126,17 +2126,13 @@ declare module "typescript" {
|
||||
>finallyBlock : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
interface CatchClause extends Node {
|
||||
>CatchClause : CatchClause
|
||||
>Declaration : Declaration
|
||||
>Node : Node
|
||||
|
||||
name: Identifier;
|
||||
>name : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
variableDeclaration: VariableDeclaration;
|
||||
>variableDeclaration : VariableDeclaration
|
||||
>VariableDeclaration : VariableDeclaration
|
||||
|
||||
block: Block;
|
||||
>block : Block
|
||||
@@ -2814,6 +2810,12 @@ declare module "typescript" {
|
||||
>getAliasedSymbol : (symbol: Symbol) => Symbol
|
||||
>symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
|
||||
@@ -230,28 +230,28 @@ declare module "typescript" {
|
||||
WhileKeyword = 99,
|
||||
WithKeyword = 100,
|
||||
AsKeyword = 101,
|
||||
FromKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AnyKeyword = 111,
|
||||
BooleanKeyword = 112,
|
||||
ConstructorKeyword = 113,
|
||||
DeclareKeyword = 114,
|
||||
GetKeyword = 115,
|
||||
ModuleKeyword = 116,
|
||||
RequireKeyword = 117,
|
||||
NumberKeyword = 118,
|
||||
SetKeyword = 119,
|
||||
StringKeyword = 120,
|
||||
SymbolKeyword = 121,
|
||||
TypeKeyword = 122,
|
||||
FromKeyword = 123,
|
||||
OfKeyword = 124,
|
||||
QualifiedName = 125,
|
||||
ComputedPropertyName = 126,
|
||||
@@ -357,8 +357,8 @@ declare module "typescript" {
|
||||
LastReservedWord = 100,
|
||||
FirstKeyword = 65,
|
||||
LastKeyword = 124,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 139,
|
||||
LastTypeNode = 147,
|
||||
FirstPunctuation = 14,
|
||||
@@ -742,9 +742,8 @@ declare module "typescript" {
|
||||
catchClause?: CatchClause;
|
||||
finallyBlock?: Block;
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
name: Identifier;
|
||||
type?: TypeNode;
|
||||
interface CatchClause extends Node {
|
||||
variableDeclaration: VariableDeclaration;
|
||||
block: Block;
|
||||
}
|
||||
interface ModuleElement extends Node {
|
||||
@@ -938,6 +937,7 @@ declare module "typescript" {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
|
||||
@@ -770,72 +770,72 @@ declare module "typescript" {
|
||||
AsKeyword = 101,
|
||||
>AsKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 102,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
ImplementsKeyword = 103,
|
||||
ImplementsKeyword = 102,
|
||||
>ImplementsKeyword : SyntaxKind
|
||||
|
||||
InterfaceKeyword = 104,
|
||||
InterfaceKeyword = 103,
|
||||
>InterfaceKeyword : SyntaxKind
|
||||
|
||||
LetKeyword = 105,
|
||||
LetKeyword = 104,
|
||||
>LetKeyword : SyntaxKind
|
||||
|
||||
PackageKeyword = 106,
|
||||
PackageKeyword = 105,
|
||||
>PackageKeyword : SyntaxKind
|
||||
|
||||
PrivateKeyword = 107,
|
||||
PrivateKeyword = 106,
|
||||
>PrivateKeyword : SyntaxKind
|
||||
|
||||
ProtectedKeyword = 108,
|
||||
ProtectedKeyword = 107,
|
||||
>ProtectedKeyword : SyntaxKind
|
||||
|
||||
PublicKeyword = 109,
|
||||
PublicKeyword = 108,
|
||||
>PublicKeyword : SyntaxKind
|
||||
|
||||
StaticKeyword = 110,
|
||||
StaticKeyword = 109,
|
||||
>StaticKeyword : SyntaxKind
|
||||
|
||||
YieldKeyword = 111,
|
||||
YieldKeyword = 110,
|
||||
>YieldKeyword : SyntaxKind
|
||||
|
||||
AnyKeyword = 112,
|
||||
AnyKeyword = 111,
|
||||
>AnyKeyword : SyntaxKind
|
||||
|
||||
BooleanKeyword = 113,
|
||||
BooleanKeyword = 112,
|
||||
>BooleanKeyword : SyntaxKind
|
||||
|
||||
ConstructorKeyword = 114,
|
||||
ConstructorKeyword = 113,
|
||||
>ConstructorKeyword : SyntaxKind
|
||||
|
||||
DeclareKeyword = 115,
|
||||
DeclareKeyword = 114,
|
||||
>DeclareKeyword : SyntaxKind
|
||||
|
||||
GetKeyword = 116,
|
||||
GetKeyword = 115,
|
||||
>GetKeyword : SyntaxKind
|
||||
|
||||
ModuleKeyword = 117,
|
||||
ModuleKeyword = 116,
|
||||
>ModuleKeyword : SyntaxKind
|
||||
|
||||
RequireKeyword = 118,
|
||||
RequireKeyword = 117,
|
||||
>RequireKeyword : SyntaxKind
|
||||
|
||||
NumberKeyword = 119,
|
||||
NumberKeyword = 118,
|
||||
>NumberKeyword : SyntaxKind
|
||||
|
||||
SetKeyword = 120,
|
||||
SetKeyword = 119,
|
||||
>SetKeyword : SyntaxKind
|
||||
|
||||
StringKeyword = 121,
|
||||
StringKeyword = 120,
|
||||
>StringKeyword : SyntaxKind
|
||||
|
||||
SymbolKeyword = 122,
|
||||
SymbolKeyword = 121,
|
||||
>SymbolKeyword : SyntaxKind
|
||||
|
||||
TypeKeyword = 123,
|
||||
TypeKeyword = 122,
|
||||
>TypeKeyword : SyntaxKind
|
||||
|
||||
FromKeyword = 123,
|
||||
>FromKeyword : SyntaxKind
|
||||
|
||||
OfKeyword = 124,
|
||||
>OfKeyword : SyntaxKind
|
||||
|
||||
@@ -1151,10 +1151,10 @@ declare module "typescript" {
|
||||
LastKeyword = 124,
|
||||
>LastKeyword : SyntaxKind
|
||||
|
||||
FirstFutureReservedWord = 103,
|
||||
FirstFutureReservedWord = 102,
|
||||
>FirstFutureReservedWord : SyntaxKind
|
||||
|
||||
LastFutureReservedWord = 111,
|
||||
LastFutureReservedWord = 110,
|
||||
>LastFutureReservedWord : SyntaxKind
|
||||
|
||||
FirstTypeNode = 139,
|
||||
@@ -2299,17 +2299,13 @@ declare module "typescript" {
|
||||
>finallyBlock : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface CatchClause extends Declaration {
|
||||
interface CatchClause extends Node {
|
||||
>CatchClause : CatchClause
|
||||
>Declaration : Declaration
|
||||
>Node : Node
|
||||
|
||||
name: Identifier;
|
||||
>name : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
variableDeclaration: VariableDeclaration;
|
||||
>variableDeclaration : VariableDeclaration
|
||||
>VariableDeclaration : VariableDeclaration
|
||||
|
||||
block: Block;
|
||||
>block : Block
|
||||
@@ -2987,6 +2983,12 @@ declare module "typescript" {
|
||||
>getAliasedSymbol : (symbol: Symbol) => Symbol
|
||||
>symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
|
||||
@@ -12,8 +12,8 @@ obj[Symbol.foo];
|
||||
|
||||
//// [ES5SymbolProperty1.js]
|
||||
var Symbol;
|
||||
var obj = (_a = {}, _a[Symbol.foo] =
|
||||
0,
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[Symbol.foo] = 0,
|
||||
_a);
|
||||
obj[Symbol.foo];
|
||||
var _a;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var v = { [yield]: foo }
|
||||
|
||||
//// [FunctionDeclaration8_es6.js]
|
||||
var v = (_a = {}, _a[yield] =
|
||||
foo,
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a[yield] = foo,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -5,8 +5,8 @@ function * foo() {
|
||||
|
||||
//// [FunctionDeclaration9_es6.js]
|
||||
function foo() {
|
||||
var v = (_a = {}, _a[] =
|
||||
foo,
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a[] = foo,
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
var v = { *[foo()]() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments5_es6.js]
|
||||
var v = (_a = {}, _a[foo()] = function () { },
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
})();
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -217,7 +217,15 @@
|
||||
>:=> (line 28, col 8) to (line 28, col 22)
|
||||
29 > } catch (e) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (416 to 428) SpanInfo: {"start":437,"length":15}
|
||||
~~~~~~~~ => Pos: (416 to 423) SpanInfo: {"start":437,"length":15}
|
||||
>if (obj.z < 10)
|
||||
>:=> (line 30, col 8) to (line 30, col 23)
|
||||
29 > } catch (e) {
|
||||
|
||||
~ => Pos: (424 to 424) SpanInfo: undefined
|
||||
29 > } catch (e) {
|
||||
|
||||
~~~~ => Pos: (425 to 428) SpanInfo: {"start":437,"length":15}
|
||||
>if (obj.z < 10)
|
||||
>:=> (line 30, col 8) to (line 30, col 23)
|
||||
--------------------------------
|
||||
@@ -286,7 +294,15 @@
|
||||
>:=> (line 37, col 8) to (line 37, col 25)
|
||||
38 > } catch (e1) {
|
||||
|
||||
~~~~~~~~~~~~~~ => Pos: (581 to 594) SpanInfo: {"start":603,"length":10}
|
||||
~~~~~~~~ => Pos: (581 to 588) SpanInfo: {"start":603,"length":10}
|
||||
>var b = e1
|
||||
>:=> (line 39, col 8) to (line 39, col 18)
|
||||
38 > } catch (e1) {
|
||||
|
||||
~~ => Pos: (589 to 590) SpanInfo: undefined
|
||||
38 > } catch (e1) {
|
||||
|
||||
~~~~ => Pos: (591 to 594) SpanInfo: {"start":603,"length":10}
|
||||
>var b = e1
|
||||
>:=> (line 39, col 8) to (line 39, col 18)
|
||||
--------------------------------
|
||||
|
||||
@@ -24,7 +24,15 @@
|
||||
>:=> (line 3, col 4) to (line 3, col 13)
|
||||
4 >} catch (e) {
|
||||
|
||||
~~~~~~~~~~~~~ => Pos: (34 to 46) SpanInfo: {"start":51,"length":9}
|
||||
~~~~~~~~ => Pos: (34 to 41) SpanInfo: {"start":51,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 5, col 4) to (line 5, col 13)
|
||||
4 >} catch (e) {
|
||||
|
||||
~ => Pos: (42 to 42) SpanInfo: undefined
|
||||
4 >} catch (e) {
|
||||
|
||||
~~~~ => Pos: (43 to 46) SpanInfo: {"start":51,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 5, col 4) to (line 5, col 13)
|
||||
--------------------------------
|
||||
@@ -94,7 +102,15 @@
|
||||
--------------------------------
|
||||
14 >catch (e)
|
||||
|
||||
~~~~~~~~~~ => Pos: (138 to 147) SpanInfo: {"start":154,"length":9}
|
||||
~~~~~~~ => Pos: (138 to 144) SpanInfo: {"start":154,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 16, col 4) to (line 16, col 13)
|
||||
14 >catch (e)
|
||||
|
||||
~ => Pos: (145 to 145) SpanInfo: undefined
|
||||
14 >catch (e)
|
||||
|
||||
~~ => Pos: (146 to 147) SpanInfo: {"start":154,"length":9}
|
||||
>x = x - 1
|
||||
>:=> (line 16, col 4) to (line 16, col 13)
|
||||
--------------------------------
|
||||
|
||||
@@ -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;
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/catchClauseWithBindingPattern1.ts(3,8): error TS1195: Catch clause variable name must be an identifier.
|
||||
|
||||
|
||||
==== tests/cases/compiler/catchClauseWithBindingPattern1.ts (1 errors) ====
|
||||
try {
|
||||
}
|
||||
catch ({a}) {
|
||||
~
|
||||
!!! error TS1195: Catch clause variable name must be an identifier.
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [catchClauseWithBindingPattern1.ts]
|
||||
try {
|
||||
}
|
||||
catch ({a}) {
|
||||
}
|
||||
|
||||
//// [catchClauseWithBindingPattern1.js]
|
||||
try {
|
||||
}
|
||||
catch (a = (void 0).a) {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/catchClauseWithInitializer1.ts(3,12): error TS1197: Catch clause variable cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/compiler/catchClauseWithInitializer1.ts (1 errors) ====
|
||||
try {
|
||||
}
|
||||
catch (e = 1) {
|
||||
~
|
||||
!!! error TS1197: Catch clause variable cannot have an initializer.
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [catchClauseWithInitializer1.ts]
|
||||
try {
|
||||
}
|
||||
catch (e = 1) {
|
||||
}
|
||||
|
||||
//// [catchClauseWithInitializer1.js]
|
||||
try {
|
||||
}
|
||||
catch (e = 1) {
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/catchClauseWithTypeAnnotation.ts(2,11): error TS1013: Catch clause parameter cannot have a type annotation.
|
||||
tests/cases/compiler/catchClauseWithTypeAnnotation.ts(2,13): error TS1196: Catch clause variable cannot have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/compiler/catchClauseWithTypeAnnotation.ts (1 errors) ====
|
||||
try {
|
||||
} catch (e: any) {
|
||||
~
|
||||
!!! error TS1013: Catch clause parameter cannot have a type annotation.
|
||||
~~~
|
||||
!!! error TS1196: Catch clause variable cannot have a type annotation.
|
||||
}
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
@@ -20,6 +20,17 @@ var v = {
|
||||
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);
|
||||
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);
|
||||
var _a;
|
||||
|
||||
@@ -20,6 +20,17 @@ var v = {
|
||||
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);
|
||||
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);
|
||||
var _a;
|
||||
|
||||
@@ -7,8 +7,8 @@ function foo() {
|
||||
|
||||
//// [computedPropertyNames18_ES5.js]
|
||||
function foo() {
|
||||
var obj = (_a = {}, _a[this.bar] =
|
||||
0,
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ module M {
|
||||
//// [computedPropertyNames19_ES5.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
var obj = (_a = {}, _a[this.bar] =
|
||||
0,
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
})(M || (M = {}));
|
||||
|
||||
@@ -5,6 +5,8 @@ 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);
|
||||
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);
|
||||
var _a;
|
||||
|
||||
@@ -4,7 +4,7 @@ var obj = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames20_ES5.js]
|
||||
var obj = (_a = {}, _a[this.bar] =
|
||||
0,
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -13,8 +13,9 @@ var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var obj = (_a = {}, _a[this.bar()] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[this.bar()] = function () { },
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -15,9 +15,9 @@ var C = (function () {
|
||||
C.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[(_a = {}, _a[this.bar()] =
|
||||
1,
|
||||
_a)[0]] = function () { };
|
||||
C.prototype[(_a = {},
|
||||
_a[this.bar()] = 1,
|
||||
_a)[0]] = function () { };
|
||||
return C;
|
||||
})();
|
||||
var _a;
|
||||
|
||||
@@ -34,8 +34,9 @@ var C = (function (_super) {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(this)] = function () { },
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -34,9 +34,9 @@ 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 () { };
|
||||
C.prototype[(_a = {},
|
||||
_a[super.bar.call(this)] = 1,
|
||||
_a)[0]] = function () { };
|
||||
return C;
|
||||
})(Base);
|
||||
var _a;
|
||||
|
||||
@@ -26,8 +26,9 @@ var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.call(this);
|
||||
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -17,8 +17,9 @@ var C = (function () {
|
||||
C.prototype.bar = function () {
|
||||
var _this = this;
|
||||
(function () {
|
||||
var obj = (_a = {}, _a[_this.bar()] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[_this.bar()] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
return 0;
|
||||
|
||||
@@ -32,8 +32,9 @@ var C = (function (_super) {
|
||||
function C() {
|
||||
_super.call(this);
|
||||
(function () {
|
||||
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,8 +38,9 @@ var C = (function (_super) {
|
||||
C.prototype.foo = function () {
|
||||
var _this = this;
|
||||
(function () {
|
||||
var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(_this)] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
return 0;
|
||||
|
||||
@@ -15,8 +15,9 @@ var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var obj = (_a = {}, _a[foo()] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -15,8 +15,9 @@ var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.bar = function () {
|
||||
var obj = (_a = {}, _a[foo()] = function () { },
|
||||
_a);
|
||||
var obj = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ var o = {
|
||||
};
|
||||
|
||||
//// [computedPropertyNames46_ES5.js]
|
||||
var o = (_a = {}, _a["" || 0] =
|
||||
0,
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a["" || 0] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -14,7 +14,7 @@ var E2;
|
||||
(function (E2) {
|
||||
E2[E2["x"] = 0] = "x";
|
||||
})(E2 || (E2 = {}));
|
||||
var o = (_a = {}, _a[0 /* x */ || 0 /* x */] =
|
||||
0,
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a[0 /* x */ || 0 /* x */] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -23,13 +23,13 @@ var E;
|
||||
E[E["x"] = 0] = "x";
|
||||
})(E || (E = {}));
|
||||
var a;
|
||||
extractIndexer((_a = {}, _a[a] =
|
||||
"",
|
||||
_a)); // Should return string
|
||||
extractIndexer((_b = {}, _b[0 /* x */] =
|
||||
"",
|
||||
_b)); // Should return string
|
||||
extractIndexer((_c = {}, _c["" || 0] =
|
||||
"",
|
||||
_c)); // Should return any (widened form of undefined)
|
||||
extractIndexer((_a = {},
|
||||
_a[a] = "",
|
||||
_a)); // Should return string
|
||||
extractIndexer((_b = {},
|
||||
_b[0 /* x */] = "",
|
||||
_b)); // Should return string
|
||||
extractIndexer((_c = {},
|
||||
_c["" || 0] = "",
|
||||
_c)); // Should return any (widened form of undefined)
|
||||
var _a, _b, _c;
|
||||
|
||||
@@ -28,19 +28,23 @@ var x = {
|
||||
//// [computedPropertyNames49_ES5.js]
|
||||
var x = (_a = {
|
||||
p1: 10
|
||||
}, _a.p1 =
|
||||
10, _a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
return 10;
|
||||
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () {
|
||||
// just throw
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () {
|
||||
if (1 == 1) {
|
||||
},
|
||||
_a.p1 = 10,
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
return 10;
|
||||
}
|
||||
}, enumerable: true, configurable: true }), _a.p2 =
|
||||
20,
|
||||
_a);
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ set: function () {
|
||||
// just throw
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a.foo = Object.defineProperty({ get: function () {
|
||||
if (1 == 1) {
|
||||
return 10;
|
||||
}
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a.p2 = 20,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -20,17 +20,17 @@ var v = {
|
||||
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);
|
||||
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);
|
||||
var _a;
|
||||
|
||||
@@ -33,19 +33,23 @@ var x = (_a = {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
}, _a.p1 =
|
||||
10, _a.foo = Object.defineProperty({ get: function () {
|
||||
if (1 == 1) {
|
||||
},
|
||||
_a.p1 = 10,
|
||||
_a.foo = Object.defineProperty({ get: function () {
|
||||
if (1 == 1) {
|
||||
return 10;
|
||||
}
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ set: function () {
|
||||
// just throw
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
return 10;
|
||||
}
|
||||
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () {
|
||||
// just throw
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
return 10;
|
||||
}, enumerable: true, configurable: true }), _a.p2 =
|
||||
20,
|
||||
_a);
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a.p2 = 20,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -11,12 +11,12 @@ 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);
|
||||
var v = (_a = {},
|
||||
_a[b] = 0,
|
||||
_a[true] = 1,
|
||||
_a[[]] = 0,
|
||||
_a[{}] = 0,
|
||||
_a[undefined] = undefined,
|
||||
_a[null] = null,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -12,9 +12,9 @@ var v = {
|
||||
var p1;
|
||||
var p2;
|
||||
var p3;
|
||||
var v = (_a = {}, _a[p1] =
|
||||
0, _a[p2] =
|
||||
1, _a[p3] =
|
||||
2,
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a[p1] = 0,
|
||||
_a[p2] = 1,
|
||||
_a[p3] = 2,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -11,7 +11,7 @@ var E;
|
||||
(function (E) {
|
||||
E[E["member"] = 0] = "member";
|
||||
})(E || (E = {}));
|
||||
var v = (_a = {}, _a[0 /* member */] =
|
||||
0,
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a[0 /* member */] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -12,9 +12,9 @@ function f<T, U extends string>() {
|
||||
function f() {
|
||||
var t;
|
||||
var u;
|
||||
var v = (_a = {}, _a[t] =
|
||||
0, _a[u] =
|
||||
1,
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a[t] = 0,
|
||||
_a[u] = 1,
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ var v = {
|
||||
|
||||
//// [computedPropertyNames9_ES5.js]
|
||||
function f(x) { }
|
||||
var v = (_a = {}, _a[f("")] =
|
||||
0, _a[f(0)] =
|
||||
0, _a[f(true)] =
|
||||
0,
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a[f("")] = 0,
|
||||
_a[f(0)] = 0,
|
||||
_a[f(true)] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -9,8 +9,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType10_ES5.js]
|
||||
var o = (_a = {}, _a[+"foo"] =
|
||||
"", _a[+"bar"] =
|
||||
0,
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -10,7 +10,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType1_ES5.js]
|
||||
var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] =
|
||||
function (y) { return y.length; },
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a["" + 0] = function (y) { return y.length; },
|
||||
_a["" + 1] = function (y) { return y.length; },
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -10,7 +10,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType2_ES5.js]
|
||||
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] =
|
||||
function (y) { return y.length; },
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = function (y) { return y.length; },
|
||||
_a[+"bar"] = function (y) { return y.length; },
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -9,7 +9,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType3_ES5.js]
|
||||
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] =
|
||||
function (y) { return y.length; },
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = function (y) { return y.length; },
|
||||
_a[+"bar"] = function (y) { return y.length; },
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -10,8 +10,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType4_ES5.js]
|
||||
var o = (_a = {}, _a["" + "foo"] =
|
||||
"", _a["" + "bar"] =
|
||||
0,
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a["" + "foo"] = "",
|
||||
_a["" + "bar"] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -10,8 +10,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType5_ES5.js]
|
||||
var o = (_a = {}, _a[+"foo"] =
|
||||
"", _a[+"bar"] =
|
||||
0,
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -17,11 +17,11 @@ foo({
|
||||
foo((_a = {
|
||||
p: "",
|
||||
0: function () { }
|
||||
}, _a.p =
|
||||
"", _a[0] =
|
||||
function () { }, _a["hi" + "bye"] =
|
||||
true, _a[0 + 1] =
|
||||
0, _a[+"hi"] =
|
||||
[0],
|
||||
_a));
|
||||
},
|
||||
_a.p = "",
|
||||
_a[0] = function () { },
|
||||
_a["hi" + "bye"] = true,
|
||||
_a[0 + 1] = 0,
|
||||
_a[+"hi"] = [0],
|
||||
_a));
|
||||
var _a;
|
||||
|
||||
@@ -17,11 +17,11 @@ foo({
|
||||
foo((_a = {
|
||||
p: "",
|
||||
0: function () { }
|
||||
}, _a.p =
|
||||
"", _a[0] =
|
||||
function () { }, _a["hi" + "bye"] =
|
||||
true, _a[0 + 1] =
|
||||
0, _a[+"hi"] =
|
||||
[0],
|
||||
_a));
|
||||
},
|
||||
_a.p = "",
|
||||
_a[0] = function () { },
|
||||
_a["hi" + "bye"] = true,
|
||||
_a[0 + 1] = 0,
|
||||
_a[+"hi"] = [0],
|
||||
_a));
|
||||
var _a;
|
||||
|
||||
@@ -10,8 +10,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType8_ES5.js]
|
||||
var o = (_a = {}, _a["" + "foo"] =
|
||||
"", _a["" + "bar"] =
|
||||
0,
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a["" + "foo"] = "",
|
||||
_a["" + "bar"] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -10,8 +10,8 @@ var o: I = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType9_ES5.js]
|
||||
var o = (_a = {}, _a[+"foo"] =
|
||||
"", _a[+"bar"] =
|
||||
0,
|
||||
_a);
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
@@ -7,9 +7,12 @@ 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);
|
||||
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);
|
||||
var _a;
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@ var v = {
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesSourceMap2_ES5.js]
|
||||
var v = (_a = {}, _a["hello"] = function () {
|
||||
debugger;
|
||||
},
|
||||
_a);
|
||||
var v = (_a = {},
|
||||
_a["hello"] = function () {
|
||||
debugger;
|
||||
},
|
||||
_a);
|
||||
var _a;
|
||||
//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [computedPropertyNamesSourceMap2_ES5.js.map]
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"}
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA;IACA,EAAA,CACK,OAAO,CAFA,GAAA;QAGA,QAAQ,CAAC;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IAJD,EAAA"}
|
||||
@@ -8,7 +8,7 @@ sources: computedPropertyNamesSourceMap2_ES5.ts
|
||||
emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js
|
||||
sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var v = (_a = {}, _a["hello"] = function () {
|
||||
>>>var v = (_a = {},
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
@@ -18,12 +18,7 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
||||
7 > ^^
|
||||
8 > ^^^
|
||||
9 > ^^
|
||||
10> ^^
|
||||
11> ^^
|
||||
12> ^
|
||||
13> ^^^^^^^
|
||||
14> ^
|
||||
15> ^^^
|
||||
10> ^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >var
|
||||
3 > v
|
||||
@@ -43,25 +38,6 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
||||
9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
9 >
|
||||
10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 19) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
10>
|
||||
11> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 21) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
11>
|
||||
12> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 22) Source(2, 6) + SourceIndex(0) nameIndex (-1)
|
||||
12> var v = {
|
||||
> [
|
||||
13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 19) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 29) Source(2, 13) + SourceIndex(0) nameIndex (-1)
|
||||
13> "hello"
|
||||
14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 21) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
14>
|
||||
15> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 22) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 33) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
15>
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
|
||||
@@ -71,90 +47,111 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
||||
7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0)
|
||||
8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0)
|
||||
9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0)
|
||||
10>Emitted(1, 19) Source(1, 1) + SourceIndex(0)
|
||||
11>Emitted(1, 21) Source(1, 1) + SourceIndex(0)
|
||||
12>Emitted(1, 22) Source(2, 6) + SourceIndex(0)
|
||||
13>Emitted(1, 29) Source(2, 13) + SourceIndex(0)
|
||||
14>Emitted(1, 30) Source(0, NaN) + SourceIndex(0)
|
||||
15>Emitted(1, 33) Source(0, NaN) + SourceIndex(0)
|
||||
---
|
||||
>>> debugger;
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^
|
||||
3 > ^
|
||||
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(1, 29) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(3, 9) + SourceIndex(0) nameIndex (-1)
|
||||
1 >
|
||||
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 13) Source(3, 17) + SourceIndex(0) nameIndex (-1)
|
||||
2 > debugger
|
||||
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 14) Source(3, 18) + SourceIndex(0) nameIndex (-1)
|
||||
3 > ;
|
||||
1 >Emitted(2, 5) Source(3, 9) + SourceIndex(0)
|
||||
2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0)
|
||||
3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0)
|
||||
---
|
||||
>>>},
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
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 >
|
||||
>
|
||||
2 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(4, 6) + 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(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
3 >
|
||||
1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0)
|
||||
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["hello"] = function () {
|
||||
1->^^^^
|
||||
2 > ^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
3 > ^
|
||||
4 > ^^^^^^^
|
||||
5 > ^
|
||||
6 > ^^^
|
||||
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->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
1->
|
||||
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
2 >
|
||||
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 8) Source(2, 6) + SourceIndex(0) nameIndex (-1)
|
||||
3 > var v = {
|
||||
> [
|
||||
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(2, 5) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 15) Source(2, 13) + SourceIndex(0) nameIndex (-1)
|
||||
4 > "hello"
|
||||
5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 16) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
5 >
|
||||
6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 8) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 19) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
6 >
|
||||
1->Emitted(2, 5) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 7) Source(1, 1) + SourceIndex(0)
|
||||
3 >Emitted(2, 8) Source(2, 6) + SourceIndex(0)
|
||||
4 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
|
||||
5 >Emitted(2, 16) Source(0, NaN) + SourceIndex(0)
|
||||
6 >Emitted(2, 19) Source(0, NaN) + SourceIndex(0)
|
||||
---
|
||||
>>> debugger;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^^^
|
||||
3 > ^
|
||||
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, 15) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 9) Source(3, 9) + SourceIndex(0) nameIndex (-1)
|
||||
1 >
|
||||
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 17) Source(3, 17) + SourceIndex(0) nameIndex (-1)
|
||||
2 > debugger
|
||||
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 18) Source(3, 18) + SourceIndex(0) nameIndex (-1)
|
||||
3 > ;
|
||||
1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0)
|
||||
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0)
|
||||
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0)
|
||||
---
|
||||
>>> },
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 >
|
||||
4 > ^^^^->
|
||||
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(4, 5) + SourceIndex(0) nameIndex (-1)
|
||||
1 >
|
||||
>
|
||||
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(4, 6) + 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, 9) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
3 >
|
||||
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
|
||||
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
|
||||
3 >Emitted(4, 6) Source(0, NaN) + SourceIndex(0)
|
||||
---
|
||||
>>> _a);
|
||||
1->^^^^
|
||||
2 > ^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
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(3, 17) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(0, NaN) + 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(3, 18) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
2 >
|
||||
1->Emitted(5, 5) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(5, 7) 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(4, 5) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 8) Source(5, 2) + 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(4, 6) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1)
|
||||
4 >
|
||||
1->Emitted(5, 5) Source(0, NaN) + SourceIndex(0)
|
||||
2 >Emitted(5, 7) Source(0, NaN) + SourceIndex(0)
|
||||
3 >Emitted(5, 8) Source(5, 2) + SourceIndex(0)
|
||||
4 >Emitted(5, 9) Source(5, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>var _a;
|
||||
1 >^^^^
|
||||
2 > ^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
1 >
|
||||
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
2 >
|
||||
1 >Emitted(6, 5) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(6, 7) Source(1, 1) + SourceIndex(0)
|
||||
---
|
||||
!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded
|
||||
!!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA
|
||||
!!!! **** Remaining decoded string: ;IAAA,EAAA,CAKA,CAAA;IAJD,EAAA
|
||||
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
|
||||
@@ -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
@@ -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 >
|
||||
|
||||
@@ -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() { }
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
})();
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -36,7 +36,7 @@ var xxxx = a;
|
||||
>a : number
|
||||
|
||||
import { a as b } from "es6ImportNamedImport_0";
|
||||
>a : unknown
|
||||
>a : number
|
||||
>b : number
|
||||
|
||||
var xxxx = b;
|
||||
@@ -45,7 +45,7 @@ var xxxx = b;
|
||||
|
||||
import { x, a as y } from "es6ImportNamedImport_0";
|
||||
>x : number
|
||||
>a : unknown
|
||||
>a : number
|
||||
>y : number
|
||||
|
||||
var xxxx = x;
|
||||
@@ -57,7 +57,7 @@ var xxxx = y;
|
||||
>y : number
|
||||
|
||||
import { x as z, } from "es6ImportNamedImport_0";
|
||||
>x : unknown
|
||||
>x : number
|
||||
>z : number
|
||||
|
||||
var xxxx = z;
|
||||
@@ -84,9 +84,9 @@ var xxxx = x1;
|
||||
>x1 : number
|
||||
|
||||
import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0";
|
||||
>a1 : unknown
|
||||
>a1 : number
|
||||
>a11 : number
|
||||
>x1 : unknown
|
||||
>x1 : number
|
||||
>x11 : number
|
||||
|
||||
var xxxx = a11;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user