merge
This commit is contained in:
commit
e5a8debb79
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
root = true
|
||||
|
||||
[{src,scripts}/**.{ts,json,js}]
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
|
@ -1,6 +1,8 @@
|
|||
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
|
||||
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/pr)](http://issuestats.com/github/microsoft/typescript)
|
||||
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/issue)](http://issuestats.com/github/microsoft/typescript)
|
||||
[![npm version](https://badge.fury.io/js/typescript.svg)](http://badge.fury.io/js/typescript)
|
||||
[![Downloads](http://img.shields.io/npm/dm/TypeScript.svg)](https://npmjs.org/package/typescript)
|
||||
|
||||
# TypeScript
|
||||
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -67,7 +67,8 @@ module ts {
|
|||
|
||||
if (!file.locals) {
|
||||
file.locals = {};
|
||||
container = blockScopeContainer = file;
|
||||
container = file;
|
||||
setBlockScopeContainer(file, /*cleanLocals*/ false);
|
||||
bind(file);
|
||||
file.symbolCount = symbolCount;
|
||||
}
|
||||
|
@ -77,6 +78,13 @@ module ts {
|
|||
return new Symbol(flags, name);
|
||||
}
|
||||
|
||||
function setBlockScopeContainer(node: Node, cleanLocals: boolean) {
|
||||
blockScopeContainer = node;
|
||||
if (cleanLocals) {
|
||||
blockScopeContainer.locals = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function addDeclarationToSymbol(symbol: Symbol, node: Declaration, symbolKind: SymbolFlags) {
|
||||
symbol.flags |= symbolKind;
|
||||
if (!symbol.declarations) symbol.declarations = [];
|
||||
|
@ -236,7 +244,13 @@ module ts {
|
|||
}
|
||||
|
||||
if (isBlockScopeContainer) {
|
||||
blockScopeContainer = node;
|
||||
// in incremental scenarios we might reuse nodes that already have locals being allocated
|
||||
// during the bind step these locals should be dropped to prevent using stale data.
|
||||
// locals should always be dropped unless they were previously initialized by the binder
|
||||
// these cases are:
|
||||
// - node has locals (symbolKind & HasLocals) !== 0
|
||||
// - node is a source file
|
||||
setBlockScopeContainer(node, /*cleanLocals*/ (symbolKind & SymbolFlags.HasLocals) === 0 && node.kind !== SyntaxKind.SourceFile);
|
||||
}
|
||||
|
||||
forEachChild(node, bind);
|
||||
|
@ -342,14 +356,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 +384,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 +397,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 {
|
||||
|
|
|
@ -97,6 +97,7 @@ module ts {
|
|||
var globalRegExpType: ObjectType;
|
||||
var globalTemplateStringsArrayType: ObjectType;
|
||||
var globalESSymbolType: ObjectType;
|
||||
var globalIterableType: ObjectType;
|
||||
|
||||
var anyArrayType: Type;
|
||||
|
||||
|
@ -416,13 +417,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;
|
||||
|
@ -451,7 +445,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));
|
||||
|
@ -595,13 +590,13 @@ module ts {
|
|||
}
|
||||
|
||||
if (name.kind === SyntaxKind.Identifier) {
|
||||
var symbol = resolveName(location,(<Identifier>name).text, meaning, Diagnostics.Cannot_find_name_0, <Identifier>name);
|
||||
var symbol = resolveName(location, (<Identifier>name).text, meaning, Diagnostics.Cannot_find_name_0, <Identifier>name);
|
||||
if (!symbol) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (name.kind === SyntaxKind.QualifiedName) {
|
||||
var namespace = resolveEntityName(location,(<QualifiedName>name).left, SymbolFlags.Namespace);
|
||||
var namespace = resolveEntityName(location, (<QualifiedName>name).left, SymbolFlags.Namespace);
|
||||
if (!namespace || namespace === unknownSymbol || getFullWidth((<QualifiedName>name).right) === 0) return;
|
||||
var symbol = getSymbol(getExportsOfSymbol(namespace), (<QualifiedName>name).right.text, meaning);
|
||||
if (!symbol) {
|
||||
|
@ -751,7 +746,10 @@ module ts {
|
|||
forEach(symbol.declarations, node => {
|
||||
if (node.kind === SyntaxKind.SourceFile || node.kind === SyntaxKind.ModuleDeclaration) {
|
||||
forEach((<ExportContainer>node).exportStars, exportStar => {
|
||||
visit(resolveExternalModuleName(exportStar, exportStar.moduleSpecifier));
|
||||
var moduleSymbol = resolveExternalModuleName(exportStar, exportStar.moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
visit(moduleSymbol);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1862,6 +1860,9 @@ module ts {
|
|||
if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) {
|
||||
return anyType;
|
||||
}
|
||||
if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) {
|
||||
return getTypeForVariableDeclarationInForOfStatement(<ForOfStatement>declaration.parent.parent);
|
||||
}
|
||||
if (isBindingPattern(declaration.parent)) {
|
||||
return getTypeForBindingElement(<BindingElement>declaration);
|
||||
}
|
||||
|
@ -1994,7 +1995,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
|
||||
|
@ -3153,8 +3154,8 @@ module ts {
|
|||
return resolveName(undefined, name, meaning, diagnostic, name);
|
||||
}
|
||||
|
||||
function getGlobalType(name: string): ObjectType {
|
||||
return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0);
|
||||
function getGlobalType(name: string, arity = 0): ObjectType {
|
||||
return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity);
|
||||
}
|
||||
|
||||
function getGlobalESSymbolConstructorSymbol() {
|
||||
|
@ -3536,7 +3537,7 @@ module ts {
|
|||
isContextSensitive((<ConditionalExpression>node).whenFalse);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return (<BinaryExpression>node).operatorToken.kind === SyntaxKind.BarBarToken &&
|
||||
(isContextSensitive((<BinaryExpression>node).left) || isContextSensitive((<BinaryExpression>node).right));
|
||||
(isContextSensitive((<BinaryExpression>node).left) || isContextSensitive((<BinaryExpression>node).right));
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return isContextSensitive((<PropertyAssignment>node).initializer);
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
|
@ -5002,7 +5003,7 @@ module ts {
|
|||
break;
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
if ((<PrefixUnaryExpression>expr).operator === SyntaxKind.ExclamationToken) {
|
||||
return narrowType(type,(<PrefixUnaryExpression>expr).operand, !assumeTrue);
|
||||
return narrowType(type, (<PrefixUnaryExpression>expr).operand, !assumeTrue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -5073,7 +5074,7 @@ module ts {
|
|||
nodeLinks.importOnRightSide = symbol;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (symbolLinks.referenced) {
|
||||
markLinkedImportsAsReferenced(<ImportEqualsDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ImportEqualsDeclaration));
|
||||
}
|
||||
|
@ -5081,10 +5082,63 @@ module ts {
|
|||
|
||||
checkCollisionWithCapturedSuperVariable(node, node);
|
||||
checkCollisionWithCapturedThisVariable(node, node);
|
||||
checkBlockScopedBindingCapturedInLoop(node, symbol);
|
||||
|
||||
return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node);
|
||||
}
|
||||
|
||||
function isInsideFunction(node: Node, threshold: Node): boolean {
|
||||
var current = node;
|
||||
while (current && current !== threshold) {
|
||||
if (isAnyFunction(current)) {
|
||||
return true;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkBlockScopedBindingCapturedInLoop(node: Identifier, symbol: Symbol): void {
|
||||
if (languageVersion >= ScriptTarget.ES6 ||
|
||||
(symbol.flags & SymbolFlags.BlockScopedVariable) === 0 ||
|
||||
symbol.valueDeclaration.parent.kind === SyntaxKind.CatchClause) {
|
||||
return;
|
||||
}
|
||||
|
||||
// - check if binding is used in some function
|
||||
// (stop the walk when reaching container of binding declaration)
|
||||
// - if first check succeeded - check if variable is declared inside the loop
|
||||
|
||||
// nesting structure:
|
||||
// (variable declaration or binding element) -> variable declaration list -> container
|
||||
var container: Node = symbol.valueDeclaration;
|
||||
while (container.kind !== SyntaxKind.VariableDeclarationList) {
|
||||
container = container.parent;
|
||||
}
|
||||
// get the parent of variable declaration list
|
||||
container = container.parent;
|
||||
if (container.kind === SyntaxKind.VariableStatement) {
|
||||
// if parent is variable statement - get its parent
|
||||
container = container.parent;
|
||||
}
|
||||
|
||||
var inFunction = isInsideFunction(node.parent, container);
|
||||
|
||||
var current = container;
|
||||
while (current && !nodeStartsNewLexicalEnvironment(current)) {
|
||||
if (isIterationStatement(current, /*lookInLabeledStatements*/ false)) {
|
||||
if (inFunction) {
|
||||
grammarErrorOnFirstToken(current, Diagnostics.Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher, declarationNameToString(node));
|
||||
}
|
||||
// mark value declaration so during emit they can have a special handling
|
||||
getNodeLinks(<VariableDeclaration>symbol.valueDeclaration).flags |= NodeCheckFlags.BlockScopedBindingInLoop;
|
||||
break;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
}
|
||||
|
||||
function captureLexicalThis(node: Node, container: Node): void {
|
||||
var classNode = container.parent && container.parent.kind === SyntaxKind.ClassDeclaration ? container.parent : undefined;
|
||||
getNodeLinks(node).flags |= NodeCheckFlags.LexicalThis;
|
||||
|
@ -5441,7 +5495,7 @@ module ts {
|
|||
return propertyType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return isNumericName(element.name) && getIndexTypeOfContextualType(type, IndexKind.Number) ||
|
||||
getIndexTypeOfContextualType(type, IndexKind.String);
|
||||
}
|
||||
|
@ -5450,14 +5504,17 @@ module ts {
|
|||
}
|
||||
|
||||
// In an array literal contextually typed by a type T, the contextual type of an element expression at index N is
|
||||
// the type of the property with the numeric name N in T, if one exists. Otherwise, it is the type of the numeric
|
||||
// index signature in T, if one exists.
|
||||
// the type of the property with the numeric name N in T, if one exists. Otherwise, if T has a numeric index signature,
|
||||
// it is the type of the numeric index signature in T. Otherwise, in ES6 and higher, the contextual type is the iterated
|
||||
// type of T.
|
||||
function getContextualTypeForElementExpression(node: Expression): Type {
|
||||
var arrayLiteral = <ArrayLiteralExpression>node.parent;
|
||||
var type = getContextualType(arrayLiteral);
|
||||
if (type) {
|
||||
var index = indexOf(arrayLiteral.elements, node);
|
||||
return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, IndexKind.Number);
|
||||
return getTypeOfPropertyOfContextualType(type, "" + index)
|
||||
|| getIndexTypeOfContextualType(type, IndexKind.Number)
|
||||
|| (languageVersion >= ScriptTarget.ES6 ? checkIteratedType(type, /*expressionForError*/ undefined) : undefined);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
@ -6034,7 +6091,7 @@ module ts {
|
|||
if (!leftHandSideSymbol) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var globalESSymbol = getGlobalESSymbolConstructorSymbol();
|
||||
if (!globalESSymbol) {
|
||||
// Already errored when we tried to look up the symbol
|
||||
|
@ -6308,7 +6365,7 @@ module ts {
|
|||
// unless we're reporting errors
|
||||
var argType = i === 0 && node.kind === SyntaxKind.TaggedTemplateExpression ? globalTemplateStringsArrayType :
|
||||
arg.kind === SyntaxKind.StringLiteral && !reportErrors ? getStringLiteralType(<LiteralExpression>arg) :
|
||||
checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
|
||||
checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
|
||||
// Use argument expression as error location when reporting errors
|
||||
if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined,
|
||||
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) {
|
||||
|
@ -6759,11 +6816,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));
|
||||
}
|
||||
|
||||
|
@ -6938,7 +6990,7 @@ module ts {
|
|||
|
||||
if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
checkCollisionWithCapturedSuperVariable(node, (<FunctionExpression>node).name);
|
||||
checkCollisionWithCapturedThisVariable(node,(<FunctionExpression>node).name);
|
||||
checkCollisionWithCapturedThisVariable(node, (<FunctionExpression>node).name);
|
||||
}
|
||||
|
||||
return type;
|
||||
|
@ -6972,7 +7024,7 @@ module ts {
|
|||
return true;
|
||||
}
|
||||
|
||||
function checkReferenceExpression(n: Node, invalidReferenceMessage: DiagnosticMessage, constantVarianleMessage: DiagnosticMessage): boolean {
|
||||
function checkReferenceExpression(n: Node, invalidReferenceMessage: DiagnosticMessage, constantVariableMessage: DiagnosticMessage): boolean {
|
||||
function findSymbol(n: Node): Symbol {
|
||||
var symbol = getNodeLinks(n).resolvedSymbol;
|
||||
// Because we got the symbol from the resolvedSymbol property, it might be of kind
|
||||
|
@ -7039,7 +7091,7 @@ module ts {
|
|||
return false;
|
||||
}
|
||||
if (isConstVariableReference(n)) {
|
||||
error(n, constantVarianleMessage);
|
||||
error(n, constantVariableMessage);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -7231,7 +7283,7 @@ module ts {
|
|||
var propName = "" + i;
|
||||
var type = sourceType.flags & TypeFlags.Any ? sourceType :
|
||||
isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) :
|
||||
getIndexTypeOfType(sourceType, IndexKind.Number);
|
||||
getIndexTypeOfType(sourceType, IndexKind.Number);
|
||||
if (type) {
|
||||
checkDestructuringAssignment(e, type, contextualMapper);
|
||||
}
|
||||
|
@ -7385,7 +7437,7 @@ module ts {
|
|||
if (!checkForDisallowedESSymbolOperand(operator)) {
|
||||
return booleanType;
|
||||
}
|
||||
// Fall through
|
||||
// Fall through
|
||||
case SyntaxKind.EqualsEqualsToken:
|
||||
case SyntaxKind.ExclamationEqualsToken:
|
||||
case SyntaxKind.EqualsEqualsEqualsToken:
|
||||
|
@ -7409,7 +7461,7 @@ module ts {
|
|||
return rightType;
|
||||
}
|
||||
|
||||
// Return type is true if there was no error, false if there was an error.
|
||||
// Return true if there was no error, false if there was an error.
|
||||
function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean {
|
||||
var offendingSymbolOperand =
|
||||
someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left :
|
||||
|
@ -7713,8 +7765,8 @@ module ts {
|
|||
}
|
||||
// TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled
|
||||
else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.ConstructorType ||
|
||||
node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.Constructor ||
|
||||
node.kind === SyntaxKind.ConstructSignature){
|
||||
node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.Constructor ||
|
||||
node.kind === SyntaxKind.ConstructSignature) {
|
||||
checkGrammarFunctionLikeDeclaration(<FunctionLikeDeclaration>node);
|
||||
}
|
||||
|
||||
|
@ -8324,9 +8376,9 @@ module ts {
|
|||
function checkFunctionDeclaration(node: FunctionDeclaration): void {
|
||||
if (produceDiagnostics) {
|
||||
checkFunctionLikeDeclaration(node) ||
|
||||
checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) ||
|
||||
checkGrammarFunctionName(node.name) ||
|
||||
checkGrammarForGenerator(node);
|
||||
checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) ||
|
||||
checkGrammarFunctionName(node.name) ||
|
||||
checkGrammarForGenerator(node);
|
||||
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
|
@ -8433,7 +8485,7 @@ module ts {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function checkCollisionWithCapturedThisVariable(node: Node, name: Identifier): void {
|
||||
if (needCollisionCheckForIdentifier(node, name, "_this")) {
|
||||
potentialThisCollisions.push(node);
|
||||
|
@ -8443,7 +8495,7 @@ module ts {
|
|||
// this function will run after checking the source file so 'CaptureThis' is correct for all nodes
|
||||
function checkIfThisIsCapturedInEnclosingScope(node: Node): void {
|
||||
var current = node;
|
||||
while (current) {
|
||||
while (current) {
|
||||
if (getNodeCheckFlags(current) & NodeCheckFlags.CaptureThis) {
|
||||
var isDeclaration = node.kind !== SyntaxKind.Identifier;
|
||||
if (isDeclaration) {
|
||||
|
@ -8544,8 +8596,8 @@ module ts {
|
|||
var namesShareScope =
|
||||
container &&
|
||||
(container.kind === SyntaxKind.Block && isAnyFunction(container.parent) ||
|
||||
(container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) ||
|
||||
container.kind === SyntaxKind.SourceFile);
|
||||
(container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) ||
|
||||
container.kind === SyntaxKind.SourceFile);
|
||||
|
||||
// here we know that function scoped variable is shadowed by block scoped one
|
||||
// if they are defined in the same scope - binder has already reported redeclaration error
|
||||
|
@ -8751,9 +8803,50 @@ module ts {
|
|||
checkSourceElement(node.statement);
|
||||
}
|
||||
|
||||
function checkForOfStatement(node: ForOfStatement) {
|
||||
// TODO: not yet implemented
|
||||
checkGrammarForOfStatement(node);
|
||||
function checkForOfStatement(node: ForOfStatement): void {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher);
|
||||
return;
|
||||
}
|
||||
|
||||
checkGrammarForInOrForOfStatement(node)
|
||||
|
||||
// Check the LHS and RHS
|
||||
// If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS
|
||||
// via getTypeForVariableDeclarationInForOfStatement.
|
||||
// If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.
|
||||
// Then check that the RHS is assignable to it.
|
||||
if (node.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
checkForInOrForOfVariableDeclaration(node);
|
||||
}
|
||||
else {
|
||||
var varExpr = <Expression>node.initializer;
|
||||
var rightType = checkExpression(node.expression);
|
||||
var iteratedType = checkIteratedType(rightType, node.expression);
|
||||
|
||||
// There may be a destructuring assignment on the left side
|
||||
if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
// iteratedType may be undefined. In this case, we still want to check the structure of
|
||||
// varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like
|
||||
// to short circuit the type relation checking as much as possible, so we pass the unknownType.
|
||||
checkDestructuringAssignment(varExpr, iteratedType || unknownType);
|
||||
}
|
||||
else {
|
||||
var leftType = checkExpression(varExpr);
|
||||
checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ Diagnostics.Invalid_left_hand_side_in_for_of_statement,
|
||||
/*constantVariableMessage*/ Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant);
|
||||
|
||||
// iteratedType will be undefined if the rightType was missing properties/signatures
|
||||
// required to get its iteratedType (like [Symbol.iterator] or next). This may be
|
||||
// because we accessed properties from anyType, or it may have led to an error inside
|
||||
// getIteratedType.
|
||||
if (iteratedType) {
|
||||
checkTypeAssignableTo(iteratedType, leftType, varExpr, /*headMessage*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
|
||||
function checkForInStatement(node: ForInStatement) {
|
||||
|
@ -8766,11 +8859,12 @@ module ts {
|
|||
// VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,
|
||||
// and Expr must be an expression of type Any, an object type, or a type parameter type.
|
||||
if (node.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
var variableDeclarationList = <VariableDeclarationList>node.initializer;
|
||||
if (variableDeclarationList.declarations.length >= 1) {
|
||||
var decl = variableDeclarationList.declarations[0];
|
||||
checkVariableDeclaration(decl);
|
||||
var variable = (<VariableDeclarationList>node.initializer).declarations[0];
|
||||
if (variable && isBindingPattern(variable.name)) {
|
||||
error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
||||
}
|
||||
|
||||
checkForInOrForOfVariableDeclaration(node);
|
||||
}
|
||||
else {
|
||||
// In a 'for-in' statement of the form
|
||||
|
@ -8778,26 +8872,148 @@ module ts {
|
|||
// Var must be an expression classified as a reference of type Any or the String primitive type,
|
||||
// and Expr must be an expression of type Any, an object type, or a type parameter type.
|
||||
var varExpr = <Expression>node.initializer;
|
||||
var exprType = checkExpression(varExpr);
|
||||
if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) {
|
||||
var leftType = checkExpression(varExpr);
|
||||
if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
||||
}
|
||||
else if (!allConstituentTypesHaveKind(leftType, TypeFlags.Any | TypeFlags.StringLike)) {
|
||||
error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
|
||||
}
|
||||
else {
|
||||
// run check only former check succeeded to avoid cascading errors
|
||||
checkReferenceExpression(varExpr, Diagnostics.Invalid_left_hand_side_in_for_in_statement, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant);
|
||||
checkReferenceExpression(varExpr, Diagnostics.Invalid_left_hand_side_in_for_in_statement, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant);
|
||||
}
|
||||
}
|
||||
|
||||
var exprType = checkExpression(node.expression);
|
||||
var rightType = checkExpression(node.expression);
|
||||
// unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
|
||||
// in this case error about missing name is already reported - do not report extra one
|
||||
if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
|
||||
if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
|
||||
error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
||||
}
|
||||
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
|
||||
function checkForInOrForOfVariableDeclaration(iterationStatement: ForInStatement | ForOfStatement): void {
|
||||
var variableDeclarationList = <VariableDeclarationList>iterationStatement.initializer;
|
||||
// checkGrammarForInOrForOfStatement will check that there is exactly one declaration.
|
||||
if (variableDeclarationList.declarations.length >= 1) {
|
||||
var decl = variableDeclarationList.declarations[0];
|
||||
checkVariableDeclaration(decl);
|
||||
}
|
||||
}
|
||||
|
||||
function getTypeForVariableDeclarationInForOfStatement(forOfStatement: ForOfStatement): Type {
|
||||
// Temporarily return 'any' below ES6
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
return anyType;
|
||||
}
|
||||
|
||||
// iteratedType will be undefined if the for-of expression type was missing properties/signatures
|
||||
// required to get its iteratedType (like [Symbol.iterator] or next). This may be
|
||||
// because we accessed properties from anyType, or it may have led to an error inside
|
||||
// getIteratedType.
|
||||
var expressionType = getTypeOfExpression(forOfStatement.expression);
|
||||
return checkIteratedType(expressionType, forOfStatement.expression) || anyType;
|
||||
}
|
||||
|
||||
/**
|
||||
* When expressionForError is undefined, it means we should not report any errors.
|
||||
*/
|
||||
function checkIteratedType(iterable: Type, expressionForError: Expression): Type {
|
||||
Debug.assert(languageVersion >= ScriptTarget.ES6);
|
||||
var iteratedType = getIteratedType(iterable, expressionForError);
|
||||
// Now even though we have extracted the iteratedType, we will have to validate that the type
|
||||
// passed in is actually an Iterable.
|
||||
if (expressionForError && iteratedType) {
|
||||
var completeIterableType = globalIterableType !== emptyObjectType
|
||||
? createTypeReference(<GenericType>globalIterableType, [iteratedType])
|
||||
: emptyObjectType;
|
||||
checkTypeAssignableTo(iterable, completeIterableType, expressionForError);
|
||||
}
|
||||
|
||||
return iteratedType;
|
||||
|
||||
function getIteratedType(iterable: Type, expressionForError: Expression) {
|
||||
// We want to treat type as an iterable, and get the type it is an iterable of. The iterable
|
||||
// must have the following structure (annotated with the names of the variables below):
|
||||
//
|
||||
// { // iterable
|
||||
// [Symbol.iterator]: { // iteratorFunction
|
||||
// (): { // iterator
|
||||
// next: { // iteratorNextFunction
|
||||
// (): { // iteratorNextResult
|
||||
// value: T // iteratorNextValue
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// T is the type we are after. At every level that involves analyzing return types
|
||||
// of signatures, we union the return types of all the signatures.
|
||||
//
|
||||
// Another thing to note is that at any step of this process, we could run into a dead end,
|
||||
// meaning either the property is missing, or we run into the anyType. If either of these things
|
||||
// happens, we return undefined to signal that we could not find the iterated type. If a property
|
||||
// is missing, and the previous step did not result in 'any', then we also give an error if the
|
||||
// caller requested it. Then the caller can decide what to do in the case where there is no iterated
|
||||
// type. This is different from returning anyType, because that would signify that we have matched the
|
||||
// whole pattern and that T (above) is 'any'.
|
||||
|
||||
if (allConstituentTypesHaveKind(iterable, TypeFlags.Any)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var iteratorFunction = getTypeOfPropertyOfType(iterable, getPropertyNameForKnownSymbolName("iterator"));
|
||||
if (iteratorFunction && allConstituentTypesHaveKind(iteratorFunction, TypeFlags.Any)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, SignatureKind.Call) : emptyArray;
|
||||
if (iteratorFunctionSignatures.length === 0) {
|
||||
if (expressionForError) {
|
||||
error(expressionForError, Diagnostics.The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var iterator = getUnionType(map(iteratorFunctionSignatures, getReturnTypeOfSignature));
|
||||
if (allConstituentTypesHaveKind(iterator, TypeFlags.Any)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var iteratorNextFunction = getTypeOfPropertyOfType(iterator, "next");
|
||||
if (iteratorNextFunction && allConstituentTypesHaveKind(iteratorNextFunction, TypeFlags.Any)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, SignatureKind.Call) : emptyArray;
|
||||
if (iteratorNextFunctionSignatures.length === 0) {
|
||||
if (expressionForError) {
|
||||
error(expressionForError, Diagnostics.The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var iteratorNextResult = getUnionType(map(iteratorNextFunctionSignatures, getReturnTypeOfSignature));
|
||||
if (allConstituentTypesHaveKind(iteratorNextResult, TypeFlags.Any)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value");
|
||||
if (!iteratorNextValue) {
|
||||
if (expressionForError) {
|
||||
error(expressionForError, Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return iteratorNextValue;
|
||||
}
|
||||
}
|
||||
|
||||
function checkBreakOrContinueStatement(node: BreakOrContinueStatement) {
|
||||
// Grammar checking
|
||||
checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);
|
||||
|
@ -8931,18 +9147,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) {
|
||||
|
@ -10054,11 +10281,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;
|
||||
|
@ -10195,7 +10417,7 @@ module ts {
|
|||
}
|
||||
|
||||
function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol {
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) {
|
||||
if (isDeclarationName(entityName)) {
|
||||
return getSymbolOfNode(entityName.parent);
|
||||
}
|
||||
|
||||
|
@ -10260,7 +10482,7 @@ module ts {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (isDeclarationName(node)) {
|
||||
// This is a declaration, call getSymbolOfNode
|
||||
return getSymbolOfNode(node.parent);
|
||||
}
|
||||
|
@ -10356,7 +10578,7 @@ module ts {
|
|||
return getTypeOfSymbol(symbol);
|
||||
}
|
||||
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (isDeclarationName(node)) {
|
||||
var symbol = getSymbolInfo(node);
|
||||
return symbol && getTypeOfSymbol(symbol);
|
||||
}
|
||||
|
@ -10472,25 +10694,8 @@ module ts {
|
|||
}
|
||||
|
||||
function makeUniqueName(baseName: string): string {
|
||||
// First try '_name'
|
||||
if (baseName.charCodeAt(0) !== CharacterCodes._) {
|
||||
var baseName = "_" + baseName;
|
||||
if (!isExistingName(baseName)) {
|
||||
return generatedNames[baseName] = baseName;
|
||||
}
|
||||
}
|
||||
// Find the first unique '_name_n', where n is a positive number
|
||||
if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) {
|
||||
baseName += "_";
|
||||
}
|
||||
var i = 1;
|
||||
while (true) {
|
||||
name = baseName + i;
|
||||
if (!isExistingName(name)) {
|
||||
return generatedNames[name] = name;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
var name = generateUniqueName(baseName, isExistingName);
|
||||
return generatedNames[name] = name;
|
||||
}
|
||||
|
||||
function assignGeneratedName(node: Node, name: string) {
|
||||
|
@ -10691,6 +10896,46 @@ module ts {
|
|||
!hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name);
|
||||
}
|
||||
|
||||
function getBlockScopedVariableId(n: Identifier): number {
|
||||
Debug.assert(!nodeIsSynthesized(n));
|
||||
|
||||
// ignore name parts of property access expressions
|
||||
if (n.parent.kind === SyntaxKind.PropertyAccessExpression &&
|
||||
(<PropertyAccessExpression>n.parent).name === n) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// ignore property names in object binding patterns
|
||||
if (n.parent.kind === SyntaxKind.BindingElement &&
|
||||
(<BindingElement>n.parent).propertyName === n) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// for names in variable declarations and binding elements try to short circuit and fetch symbol from the node
|
||||
var declarationSymbol: Symbol =
|
||||
(n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n) ||
|
||||
n.parent.kind === SyntaxKind.BindingElement
|
||||
? getSymbolOfNode(n.parent)
|
||||
: undefined;
|
||||
|
||||
var symbol = declarationSymbol ||
|
||||
getNodeLinks(n).resolvedSymbol ||
|
||||
resolveName(n, n.text, SymbolFlags.BlockScopedVariable | SymbolFlags.Import, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
|
||||
var isLetOrConst =
|
||||
symbol &&
|
||||
(symbol.flags & SymbolFlags.BlockScopedVariable) &&
|
||||
symbol.valueDeclaration.parent.kind !== SyntaxKind.CatchClause;
|
||||
|
||||
if (isLetOrConst) {
|
||||
// side-effect of calling this method:
|
||||
// assign id to symbol if it was not yet set
|
||||
getSymbolLinks(symbol);
|
||||
return symbol.id;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function createResolver(): EmitResolver {
|
||||
return {
|
||||
getGeneratedNameForNode,
|
||||
|
@ -10707,6 +10952,7 @@ module ts {
|
|||
isEntityNameVisible,
|
||||
getConstantValue,
|
||||
isUnknownIdentifier,
|
||||
getBlockScopedVariableId,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -10730,7 +10976,7 @@ module ts {
|
|||
globals[undefinedSymbol.name] = undefinedSymbol;
|
||||
// Initialize special types
|
||||
globalArraySymbol = getGlobalTypeSymbol("Array");
|
||||
globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1);
|
||||
globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, /*arity*/ 1);
|
||||
globalObjectType = getGlobalType("Object");
|
||||
globalFunctionType = getGlobalType("Function");
|
||||
globalStringType = getGlobalType("String");
|
||||
|
@ -10744,6 +10990,7 @@ module ts {
|
|||
globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray");
|
||||
globalESSymbolType = getGlobalType("Symbol");
|
||||
globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol");
|
||||
globalIterableType = getGlobalType("Iterable", /*arity*/ 1);
|
||||
}
|
||||
else {
|
||||
globalTemplateStringsArrayType = unknownType;
|
||||
|
@ -11250,16 +11497,6 @@ module ts {
|
|||
return false;
|
||||
}
|
||||
|
||||
function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean {
|
||||
// Temporarily disallow for-of statements until type check work is complete.
|
||||
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher);
|
||||
}
|
||||
|
||||
return checkGrammarForInOrForOfStatement(forOfStatement);
|
||||
}
|
||||
|
||||
function checkGrammarAccessor(accessor: MethodDeclaration): boolean {
|
||||
var kind = accessor.kind;
|
||||
if (languageVersion < ScriptTarget.ES5) {
|
||||
|
@ -11434,17 +11671,19 @@ module ts {
|
|||
}
|
||||
|
||||
function checkGrammarVariableDeclaration(node: VariableDeclaration) {
|
||||
if (isInAmbientContext(node)) {
|
||||
if (isBindingPattern(node.name)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts);
|
||||
if (node.parent.parent.kind !== SyntaxKind.ForInStatement && node.parent.parent.kind !== SyntaxKind.ForOfStatement) {
|
||||
if (isInAmbientContext(node)) {
|
||||
if (isBindingPattern(node.name)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts);
|
||||
}
|
||||
if (node.initializer) {
|
||||
// Error on equals token which immediate precedes the initializer
|
||||
var equalsTokenLength = "=".length;
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength,
|
||||
equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
}
|
||||
}
|
||||
if (node.initializer) {
|
||||
// Error on equals token which immediate precedes the initializer
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - 1, 1, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!node.initializer) {
|
||||
else if (!node.initializer) {
|
||||
if (isBindingPattern(node.name) && !isBindingPattern(node.parent)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.A_destructuring_declaration_must_have_an_initializer);
|
||||
}
|
||||
|
@ -11490,15 +11729,6 @@ module ts {
|
|||
if (!declarationList.declarations.length) {
|
||||
return grammarErrorAtPos(getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
}
|
||||
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
if (isLet(declarationList)) {
|
||||
return grammarErrorOnFirstToken(declarationList, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
else if (isConst(declarationList)) {
|
||||
return grammarErrorOnFirstToken(declarationList, Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function allowLetAndConstDeclarations(parent: Node): boolean {
|
||||
|
@ -11621,10 +11851,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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." },
|
||||
|
@ -327,6 +328,13 @@ module ts {
|
|||
for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." },
|
||||
The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." },
|
||||
Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" },
|
||||
The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." },
|
||||
The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." },
|
||||
Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...of' statement." },
|
||||
The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: DiagnosticCategory.Error, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." },
|
||||
The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." },
|
||||
The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: DiagnosticCategory.Error, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." },
|
||||
The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
@ -396,6 +404,7 @@ module ts {
|
|||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
|
||||
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." },
|
||||
Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: DiagnosticCategory.Error, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." },
|
||||
The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." },
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
|
||||
Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" },
|
||||
|
@ -472,6 +481,5 @@ module ts {
|
|||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
|
||||
for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." },
|
||||
};
|
||||
}
|
|
@ -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",
|
||||
|
@ -1300,6 +1304,34 @@
|
|||
"category": "Error",
|
||||
"code": 2484
|
||||
},
|
||||
"The left-hand side of a 'for...of' statement cannot be a previously defined constant.": {
|
||||
"category": "Error",
|
||||
"code": 2485
|
||||
},
|
||||
"The left-hand side of a 'for...in' statement cannot be a previously defined constant.": {
|
||||
"category": "Error",
|
||||
"code": 2486
|
||||
},
|
||||
"Invalid left-hand side in 'for...of' statement.": {
|
||||
"category": "Error",
|
||||
"code": 2487
|
||||
},
|
||||
"The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator.": {
|
||||
"category": "Error",
|
||||
"code": 2488
|
||||
},
|
||||
"The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method.": {
|
||||
"category": "Error",
|
||||
"code": 2489
|
||||
},
|
||||
"The type returned by the 'next()' method of an iterator must have a 'value' property.": {
|
||||
"category": "Error",
|
||||
"code": 2490
|
||||
},
|
||||
"The left-hand side of a 'for...in' statement cannot be a destructuring pattern.": {
|
||||
"category": "Error",
|
||||
"code": 2491
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
@ -1576,7 +1608,11 @@
|
|||
"Exported type alias '{0}' has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4081
|
||||
},
|
||||
},
|
||||
"Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.": {
|
||||
"category": "Error",
|
||||
"code": 4091
|
||||
},
|
||||
"The current host does not support the '{0}' option.": {
|
||||
"category": "Error",
|
||||
"code": 5001
|
||||
|
@ -1881,9 +1917,5 @@
|
|||
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
|
||||
"category": "Error",
|
||||
"code": 9002
|
||||
},
|
||||
"'for...of' statements are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9003
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,10 @@ module ts {
|
|||
typeName?: DeclarationName;
|
||||
}
|
||||
|
||||
interface SynthesizedNode extends Node {
|
||||
leadingCommentRanges?: CommentRange[];
|
||||
trailingCommentRanges?: CommentRange[];
|
||||
// represents one LexicalEnvironment frame to store unique generated names
|
||||
interface ScopeFrame {
|
||||
names: Map<string>;
|
||||
previous: ScopeFrame;
|
||||
}
|
||||
|
||||
type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic;
|
||||
|
@ -369,7 +370,6 @@ module ts {
|
|||
var enclosingDeclaration: Node;
|
||||
var currentSourceFile: SourceFile;
|
||||
var reportedDeclarationError = false;
|
||||
|
||||
var emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments;
|
||||
var emit = compilerOptions.stripInternal ? stripInternal : emitNode;
|
||||
|
||||
|
@ -1574,6 +1574,11 @@ module ts {
|
|||
|
||||
var currentSourceFile: SourceFile;
|
||||
|
||||
var lastFrame: ScopeFrame;
|
||||
var currentScopeNames: Map<string>;
|
||||
|
||||
var generatedBlockScopeNames: string[];
|
||||
|
||||
var extendsEmitted = false;
|
||||
var tempCount = 0;
|
||||
var tempVariables: Identifier[];
|
||||
|
@ -1648,6 +1653,50 @@ module ts {
|
|||
writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM);
|
||||
return;
|
||||
|
||||
// enters the new lexical environment
|
||||
// return value should be passed to matching call to exitNameScope.
|
||||
function enterNameScope(): boolean {
|
||||
var names = currentScopeNames;
|
||||
currentScopeNames = undefined;
|
||||
if (names) {
|
||||
lastFrame = { names, previous: lastFrame };
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function exitNameScope(popFrame: boolean): void {
|
||||
if (popFrame) {
|
||||
currentScopeNames = lastFrame.names;
|
||||
lastFrame = lastFrame.previous;
|
||||
}
|
||||
else {
|
||||
currentScopeNames = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function generateUniqueNameForLocation(location: Node, baseName: string): string {
|
||||
var name: string
|
||||
// first try to check if base name can be used as is
|
||||
if (!isExistingName(location, baseName)) {
|
||||
name = baseName;
|
||||
}
|
||||
else {
|
||||
name = generateUniqueName(baseName, n => isExistingName(location, n));
|
||||
}
|
||||
|
||||
if (!currentScopeNames) {
|
||||
currentScopeNames = {};
|
||||
}
|
||||
|
||||
return currentScopeNames[name] = name;
|
||||
}
|
||||
|
||||
function isExistingName(location: Node, name: string) {
|
||||
return !resolver.isUnknownIdentifier(location, name) ||
|
||||
(currentScopeNames && hasProperty(currentScopeNames, name));
|
||||
}
|
||||
|
||||
function initializeEmitterWithSourceMaps() {
|
||||
var sourceMapDir: string; // The directory in which sourcemap will be
|
||||
|
||||
|
@ -2014,14 +2063,14 @@ module ts {
|
|||
function createTempVariable(location: Node, forLoopVariable?: boolean): Identifier {
|
||||
var name = forLoopVariable ? "_i" : undefined;
|
||||
while (true) {
|
||||
if (name && resolver.isUnknownIdentifier(location, name)) {
|
||||
if (name && !isExistingName(location, name)) {
|
||||
break;
|
||||
}
|
||||
// _a .. _h, _j ... _z, _0, _1, ...
|
||||
name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25);
|
||||
tempCount++;
|
||||
}
|
||||
var result = <Identifier>createNode(SyntaxKind.Identifier);
|
||||
var result = <Identifier>createSynthesizedNode(SyntaxKind.Identifier);
|
||||
result.text = name;
|
||||
return result;
|
||||
}
|
||||
|
@ -2072,7 +2121,7 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function emitParenthesized(node: Node, parenthesized: boolean) {
|
||||
function emitParenthesizedIf(node: Node, parenthesized: boolean) {
|
||||
if (parenthesized) {
|
||||
write("(");
|
||||
}
|
||||
|
@ -2205,6 +2254,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
|
||||
|
@ -2249,7 +2364,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.
|
||||
|
@ -2394,8 +2510,6 @@ module ts {
|
|||
return false;
|
||||
case SyntaxKind.LabeledStatement:
|
||||
return (<LabeledStatement>node.parent).label === node;
|
||||
case SyntaxKind.CatchClause:
|
||||
return (<CatchClause>node.parent).name === node;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2409,7 +2523,20 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function getBlockScopedVariableId(node: Identifier): number {
|
||||
// return undefined for synthesized nodes
|
||||
return !nodeIsSynthesized(node) && resolver.getBlockScopedVariableId(node);
|
||||
}
|
||||
|
||||
function emitIdentifier(node: Identifier) {
|
||||
var variableId = getBlockScopedVariableId(node);
|
||||
if (variableId !== undefined && generatedBlockScopeNames) {
|
||||
var text = generatedBlockScopeNames[variableId];
|
||||
if (text) {
|
||||
write(text);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!node.parent) {
|
||||
write(node.text);
|
||||
}
|
||||
|
@ -2479,7 +2606,7 @@ module ts {
|
|||
emit((<SpreadElementExpression>node).expression);
|
||||
}
|
||||
|
||||
function needsParenthesisForPropertyAccess(node: Expression) {
|
||||
function needsParenthesisForPropertyAccessOrInvocation(node: Expression) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
|
@ -2509,7 +2636,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 {
|
||||
|
@ -2555,14 +2682,6 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function createSynthesizedNode(kind: SyntaxKind): Node {
|
||||
var node = createNode(kind);
|
||||
node.pos = -1;
|
||||
node.end = -1;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void {
|
||||
var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex);
|
||||
return emit(parenthesizedObjectLiteral);
|
||||
|
@ -2596,7 +2715,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);
|
||||
|
||||
|
@ -2619,7 +2738,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) {
|
||||
|
@ -2692,8 +2811,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;
|
||||
|
@ -2748,8 +2867,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;
|
||||
|
@ -2985,9 +3104,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) {
|
||||
|
@ -3088,9 +3212,11 @@ module ts {
|
|||
|
||||
write(tokenToString(node.operatorToken.kind));
|
||||
|
||||
var shouldPlaceOnNewLine = !nodeIsSynthesized(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.
|
||||
if (!nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right)) {
|
||||
if (shouldPlaceOnNewLine || synthesizedNodeStartsOnNewLine(node.right)) {
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
emit(node.right);
|
||||
|
@ -3103,6 +3229,10 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function synthesizedNodeStartsOnNewLine(node: Node) {
|
||||
return nodeIsSynthesized(node) && (<SynthesizedNode>node).startsOnNewLine;
|
||||
}
|
||||
|
||||
function emitConditionalExpression(node: ConditionalExpression) {
|
||||
emit(node.condition);
|
||||
write(" ? ");
|
||||
|
@ -3157,7 +3287,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(";");
|
||||
}
|
||||
|
||||
|
@ -3202,6 +3332,32 @@ module ts {
|
|||
emitEmbeddedStatement(node.statement);
|
||||
}
|
||||
|
||||
function emitStartOfVariableDeclarationList(decl: Node, startPos?: number): void {
|
||||
var tokenKind = SyntaxKind.VarKeyword;
|
||||
if (decl && languageVersion >= ScriptTarget.ES6) {
|
||||
if (isLet(decl)) {
|
||||
tokenKind = SyntaxKind.LetKeyword;
|
||||
}
|
||||
else if (isConst(decl)) {
|
||||
tokenKind = SyntaxKind.ConstKeyword;
|
||||
}
|
||||
}
|
||||
|
||||
if (startPos !== undefined) {
|
||||
emitToken(tokenKind, startPos);
|
||||
}
|
||||
else {
|
||||
switch (tokenKind) {
|
||||
case SyntaxKind.VarKeyword:
|
||||
return write("var ");
|
||||
case SyntaxKind.LetKeyword:
|
||||
return write("let ");
|
||||
case SyntaxKind.ConstKeyword:
|
||||
return write("const ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitForStatement(node: ForStatement) {
|
||||
var endPos = emitToken(SyntaxKind.ForKeyword, node.pos);
|
||||
write(" ");
|
||||
|
@ -3209,17 +3365,9 @@ module ts {
|
|||
if (node.initializer && node.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
var variableDeclarationList = <VariableDeclarationList>node.initializer;
|
||||
var declarations = variableDeclarationList.declarations;
|
||||
if (declarations[0] && isLet(declarations[0])) {
|
||||
emitToken(SyntaxKind.LetKeyword, endPos);
|
||||
}
|
||||
else if (declarations[0] && isConst(declarations[0])) {
|
||||
emitToken(SyntaxKind.ConstKeyword, endPos);
|
||||
}
|
||||
else {
|
||||
emitToken(SyntaxKind.VarKeyword, endPos);
|
||||
}
|
||||
emitStartOfVariableDeclarationList(declarations[0], endPos);
|
||||
write(" ");
|
||||
emitCommaList(variableDeclarationList.declarations);
|
||||
emitCommaList(declarations);
|
||||
}
|
||||
else if (node.initializer) {
|
||||
emit(node.initializer);
|
||||
|
@ -3240,12 +3388,7 @@ module ts {
|
|||
var variableDeclarationList = <VariableDeclarationList>node.initializer;
|
||||
if (variableDeclarationList.declarations.length >= 1) {
|
||||
var decl = variableDeclarationList.declarations[0];
|
||||
if (isLet(decl)) {
|
||||
emitToken(SyntaxKind.LetKeyword, endPos);
|
||||
}
|
||||
else {
|
||||
emitToken(SyntaxKind.VarKeyword, endPos);
|
||||
}
|
||||
emitStartOfVariableDeclarationList(decl, endPos);
|
||||
write(" ");
|
||||
emit(decl);
|
||||
}
|
||||
|
@ -3356,8 +3499,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);
|
||||
}
|
||||
|
@ -3394,6 +3537,14 @@ module ts {
|
|||
emitNode(node.name);
|
||||
emitEnd(node.name);
|
||||
}
|
||||
|
||||
function createVoidZero(): Expression {
|
||||
var zero = <LiteralExpression>createSynthesizedNode(SyntaxKind.NumericLiteral);
|
||||
zero.text = "0";
|
||||
var result = <VoidExpression>createSynthesizedNode(SyntaxKind.VoidExpression);
|
||||
result.expression = zero;
|
||||
return result;
|
||||
}
|
||||
|
||||
function emitExportMemberAssignments(name: Identifier) {
|
||||
if (exportSpecifiers && hasProperty(exportSpecifiers, name.text)) {
|
||||
|
@ -3427,6 +3578,8 @@ module ts {
|
|||
if (emitCount++) {
|
||||
write(", ");
|
||||
}
|
||||
|
||||
renameNonTopLevelLetAndConst(name);
|
||||
if (name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement)) {
|
||||
emitModuleMemberName(<Declaration>name.parent);
|
||||
}
|
||||
|
@ -3449,24 +3602,16 @@ module ts {
|
|||
return expr;
|
||||
}
|
||||
|
||||
function createVoidZero(): Expression {
|
||||
var zero = <LiteralExpression>createNode(SyntaxKind.NumericLiteral);
|
||||
zero.text = "0";
|
||||
var result = <VoidExpression>createNode(SyntaxKind.VoidExpression);
|
||||
result.expression = zero;
|
||||
return result;
|
||||
}
|
||||
|
||||
function createDefaultValueCheck(value: Expression, defaultValue: Expression): Expression {
|
||||
// The value expression will be evaluated twice, so for anything but a simple identifier
|
||||
// we need to generate a temporary variable
|
||||
value = ensureIdentifier(value);
|
||||
// Return the expression 'value === void 0 ? defaultValue : value'
|
||||
var equals = <BinaryExpression>createNode(SyntaxKind.BinaryExpression);
|
||||
var equals = <BinaryExpression>createSynthesizedNode(SyntaxKind.BinaryExpression);
|
||||
equals.left = value;
|
||||
equals.operatorToken = createNode(SyntaxKind.EqualsEqualsEqualsToken);
|
||||
equals.operatorToken = createSynthesizedNode(SyntaxKind.EqualsEqualsEqualsToken);
|
||||
equals.right = createVoidZero();
|
||||
var cond = <ConditionalExpression>createNode(SyntaxKind.ConditionalExpression);
|
||||
var cond = <ConditionalExpression>createSynthesizedNode(SyntaxKind.ConditionalExpression);
|
||||
cond.condition = equals;
|
||||
cond.whenTrue = defaultValue;
|
||||
cond.whenFalse = value;
|
||||
|
@ -3474,7 +3619,7 @@ module ts {
|
|||
}
|
||||
|
||||
function createNumericLiteral(value: number) {
|
||||
var node = <LiteralExpression>createNode(SyntaxKind.NumericLiteral);
|
||||
var node = <LiteralExpression>createSynthesizedNode(SyntaxKind.NumericLiteral);
|
||||
node.text = "" + value;
|
||||
return node;
|
||||
}
|
||||
|
@ -3483,7 +3628,7 @@ module ts {
|
|||
if (expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.PropertyAccessExpression || expr.kind === SyntaxKind.ElementAccessExpression) {
|
||||
return <LeftHandSideExpression>expr;
|
||||
}
|
||||
var node = <ParenthesizedExpression>createNode(SyntaxKind.ParenthesizedExpression);
|
||||
var node = <ParenthesizedExpression>createSynthesizedNode(SyntaxKind.ParenthesizedExpression);
|
||||
node.expression = expr;
|
||||
return node;
|
||||
}
|
||||
|
@ -3492,14 +3637,14 @@ module ts {
|
|||
if (propName.kind !== SyntaxKind.Identifier) {
|
||||
return createElementAccess(object, propName);
|
||||
}
|
||||
var node = <PropertyAccessExpression>createNode(SyntaxKind.PropertyAccessExpression);
|
||||
var node = <PropertyAccessExpression>createSynthesizedNode(SyntaxKind.PropertyAccessExpression);
|
||||
node.expression = parenthesizeForAccess(object);
|
||||
node.name = propName;
|
||||
return node;
|
||||
}
|
||||
|
||||
function createElementAccess(object: Expression, index: Expression): Expression {
|
||||
var node = <ElementAccessExpression>createNode(SyntaxKind.ElementAccessExpression);
|
||||
var node = <ElementAccessExpression>createSynthesizedNode(SyntaxKind.ElementAccessExpression);
|
||||
node.expression = parenthesizeForAccess(object);
|
||||
node.argumentExpression = index;
|
||||
return node;
|
||||
|
@ -3638,8 +3783,31 @@ module ts {
|
|||
}
|
||||
}
|
||||
else {
|
||||
var isLet = renameNonTopLevelLetAndConst(<Identifier>node.name);
|
||||
emitModuleMemberName(node);
|
||||
emitOptional(" = ", node.initializer);
|
||||
|
||||
var initializer = node.initializer;
|
||||
if (!initializer && languageVersion < ScriptTarget.ES6) {
|
||||
|
||||
// downlevel emit for non-initialized let bindings defined in loops
|
||||
// for (...) { let x; }
|
||||
// should be
|
||||
// for (...) { var <some-uniqie-name> = void 0; }
|
||||
// this is necessary to preserve ES6 semantic in scenarios like
|
||||
// for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations
|
||||
var isUninitializedLet =
|
||||
(resolver.getNodeCheckFlags(node) & NodeCheckFlags.BlockScopedBindingInLoop) &&
|
||||
(getCombinedFlagsForIdentifier(<Identifier>node.name) & NodeFlags.Let);
|
||||
|
||||
// NOTE: default initialization should not be added to let bindings in for-in\for-of statements
|
||||
if (isUninitializedLet &&
|
||||
node.parent.parent.kind !== SyntaxKind.ForInStatement &&
|
||||
node.parent.parent.kind !== SyntaxKind.ForOfStatement) {
|
||||
initializer = createVoidZero();
|
||||
}
|
||||
}
|
||||
|
||||
emitOptional(" = ", initializer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3652,18 +3820,86 @@ module ts {
|
|||
forEach((<BindingPattern>name).elements, emitExportVariableAssignments);
|
||||
}
|
||||
}
|
||||
|
||||
function getEnclosingBlockScopeContainer(node: Node): Node {
|
||||
var current = node;
|
||||
while (current) {
|
||||
if (isAnyFunction(current)) {
|
||||
return current;
|
||||
}
|
||||
switch (current.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
case SyntaxKind.SwitchKeyword:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return current;
|
||||
case SyntaxKind.Block:
|
||||
// function block is not considered block-scope container
|
||||
// see comment in binder.ts: bind(...), case for SyntaxKind.Block
|
||||
if (!isAnyFunction(current.parent)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
current = current.parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getCombinedFlagsForIdentifier(node: Identifier): NodeFlags {
|
||||
if (!node.parent || (node.parent.kind !== SyntaxKind.VariableDeclaration && node.parent.kind !== SyntaxKind.BindingElement)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return getCombinedNodeFlags(node.parent);
|
||||
}
|
||||
|
||||
function renameNonTopLevelLetAndConst(node: Node): void {
|
||||
// do not rename if
|
||||
// - language version is ES6+
|
||||
// - node is synthesized
|
||||
// - node is not identifier (can happen when tree is malformed)
|
||||
// - node is definitely not name of variable declaration.
|
||||
// it still can be part of parameter declaration, this check will be done next
|
||||
if (languageVersion >= ScriptTarget.ES6 ||
|
||||
nodeIsSynthesized(node) ||
|
||||
node.kind !== SyntaxKind.Identifier ||
|
||||
(node.parent.kind !== SyntaxKind.VariableDeclaration && node.parent.kind !== SyntaxKind.BindingElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var combinedFlags = getCombinedFlagsForIdentifier(<Identifier>node);
|
||||
if (((combinedFlags & NodeFlags.BlockScoped) === 0) || combinedFlags & NodeFlags.Export) {
|
||||
// do not rename exported or non-block scoped variables
|
||||
return;
|
||||
}
|
||||
|
||||
// here it is known that node is a block scoped variable
|
||||
var list = getAncestor(node, SyntaxKind.VariableDeclarationList);
|
||||
if (list.parent.kind === SyntaxKind.VariableStatement && list.parent.parent.kind === SyntaxKind.SourceFile) {
|
||||
// do not rename variables that are defined on source file level
|
||||
return;
|
||||
}
|
||||
|
||||
var blockScopeContainer = getEnclosingBlockScopeContainer(node);
|
||||
var parent = blockScopeContainer.kind === SyntaxKind.SourceFile
|
||||
? blockScopeContainer
|
||||
: blockScopeContainer.parent;
|
||||
|
||||
var generatedName = generateUniqueNameForLocation(parent, (<Identifier>node).text);
|
||||
var variableId = resolver.getBlockScopedVariableId(<Identifier>node);
|
||||
if (!generatedBlockScopeNames) {
|
||||
generatedBlockScopeNames = [];
|
||||
}
|
||||
generatedBlockScopeNames[variableId] = generatedName;
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
if (isLet(node.declarationList)) {
|
||||
write("let ");
|
||||
}
|
||||
else if (isConst(node.declarationList)) {
|
||||
write("const ");
|
||||
}
|
||||
else {
|
||||
write("var ");
|
||||
}
|
||||
emitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
emitCommaList(node.declarationList.declarations);
|
||||
write(";");
|
||||
|
@ -3840,6 +4076,8 @@ module ts {
|
|||
tempVariables = undefined;
|
||||
tempParameters = undefined;
|
||||
|
||||
var popFrame = enterNameScope()
|
||||
|
||||
// When targeting ES6, emit arrow function natively in ES6
|
||||
if (shouldEmitAsArrowFunction(node)) {
|
||||
emitSignatureParametersForArrow(node);
|
||||
|
@ -3871,6 +4109,8 @@ module ts {
|
|||
write(";");
|
||||
}
|
||||
|
||||
exitNameScope(popFrame);
|
||||
|
||||
tempCount = saveTempCount;
|
||||
tempVariables = saveTempVariables;
|
||||
tempParameters = saveTempParameters;
|
||||
|
@ -4192,6 +4432,9 @@ module ts {
|
|||
tempCount = 0;
|
||||
tempVariables = undefined;
|
||||
tempParameters = undefined;
|
||||
|
||||
var popFrame = enterNameScope();
|
||||
|
||||
// Emit the constructor overload pinned comments
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Constructor && !(<ConstructorDeclaration>member).body) {
|
||||
|
@ -4252,6 +4495,9 @@ module ts {
|
|||
if (ctor) {
|
||||
emitTrailingComments(ctor);
|
||||
}
|
||||
|
||||
exitNameScope(popFrame);
|
||||
|
||||
tempCount = saveTempCount;
|
||||
tempVariables = saveTempVariables;
|
||||
tempParameters = saveTempParameters;
|
||||
|
@ -4384,7 +4630,11 @@ module ts {
|
|||
var saveTempVariables = tempVariables;
|
||||
tempCount = 0;
|
||||
tempVariables = undefined;
|
||||
var popFrame = enterNameScope();
|
||||
|
||||
emit(node.body);
|
||||
|
||||
exitNameScope(popFrame);
|
||||
tempCount = saveTempCount;
|
||||
tempVariables = saveTempVariables;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -1204,6 +1204,7 @@ module ts {
|
|||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isUnknownIdentifier(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
|
||||
export const enum SymbolFlags {
|
||||
|
@ -1329,6 +1330,7 @@ module ts {
|
|||
|
||||
// Values for enum members have been computed, and any errors have been reported for them.
|
||||
EnumValuesComputed = 0x00000080,
|
||||
BlockScopedBindingInLoop = 0x00000100,
|
||||
}
|
||||
|
||||
export interface NodeLinks {
|
||||
|
|
|
@ -7,6 +7,12 @@ module ts {
|
|||
isNoDefaultLib?: boolean
|
||||
}
|
||||
|
||||
export interface SynthesizedNode extends Node {
|
||||
leadingCommentRanges?: CommentRange[];
|
||||
trailingCommentRanges?: CommentRange[];
|
||||
startsOnNewLine: boolean;
|
||||
}
|
||||
|
||||
export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration {
|
||||
var declarations = symbol.declarations;
|
||||
for (var i = 0; i < declarations.length; i++) {
|
||||
|
@ -192,6 +198,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.
|
||||
|
@ -665,7 +683,7 @@ module ts {
|
|||
}
|
||||
|
||||
export function isBindingPattern(node: Node) {
|
||||
return node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern;
|
||||
return !!node && (node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern);
|
||||
}
|
||||
|
||||
export function isInAmbientContext(node: Node): boolean {
|
||||
|
@ -681,31 +699,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,7 +759,7 @@ 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;
|
||||
}
|
||||
|
@ -751,14 +771,10 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) {
|
||||
if (isDeclaration(parent)) {
|
||||
return (<Declaration>parent).name === name;
|
||||
}
|
||||
|
||||
if (parent.kind === SyntaxKind.CatchClause) {
|
||||
return (<CatchClause>parent).name === name;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1139,44 @@ module ts {
|
|||
return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength: */newEndN - oldStartN);
|
||||
}
|
||||
|
||||
// @internal
|
||||
export function nodeStartsNewLexicalEnvironment(n: Node): boolean {
|
||||
return isAnyFunction(n) || n.kind === SyntaxKind.ModuleDeclaration || n.kind === SyntaxKind.SourceFile;
|
||||
}
|
||||
|
||||
export function nodeIsSynthesized(node: Node): boolean {
|
||||
return node.pos === -1 && node.end === -1;
|
||||
}
|
||||
|
||||
export function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node {
|
||||
var node = <SynthesizedNode>createNode(kind);
|
||||
node.pos = -1;
|
||||
node.end = -1;
|
||||
node.startsOnNewLine = startsOnNewLine;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function generateUniqueName(baseName: string, isExistingName: (name: string) => boolean): string {
|
||||
// First try '_name'
|
||||
if (baseName.charCodeAt(0) !== CharacterCodes._) {
|
||||
var baseName = "_" + baseName;
|
||||
if (!isExistingName(baseName)) {
|
||||
return baseName;
|
||||
}
|
||||
}
|
||||
// Find the first unique '_name_n', where n is a positive number
|
||||
if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) {
|
||||
baseName += "_";
|
||||
}
|
||||
var i = 1;
|
||||
while (true) {
|
||||
var name = baseName + i;
|
||||
if (!isExistingName(name)) {
|
||||
return name;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
export function createDiagnosticCollection(): DiagnosticCollection {
|
||||
var nonFileDiagnostics: Diagnostic[] = [];
|
||||
var fileDiagnostics: Map<Diagnostic[]> = {};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// <reference path='..\services\services.ts' />
|
||||
/// <reference path='..\services\services.ts' />
|
||||
/// <reference path='..\services\shims.ts' />
|
||||
/// <reference path='..\server\client.ts' />
|
||||
/// <reference path='harness.ts' />
|
||||
|
|
|
@ -58,9 +58,10 @@ module ts {
|
|||
}
|
||||
|
||||
export interface SourceFile {
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
/* @internal */ version: string;
|
||||
/* @internal */ scriptSnapshot: IScriptSnapshot;
|
||||
/* @internal */ nameTable: Map<string>;
|
||||
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
|
@ -1270,31 +1271,21 @@ module ts {
|
|||
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(
|
||||
sourceFile: SourceFile,
|
||||
fileName: string,
|
||||
compilationSettings: CompilerOptions,
|
||||
scriptSnapshot: IScriptSnapshot,
|
||||
version: string,
|
||||
textChangeRange: TextChangeRange): SourceFile;
|
||||
version: string): SourceFile;
|
||||
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
|
@ -1442,7 +1433,11 @@ module ts {
|
|||
|
||||
interface DocumentRegistryEntry {
|
||||
sourceFile: SourceFile;
|
||||
refCount: number;
|
||||
|
||||
// The number of language services that this source file is referenced in. When no more
|
||||
// language services are referencing the file, then the file can be removed from the
|
||||
// registry.
|
||||
languageServiceRefCount: number;
|
||||
owners: string[];
|
||||
}
|
||||
|
||||
|
@ -1671,6 +1666,8 @@ module ts {
|
|||
}
|
||||
|
||||
export function createDocumentRegistry(): DocumentRegistry {
|
||||
// Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have
|
||||
// for those settings.
|
||||
var buckets: Map<Map<DocumentRegistryEntry>> = {};
|
||||
|
||||
function getKeyFromCompilationSettings(settings: CompilerOptions): string {
|
||||
|
@ -1694,7 +1691,7 @@ module ts {
|
|||
var entry = entries[i];
|
||||
sourceFiles.push({
|
||||
name: i,
|
||||
refCount: entry.refCount,
|
||||
refCount: entry.languageServiceRefCount,
|
||||
references: entry.owners.slice(0)
|
||||
});
|
||||
}
|
||||
|
@ -1707,43 +1704,54 @@ module ts {
|
|||
return JSON.stringify(bucketInfoArray, null, 2);
|
||||
}
|
||||
|
||||
function acquireDocument(
|
||||
fileName: string,
|
||||
compilationSettings: CompilerOptions,
|
||||
scriptSnapshot: IScriptSnapshot,
|
||||
version: string): SourceFile {
|
||||
|
||||
var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true);
|
||||
var entry = lookUp(bucket, fileName);
|
||||
if (!entry) {
|
||||
var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false);
|
||||
|
||||
bucket[fileName] = entry = {
|
||||
sourceFile: sourceFile,
|
||||
refCount: 0,
|
||||
owners: []
|
||||
};
|
||||
}
|
||||
entry.refCount++;
|
||||
|
||||
return entry.sourceFile;
|
||||
function acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile {
|
||||
return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ true);
|
||||
}
|
||||
|
||||
function updateDocument(
|
||||
sourceFile: SourceFile,
|
||||
function updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile {
|
||||
return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ false);
|
||||
}
|
||||
|
||||
function acquireOrUpdateDocument(
|
||||
fileName: string,
|
||||
compilationSettings: CompilerOptions,
|
||||
scriptSnapshot: IScriptSnapshot,
|
||||
version: string,
|
||||
textChangeRange: TextChangeRange
|
||||
): SourceFile {
|
||||
acquiring: boolean): SourceFile {
|
||||
|
||||
var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ false);
|
||||
Debug.assert(bucket !== undefined);
|
||||
var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true);
|
||||
var entry = lookUp(bucket, fileName);
|
||||
Debug.assert(entry !== undefined);
|
||||
if (!entry) {
|
||||
Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
|
||||
|
||||
// Have never seen this file with these settings. Create a new source file for it.
|
||||
var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false);
|
||||
|
||||
bucket[fileName] = entry = {
|
||||
sourceFile: sourceFile,
|
||||
languageServiceRefCount: 0,
|
||||
owners: []
|
||||
};
|
||||
}
|
||||
else {
|
||||
// We have an entry for this file. However, it may be for a different version of
|
||||
// the script snapshot. If so, update it appropriately. Otherwise, we can just
|
||||
// return it as is.
|
||||
if (entry.sourceFile.version !== version) {
|
||||
entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version,
|
||||
scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));
|
||||
}
|
||||
}
|
||||
|
||||
// If we're acquiring, then this is the first time this LS is asking for this document.
|
||||
// Increase our ref count so we know there's another LS using the document. If we're
|
||||
// not acquiring, then that means the LS is 'updating' the file instead, and that means
|
||||
// it has already acquired the document previously. As such, we do not need to increase
|
||||
// the ref count.
|
||||
if (acquiring) {
|
||||
entry.languageServiceRefCount++;
|
||||
}
|
||||
|
||||
entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, textChangeRange);
|
||||
return entry.sourceFile;
|
||||
}
|
||||
|
||||
|
@ -1752,10 +1760,10 @@ module ts {
|
|||
Debug.assert(bucket !== undefined);
|
||||
|
||||
var entry = lookUp(bucket, fileName);
|
||||
entry.refCount--;
|
||||
entry.languageServiceRefCount--;
|
||||
|
||||
Debug.assert(entry.refCount >= 0);
|
||||
if (entry.refCount === 0) {
|
||||
Debug.assert(entry.languageServiceRefCount >= 0);
|
||||
if (entry.languageServiceRefCount === 0) {
|
||||
delete bucket[fileName];
|
||||
}
|
||||
}
|
||||
|
@ -1788,33 +1796,140 @@ module ts {
|
|||
});
|
||||
}
|
||||
|
||||
function recordModuleName() {
|
||||
var importPath = scanner.getTokenValue();
|
||||
var pos = scanner.getTokenPos();
|
||||
importedFiles.push({
|
||||
fileName: importPath,
|
||||
pos: pos,
|
||||
end: pos + importPath.length
|
||||
});
|
||||
}
|
||||
|
||||
function processImport(): void {
|
||||
scanner.setText(sourceText);
|
||||
var token = scanner.scan();
|
||||
// Look for:
|
||||
// import foo = module("foo");
|
||||
// import "mod";
|
||||
// import d from "mod"
|
||||
// import {a as A } from "mod";
|
||||
// import * as NS from "mod"
|
||||
// import d, {a, b as B} from "mod"
|
||||
// import i = require("mod");
|
||||
//
|
||||
// export * from "mod"
|
||||
// export {a as b} from "mod"
|
||||
|
||||
while (token !== SyntaxKind.EndOfFileToken) {
|
||||
if (token === SyntaxKind.ImportKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.Identifier) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.EqualsToken) {
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// import "mod";
|
||||
recordModuleName();
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (token === SyntaxKind.Identifier) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.RequireKeyword) {
|
||||
if (token === SyntaxKind.FromKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.OpenParenToken) {
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// import d from "mod";
|
||||
recordModuleName();
|
||||
continue
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.EqualsToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.RequireKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
var importPath = scanner.getTokenValue();
|
||||
var pos = scanner.getTokenPos();
|
||||
importedFiles.push({
|
||||
fileName: importPath,
|
||||
pos: pos,
|
||||
end: pos + importPath.length
|
||||
});
|
||||
if (token === SyntaxKind.OpenParenToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// import i = require("mod");
|
||||
recordModuleName();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.CommaToken) {
|
||||
// consume comma and keep going
|
||||
token = scanner.scan();
|
||||
}
|
||||
else {
|
||||
// unknown syntax
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (token === SyntaxKind.OpenBraceToken) {
|
||||
token = scanner.scan();
|
||||
// consume "{ a as B, c, d as D}" clauses
|
||||
while (token !== SyntaxKind.CloseBraceToken) {
|
||||
token = scanner.scan();
|
||||
}
|
||||
|
||||
if (token === SyntaxKind.CloseBraceToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.FromKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// import {a as A} from "mod";
|
||||
// import d, {a, b as B} from "mod"
|
||||
recordModuleName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.AsteriskToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.AsKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.Identifier) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.FromKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// import * as NS from "mod"
|
||||
// import d, * as NS from "mod"
|
||||
recordModuleName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.ExportKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.OpenBraceToken) {
|
||||
token = scanner.scan();
|
||||
// consume "{ a as B, c, d as D}" clauses
|
||||
while (token !== SyntaxKind.CloseBraceToken) {
|
||||
token = scanner.scan();
|
||||
}
|
||||
|
||||
if (token === SyntaxKind.CloseBraceToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.FromKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// export {a as A} from "mod";
|
||||
// export {a, b as B} from "mod"
|
||||
recordModuleName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.AsteriskToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.FromKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// export * from "mod"
|
||||
recordModuleName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2162,19 +2277,34 @@ module ts {
|
|||
// it is safe to reuse the souceFiles; if not, then the shape of the AST can change, and the oldSourceFile
|
||||
// can not be reused. we have to dump all syntax trees and create new ones.
|
||||
if (!changesInCompilationSettingsAffectSyntax) {
|
||||
|
||||
// Check if the old program had this file already
|
||||
var oldSourceFile = program && program.getSourceFile(fileName);
|
||||
if (oldSourceFile) {
|
||||
// This SourceFile is safe to reuse, return it
|
||||
if (sourceFileUpToDate(oldSourceFile)) {
|
||||
return oldSourceFile;
|
||||
}
|
||||
|
||||
// We have an older version of the sourceFile, incrementally parse the changes
|
||||
var textChangeRange = hostFileInformation.scriptSnapshot.getChangeRange(oldSourceFile.scriptSnapshot);
|
||||
return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange);
|
||||
// We already had a source file for this file name. Go to the registry to
|
||||
// ensure that we get the right up to date version of it. We need this to
|
||||
// address the following 'race'. Specifically, say we have the following:
|
||||
//
|
||||
// LS1
|
||||
// \
|
||||
// DocumentRegistry
|
||||
// /
|
||||
// LS2
|
||||
//
|
||||
// Each LS has a reference to file 'foo.ts' at version 1. LS2 then updates
|
||||
// it's version of 'foo.ts' to version 2. This will cause LS2 and the
|
||||
// DocumentRegistry to have version 2 of the document. HOwever, LS1 will
|
||||
// have version 1. And *importantly* this source file will be *corrupt*.
|
||||
// The act of creating version 2 of the file irrevocably damages the version
|
||||
// 1 file.
|
||||
//
|
||||
// So, later when we call into LS1, we need to make sure that it doesn't use
|
||||
// it's source file any more, and instead defers to DocumentRegistry to get
|
||||
// either version 1, version 2 (or some other version) depending on what the
|
||||
// host says should be used.
|
||||
return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version);
|
||||
}
|
||||
|
||||
// We didn't already have the file. Fall through and acquire it from the registry.
|
||||
}
|
||||
|
||||
// Could not find this file in the old program, create a new SourceFile for it.
|
||||
|
@ -2228,8 +2358,8 @@ module ts {
|
|||
|
||||
function dispose(): void {
|
||||
if (program) {
|
||||
forEach(program.getSourceFiles(),
|
||||
(f) => { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); });
|
||||
forEach(program.getSourceFiles(), f =>
|
||||
documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4009,27 +4139,6 @@ module ts {
|
|||
return getReferencesForNode(node, program.getSourceFiles(), /*searchOnlyInCurrentFile*/ false, findInStrings, findInComments);
|
||||
}
|
||||
|
||||
function initializeNameTable(sourceFile: SourceFile): void {
|
||||
var nameTable: Map<string> = {};
|
||||
|
||||
walk(sourceFile);
|
||||
sourceFile.nameTable = nameTable;
|
||||
|
||||
function walk(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
nameTable[(<Identifier>node).text] = (<Identifier>node).text;
|
||||
break;
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
nameTable[(<LiteralExpression>node).text] = (<LiteralExpression>node).text;
|
||||
break;
|
||||
default:
|
||||
forEachChild(node, walk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getReferencesForNode(node: Node, sourceFiles: SourceFile[], searchOnlyInCurrentFile: boolean, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] {
|
||||
// Labels
|
||||
if (isLabelName(node)) {
|
||||
|
@ -4096,13 +4205,9 @@ module ts {
|
|||
forEach(sourceFiles, sourceFile => {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
|
||||
if (!sourceFile.nameTable) {
|
||||
initializeNameTable(sourceFile)
|
||||
}
|
||||
var nameTable = getNameTable(sourceFile);
|
||||
|
||||
Debug.assert(sourceFile.nameTable !== undefined);
|
||||
|
||||
if (lookUp(sourceFile.nameTable, internedName)) {
|
||||
if (lookUp(nameTable, internedName)) {
|
||||
result = result || [];
|
||||
getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result);
|
||||
}
|
||||
|
@ -4756,7 +4861,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;
|
||||
}
|
||||
|
||||
|
@ -4918,7 +5023,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)) {
|
||||
|
@ -5646,6 +5751,52 @@ module ts {
|
|||
};
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function getNameTable(sourceFile: SourceFile): Map<string> {
|
||||
if (!sourceFile.nameTable) {
|
||||
initializeNameTable(sourceFile)
|
||||
}
|
||||
|
||||
return sourceFile.nameTable;
|
||||
}
|
||||
|
||||
function initializeNameTable(sourceFile: SourceFile): void {
|
||||
var nameTable: Map<string> = {};
|
||||
|
||||
walk(sourceFile);
|
||||
sourceFile.nameTable = nameTable;
|
||||
|
||||
function walk(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
nameTable[(<Identifier>node).text] = (<Identifier>node).text;
|
||||
break;
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
// We want to store any numbers/strings if they were a name that could be
|
||||
// related to a declaration. So, if we have 'import x = require("something")'
|
||||
// then we want 'something' to be in the name table. Similarly, if we have
|
||||
// "a['propname']" then we want to store "propname" in the name table.
|
||||
if (isDeclarationName(node) ||
|
||||
node.parent.kind === SyntaxKind.ExternalModuleReference ||
|
||||
isArgumentOfElementAccessExpression(node)) {
|
||||
|
||||
nameTable[(<LiteralExpression>node).text] = (<LiteralExpression>node).text;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
forEachChild(node, walk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isArgumentOfElementAccessExpression(node: Node) {
|
||||
return node &&
|
||||
node.parent &&
|
||||
node.parent.kind === SyntaxKind.ElementAccessExpression &&
|
||||
(<ElementAccessExpression>node.parent).argumentExpression === node;
|
||||
}
|
||||
|
||||
/// Classifier
|
||||
export function createClassifier(): Classifier {
|
||||
var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
||||
|
|
|
@ -295,8 +295,8 @@ module ts.SignatureHelp {
|
|||
var tagExpression = <TaggedTemplateExpression>templateExpression.parent;
|
||||
Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression);
|
||||
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(<LiteralExpression>node, position)) {
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(<LiteralExpression>node, position)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
@ -941,6 +940,7 @@ declare module "typescript" {
|
|||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isUnknownIdentifier(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
FunctionScopedVariable = 1,
|
||||
|
@ -1045,6 +1045,7 @@ declare module "typescript" {
|
|||
SuperStatic = 32,
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
|
@ -1517,9 +1518,6 @@ declare module "typescript" {
|
|||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
}
|
||||
interface SourceFile {
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
|
@ -1873,25 +1871,17 @@ declare module "typescript" {
|
|||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
@ -3063,6 +3059,11 @@ declare module "typescript" {
|
|||
>location : Node
|
||||
>Node : Node
|
||||
>name : string
|
||||
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
>getBlockScopedVariableId : (node: Identifier) => number
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
>SymbolFlags : SymbolFlags
|
||||
|
@ -3374,6 +3375,9 @@ declare module "typescript" {
|
|||
|
||||
EnumValuesComputed = 128,
|
||||
>EnumValuesComputed : NodeCheckFlags
|
||||
|
||||
BlockScopedBindingInLoop = 256,
|
||||
>BlockScopedBindingInLoop : NodeCheckFlags
|
||||
}
|
||||
interface NodeLinks {
|
||||
>NodeLinks : NodeLinks
|
||||
|
@ -4892,17 +4896,6 @@ declare module "typescript" {
|
|||
interface SourceFile {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
version: string;
|
||||
>version : string
|
||||
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
|
||||
nameTable: Map<string>;
|
||||
>nameTable : Map<string>
|
||||
>Map : Map<T>
|
||||
|
||||
getNamedDeclarations(): Declaration[];
|
||||
>getNamedDeclarations : () => Declaration[]
|
||||
>Declaration : Declaration
|
||||
|
@ -5853,36 +5846,24 @@ declare module "typescript" {
|
|||
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile
|
||||
>fileName : string
|
||||
>compilationSettings : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
>version : string
|
||||
>textChangeRange : TextChangeRange
|
||||
>TextChangeRange : TextChangeRange
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
||||
|
@ -972,6 +971,7 @@ declare module "typescript" {
|
|||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isUnknownIdentifier(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
FunctionScopedVariable = 1,
|
||||
|
@ -1076,6 +1076,7 @@ declare module "typescript" {
|
|||
SuperStatic = 32,
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
|
@ -1548,9 +1549,6 @@ declare module "typescript" {
|
|||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
}
|
||||
interface SourceFile {
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
|
@ -1904,25 +1902,17 @@ declare module "typescript" {
|
|||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
@ -3209,6 +3205,11 @@ declare module "typescript" {
|
|||
>location : Node
|
||||
>Node : Node
|
||||
>name : string
|
||||
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
>getBlockScopedVariableId : (node: Identifier) => number
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
>SymbolFlags : SymbolFlags
|
||||
|
@ -3520,6 +3521,9 @@ declare module "typescript" {
|
|||
|
||||
EnumValuesComputed = 128,
|
||||
>EnumValuesComputed : NodeCheckFlags
|
||||
|
||||
BlockScopedBindingInLoop = 256,
|
||||
>BlockScopedBindingInLoop : NodeCheckFlags
|
||||
}
|
||||
interface NodeLinks {
|
||||
>NodeLinks : NodeLinks
|
||||
|
@ -5038,17 +5042,6 @@ declare module "typescript" {
|
|||
interface SourceFile {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
version: string;
|
||||
>version : string
|
||||
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
|
||||
nameTable: Map<string>;
|
||||
>nameTable : Map<string>
|
||||
>Map : Map<T>
|
||||
|
||||
getNamedDeclarations(): Declaration[];
|
||||
>getNamedDeclarations : () => Declaration[]
|
||||
>Declaration : Declaration
|
||||
|
@ -5999,36 +5992,24 @@ declare module "typescript" {
|
|||
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile
|
||||
>fileName : string
|
||||
>compilationSettings : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
>version : string
|
||||
>textChangeRange : TextChangeRange
|
||||
>TextChangeRange : TextChangeRange
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
||||
|
@ -973,6 +972,7 @@ declare module "typescript" {
|
|||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isUnknownIdentifier(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
FunctionScopedVariable = 1,
|
||||
|
@ -1077,6 +1077,7 @@ declare module "typescript" {
|
|||
SuperStatic = 32,
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
|
@ -1549,9 +1550,6 @@ declare module "typescript" {
|
|||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
}
|
||||
interface SourceFile {
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
|
@ -1905,25 +1903,17 @@ declare module "typescript" {
|
|||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
@ -3159,6 +3155,11 @@ declare module "typescript" {
|
|||
>location : Node
|
||||
>Node : Node
|
||||
>name : string
|
||||
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
>getBlockScopedVariableId : (node: Identifier) => number
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
>SymbolFlags : SymbolFlags
|
||||
|
@ -3470,6 +3471,9 @@ declare module "typescript" {
|
|||
|
||||
EnumValuesComputed = 128,
|
||||
>EnumValuesComputed : NodeCheckFlags
|
||||
|
||||
BlockScopedBindingInLoop = 256,
|
||||
>BlockScopedBindingInLoop : NodeCheckFlags
|
||||
}
|
||||
interface NodeLinks {
|
||||
>NodeLinks : NodeLinks
|
||||
|
@ -4988,17 +4992,6 @@ declare module "typescript" {
|
|||
interface SourceFile {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
version: string;
|
||||
>version : string
|
||||
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
|
||||
nameTable: Map<string>;
|
||||
>nameTable : Map<string>
|
||||
>Map : Map<T>
|
||||
|
||||
getNamedDeclarations(): Declaration[];
|
||||
>getNamedDeclarations : () => Declaration[]
|
||||
>Declaration : Declaration
|
||||
|
@ -5949,36 +5942,24 @@ declare module "typescript" {
|
|||
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile
|
||||
>fileName : string
|
||||
>compilationSettings : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
>version : string
|
||||
>textChangeRange : TextChangeRange
|
||||
>TextChangeRange : TextChangeRange
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
||||
|
@ -1010,6 +1009,7 @@ declare module "typescript" {
|
|||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isUnknownIdentifier(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
FunctionScopedVariable = 1,
|
||||
|
@ -1114,6 +1114,7 @@ declare module "typescript" {
|
|||
SuperStatic = 32,
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
|
@ -1586,9 +1587,6 @@ declare module "typescript" {
|
|||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
}
|
||||
interface SourceFile {
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
|
@ -1942,25 +1940,17 @@ declare module "typescript" {
|
|||
acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
@ -3332,6 +3328,11 @@ declare module "typescript" {
|
|||
>location : Node
|
||||
>Node : Node
|
||||
>name : string
|
||||
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
>getBlockScopedVariableId : (node: Identifier) => number
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
>SymbolFlags : SymbolFlags
|
||||
|
@ -3643,6 +3644,9 @@ declare module "typescript" {
|
|||
|
||||
EnumValuesComputed = 128,
|
||||
>EnumValuesComputed : NodeCheckFlags
|
||||
|
||||
BlockScopedBindingInLoop = 256,
|
||||
>BlockScopedBindingInLoop : NodeCheckFlags
|
||||
}
|
||||
interface NodeLinks {
|
||||
>NodeLinks : NodeLinks
|
||||
|
@ -5161,17 +5165,6 @@ declare module "typescript" {
|
|||
interface SourceFile {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
version: string;
|
||||
>version : string
|
||||
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
|
||||
nameTable: Map<string>;
|
||||
>nameTable : Map<string>
|
||||
>Map : Map<T>
|
||||
|
||||
getNamedDeclarations(): Declaration[];
|
||||
>getNamedDeclarations : () => Declaration[]
|
||||
>Declaration : Declaration
|
||||
|
@ -6122,36 +6115,24 @@ declare module "typescript" {
|
|||
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
* and compilationSettings. The update will intern call updateLanguageServiceSourceFile
|
||||
* and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* Note: It is not allowed to call update on a SourceFile that was not acquired from this
|
||||
* registry originally.
|
||||
*
|
||||
* @param sourceFile The original sourceFile object to update
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
* @parm textChangeRange Change ranges since the last snapshot. Only used if the file
|
||||
* was not found in the registry and a new one was created.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
|
||||
>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile
|
||||
>fileName : string
|
||||
>compilationSettings : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>scriptSnapshot : IScriptSnapshot
|
||||
>IScriptSnapshot : IScriptSnapshot
|
||||
>version : string
|
||||
>textChangeRange : TextChangeRange
|
||||
>TextChangeRange : TextChangeRange
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,8 +12,8 @@ obj[Symbol.foo];
|
|||
|
||||
//// [ES5SymbolProperty1.js]
|
||||
var Symbol;
|
||||
var obj = (_a = {}, _a[Symbol.foo] =
|
||||
0,
|
||||
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,
|
||||
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,
|
||||
var v = (_a = {},
|
||||
_a[] = foo,
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
var v = { *[foo()]() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments5_es6.js]
|
||||
var v = (_a = {}, _a[foo()] = function () { },
|
||||
var v = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts (1 errors) ====
|
||||
let a: number = 1
|
||||
~~~
|
||||
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts ===
|
||||
let a: number = 1
|
||||
>a : number
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,7): error TS1155: 'const' declarations must be initialized
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts (2 errors) ====
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts (1 errors) ====
|
||||
const a
|
||||
~~~~~
|
||||
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
~
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts (1 errors) ====
|
||||
const a = 1
|
||||
~~~~~
|
||||
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
4
tests/baselines/reference/VariableDeclaration3_es6.types
Normal file
4
tests/baselines/reference/VariableDeclaration3_es6.types
Normal file
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts ===
|
||||
const a = 1
|
||||
>a : number
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,7): error TS1155: 'const' declarations must be initialized
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts (2 errors) ====
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts (1 errors) ====
|
||||
const a: number
|
||||
~~~~~
|
||||
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
~
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts (1 errors) ====
|
||||
const a: number = 1
|
||||
~~~~~
|
||||
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
4
tests/baselines/reference/VariableDeclaration5_es6.types
Normal file
4
tests/baselines/reference/VariableDeclaration5_es6.types
Normal file
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts ===
|
||||
const a: number = 1
|
||||
>a : number
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts (1 errors) ====
|
||||
let a
|
||||
~~~
|
||||
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
4
tests/baselines/reference/VariableDeclaration7_es6.types
Normal file
4
tests/baselines/reference/VariableDeclaration7_es6.types
Normal file
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts ===
|
||||
let a
|
||||
>a : any
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts (1 errors) ====
|
||||
let a = 1
|
||||
~~~
|
||||
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
4
tests/baselines/reference/VariableDeclaration8_es6.types
Normal file
4
tests/baselines/reference/VariableDeclaration8_es6.types
Normal file
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts ===
|
||||
let a = 1
|
||||
>a : number
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts (1 errors) ====
|
||||
let a: number
|
||||
~~~
|
||||
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
|
4
tests/baselines/reference/VariableDeclaration9_es6.types
Normal file
4
tests/baselines/reference/VariableDeclaration9_es6.types
Normal file
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts ===
|
||||
let a: number
|
||||
>a : number
|
||||
|
|
@ -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)
|
||||
--------------------------------
|
||||
|
|
|
@ -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.
|
||||
}
|
11
tests/baselines/reference/catchClauseWithBindingPattern1.js
Normal file
11
tests/baselines/reference/catchClauseWithBindingPattern1.js
Normal file
|
@ -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.
|
||||
}
|
11
tests/baselines/reference/catchClauseWithInitializer1.js
Normal file
11
tests/baselines/reference/catchClauseWithInitializer1.js
Normal file
|
@ -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.
|
||||
}
|
|
@ -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 () { },
|
||||
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 }),
|
||||
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,
|
||||
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,
|
||||
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 }),
|
||||
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,
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -13,7 +13,8 @@ var C = (function () {
|
|||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var obj = (_a = {}, _a[this.bar()] = function () { },
|
||||
var obj = (_a = {},
|
||||
_a[this.bar()] = function () { },
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
|
|
|
@ -15,8 +15,8 @@ var C = (function () {
|
|||
C.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[(_a = {}, _a[this.bar()] =
|
||||
1,
|
||||
C.prototype[(_a = {},
|
||||
_a[this.bar()] = 1,
|
||||
_a)[0]] = function () { };
|
||||
return C;
|
||||
})();
|
||||
|
|
|
@ -34,7 +34,8 @@ var C = (function (_super) {
|
|||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { },
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(this)] = function () { },
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
|
|
|
@ -34,8 +34,8 @@ var C = (function (_super) {
|
|||
}
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
C.prototype[(_a = {}, _a[super.bar.call(this)] =
|
||||
1,
|
||||
C.prototype[(_a = {},
|
||||
_a[super.bar.call(this)] = 1,
|
||||
_a)[0]] = function () { };
|
||||
return C;
|
||||
})(Base);
|
||||
|
|
|
@ -26,7 +26,8 @@ var C = (function (_super) {
|
|||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.call(this);
|
||||
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
|
||||
var obj = (_a = {},
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ var C = (function () {
|
|||
C.prototype.bar = function () {
|
||||
var _this = this;
|
||||
(function () {
|
||||
var obj = (_a = {}, _a[_this.bar()] = function () { },
|
||||
var obj = (_a = {},
|
||||
_a[_this.bar()] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
|
|
|
@ -32,7 +32,8 @@ var C = (function (_super) {
|
|||
function C() {
|
||||
_super.call(this);
|
||||
(function () {
|
||||
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
|
||||
var obj = (_a = {},
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
|
|
|
@ -38,7 +38,8 @@ var C = (function (_super) {
|
|||
C.prototype.foo = function () {
|
||||
var _this = this;
|
||||
(function () {
|
||||
var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { },
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(_this)] = function () { },
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
|
|
|
@ -15,7 +15,8 @@ var C = (function () {
|
|||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var obj = (_a = {}, _a[foo()] = function () { },
|
||||
var obj = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
|
|
|
@ -15,7 +15,8 @@ var C = (function () {
|
|||
function C() {
|
||||
}
|
||||
C.bar = function () {
|
||||
var obj = (_a = {}, _a[foo()] = function () { },
|
||||
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,
|
||||
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,
|
||||
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] =
|
||||
"",
|
||||
extractIndexer((_a = {},
|
||||
_a[a] = "",
|
||||
_a)); // Should return string
|
||||
extractIndexer((_b = {}, _b[0 /* x */] =
|
||||
"",
|
||||
extractIndexer((_b = {},
|
||||
_b[0 /* x */] = "",
|
||||
_b)); // Should return string
|
||||
extractIndexer((_c = {}, _c["" || 0] =
|
||||
"",
|
||||
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,
|
||||
}, 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,
|
||||
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,
|
||||
}, 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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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; },
|
||||
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; },
|
||||
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; },
|
||||
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,
|
||||
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,
|
||||
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.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.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,
|
||||
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,
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -7,8 +7,11 @@ 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 }),
|
||||
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;
|
||||
},
|
||||
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;IACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"}
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CAAA,EAAA,GAAA,EAAA;IAAA,EAAA,CAEA,OAAO,CAFA,GAAA;QAGA,QAAQ,CAAC;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,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
|
||||
|
@ -32,128 +27,130 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
|||
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
5 >
|
||||
6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
6 >
|
||||
7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
7 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
7 >
|
||||
8 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
8 >
|
||||
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 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) 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)
|
||||
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
|
||||
5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0)
|
||||
6 >Emitted(1, 10) Source(1, 1) + SourceIndex(0)
|
||||
7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0)
|
||||
6 >Emitted(1, 10) Source(0, NaN) + SourceIndex(0)
|
||||
7 >Emitted(1, 12) Source(0, NaN) + 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 >
|
||||
>>> _a["hello"] = function () {
|
||||
1->^^^^
|
||||
2 > ^^
|
||||
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(1, 12) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(0, NaN) + 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)
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 7) Source(0, NaN) + 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, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 8) Source(2, 6) + SourceIndex(0) nameIndex (-1)
|
||||
3 >
|
||||
4 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 15) Source(2, 13) + SourceIndex(0) nameIndex (-1)
|
||||
4 > "hello"
|
||||
5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
|
||||
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 16) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
5 >
|
||||
6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(0, 9) + 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(0, NaN) + SourceIndex(0)
|
||||
2 >Emitted(2, 7) Source(0, NaN) + 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 >!!^^ !!^^ 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(2, 5) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 9) Source(3, 9) + SourceIndex(0) nameIndex (-1)
|
||||
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)
|
||||
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(0, 9) + 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, 7) Source(0, 9) + 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 >!!^^ !!^^ 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, 8) Source(2, 9) + 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(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)
|
||||
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, 15) Source(2, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(4, 6) + SourceIndex(0) nameIndex (-1)
|
||||
2 > }
|
||||
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 16) + 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 > ^
|
||||
5 > ^
|
||||
1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
|
||||
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
3 > ^
|
||||
4 > ^
|
||||
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(2, 16) Source(0, 16) + 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(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
|
||||
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(0, NaN) + 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, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
|
||||
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, 19) Source(0, 16) + 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(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1)
|
||||
4 >
|
||||
5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
|
||||
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1)
|
||||
5 >
|
||||
1->Emitted(4, 5) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0)
|
||||
3 >Emitted(4, 7) Source(0, NaN) + SourceIndex(0)
|
||||
4 >Emitted(4, 8) Source(5, 2) + SourceIndex(0)
|
||||
5 >Emitted(4, 9) Source(5, 2) + SourceIndex(0)
|
||||
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, 9) Source(3, 16) + 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: 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 >!!^^ !!^^ 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, 24) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 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, 5) 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, 25) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 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)
|
||||
1 >Emitted(6, 5) Source(0, NaN) + SourceIndex(0)
|
||||
2 >Emitted(6, 7) Source(0, NaN) + 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: ;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,EAAA
|
||||
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
|
|
@ -4,13 +4,12 @@ tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' dec
|
|||
tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(8,11): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(11,27): error TS2449: The operand of an increment or decrement operator cannot be a constant.
|
||||
tests/cases/compiler/constDeclarations-errors.ts(14,11): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2449: The operand of an increment or decrement operator cannot be a constant.
|
||||
tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-errors.ts (10 errors) ====
|
||||
==== tests/cases/compiler/constDeclarations-errors.ts (9 errors) ====
|
||||
|
||||
// error, missing intialicer
|
||||
const c1;
|
||||
|
@ -29,10 +28,7 @@ tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' d
|
|||
~~
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
||||
|
||||
// error, can not be unintalized
|
||||
for(const c in {}) { }
|
||||
~
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
||||
|
||||
// error, assigning to a const
|
||||
for(const c8 = 0; c8 < 1; c8++) { }
|
||||
|
|
|
@ -5,7 +5,6 @@ const c1;
|
|||
const c2: number;
|
||||
const c3, c4, c5 :string, c6; // error, missing initialicer
|
||||
|
||||
// error, can not be unintalized
|
||||
for(const c in {}) { }
|
||||
|
||||
// error, assigning to a const
|
||||
|
@ -22,8 +21,7 @@ for(const c10 = 0, c11; c10 < 1;) { }
|
|||
const c1;
|
||||
const c2;
|
||||
const c3, c4, c5, c6; // error, missing initialicer
|
||||
// error, can not be unintalized
|
||||
for (var c in {}) { }
|
||||
for (const c in {}) { }
|
||||
// error, assigning to a const
|
||||
for (const c8 = 0; c8 < 1; c8++) { }
|
||||
// error, can not be unintalized
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
tests/cases/compiler/constDeclarations-es5.ts(2,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/compiler/constDeclarations-es5.ts(3,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/compiler/constDeclarations-es5.ts(4,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-es5.ts (3 errors) ====
|
||||
|
||||
const z7 = false;
|
||||
~~~~~
|
||||
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
const z8: number = 23;
|
||||
~~~~~
|
||||
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
const z9 = 0, z10 :string = "", z11 = null;
|
||||
~~~~~
|
||||
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
|
||||
|
|
@ -6,6 +6,6 @@ const z9 = 0, z10 :string = "", z11 = null;
|
|||
|
||||
|
||||
//// [constDeclarations-es5.js]
|
||||
const z7 = false;
|
||||
const z8 = 23;
|
||||
const z9 = 0, z10 = "", z11 = null;
|
||||
var z7 = false;
|
||||
var z8 = 23;
|
||||
var z9 = 0, z10 = "", z11 = null;
|
||||
|
|
13
tests/baselines/reference/constDeclarations-es5.types
Normal file
13
tests/baselines/reference/constDeclarations-es5.types
Normal file
|
@ -0,0 +1,13 @@
|
|||
=== tests/cases/compiler/constDeclarations-es5.ts ===
|
||||
|
||||
const z7 = false;
|
||||
>z7 : boolean
|
||||
|
||||
const z8: number = 23;
|
||||
>z8 : number
|
||||
|
||||
const z9 = 0, z10 :string = "", z11 = null;
|
||||
>z9 : number
|
||||
>z10 : string
|
||||
>z11 : any
|
||||
|
7
tests/baselines/reference/downlevelLetConst1.errors.txt
Normal file
7
tests/baselines/reference/downlevelLetConst1.errors.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
tests/cases/compiler/downlevelLetConst1.ts(1,6): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst1.ts (1 errors) ====
|
||||
const
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
5
tests/baselines/reference/downlevelLetConst1.js
Normal file
5
tests/baselines/reference/downlevelLetConst1.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
//// [downlevelLetConst1.ts]
|
||||
const
|
||||
|
||||
//// [downlevelLetConst1.js]
|
||||
var ;
|
5
tests/baselines/reference/downlevelLetConst10.js
Normal file
5
tests/baselines/reference/downlevelLetConst10.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
//// [downlevelLetConst10.ts]
|
||||
let a: number = 1
|
||||
|
||||
//// [downlevelLetConst10.js]
|
||||
var a = 1;
|
4
tests/baselines/reference/downlevelLetConst10.types
Normal file
4
tests/baselines/reference/downlevelLetConst10.types
Normal file
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/compiler/downlevelLetConst10.ts ===
|
||||
let a: number = 1
|
||||
>a : number
|
||||
|
8
tests/baselines/reference/downlevelLetConst11.errors.txt
Normal file
8
tests/baselines/reference/downlevelLetConst11.errors.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
tests/cases/compiler/downlevelLetConst11.ts(2,4): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst11.ts (1 errors) ====
|
||||
"use strict";
|
||||
let
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue