mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge remote-tracking branch 'origin/master' into systemModule
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/// <reference path="parser.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
/* @internal */ export let bindTime = 0;
|
||||
export let bindTime = 0;
|
||||
|
||||
export const enum ModuleInstanceState {
|
||||
NonInstantiated = 0,
|
||||
@@ -539,7 +540,7 @@ module ts {
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if ((<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
|
||||
if ((<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
|
||||
// An export default clause with an identifier exports all meanings of that identifier
|
||||
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
|
||||
}
|
||||
|
||||
+13
-30
@@ -1,19 +1,18 @@
|
||||
/// <reference path="binder.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
let nextSymbolId = 1;
|
||||
let nextNodeId = 1;
|
||||
let nextMergeId = 1;
|
||||
|
||||
// @internal
|
||||
export function getNodeId(node: Node): number {
|
||||
if (!node.id) node.id = nextNodeId++;
|
||||
return node.id;
|
||||
}
|
||||
|
||||
/* @internal */ export let checkTime = 0;
|
||||
export let checkTime = 0;
|
||||
|
||||
/* @internal */
|
||||
export function getSymbolId(symbol: Symbol): number {
|
||||
if (!symbol.id) {
|
||||
symbol.id = nextSymbolId++;
|
||||
@@ -682,7 +681,7 @@ module ts {
|
||||
}
|
||||
|
||||
function getTargetOfExportAssignment(node: ExportAssignment): Symbol {
|
||||
return node.expression && resolveEntityName(<Identifier>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
|
||||
return resolveEntityName(<Identifier>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
|
||||
}
|
||||
|
||||
function getTargetOfAliasDeclaration(node: Declaration): Symbol {
|
||||
@@ -748,7 +747,7 @@ module ts {
|
||||
if (!links.referenced) {
|
||||
links.referenced = true;
|
||||
let node = getDeclarationOfAliasSymbol(symbol);
|
||||
if (node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression) {
|
||||
if (node.kind === SyntaxKind.ExportAssignment) {
|
||||
// export default <symbol>
|
||||
checkExpressionCached((<ExportAssignment>node).expression);
|
||||
}
|
||||
@@ -2287,16 +2286,7 @@ module ts {
|
||||
}
|
||||
// Handle export default expressions
|
||||
if (declaration.kind === SyntaxKind.ExportAssignment) {
|
||||
var exportAssignment = <ExportAssignment>declaration;
|
||||
if (exportAssignment.expression) {
|
||||
return links.type = checkExpression(exportAssignment.expression);
|
||||
}
|
||||
else if (exportAssignment.type) {
|
||||
return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type);
|
||||
}
|
||||
else {
|
||||
return links.type = anyType;
|
||||
}
|
||||
return links.type = checkExpression((<ExportAssignment>declaration).expression);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
links.type = resolvingType;
|
||||
@@ -7340,7 +7330,7 @@ module ts {
|
||||
|
||||
function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) {
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
if (node.type) {
|
||||
if (node.type && !node.asteriskToken) {
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type));
|
||||
}
|
||||
|
||||
@@ -8906,7 +8896,7 @@ module ts {
|
||||
}
|
||||
|
||||
checkSourceElement(node.body);
|
||||
if (node.type && !isAccessor(node.kind)) {
|
||||
if (node.type && !isAccessor(node.kind) && !node.asteriskToken) {
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type));
|
||||
}
|
||||
|
||||
@@ -10599,21 +10589,12 @@ module ts {
|
||||
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers);
|
||||
}
|
||||
if (node.expression) {
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
markExportAsReferenced(node);
|
||||
}
|
||||
else {
|
||||
checkExpressionCached(node.expression);
|
||||
}
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
markExportAsReferenced(node);
|
||||
}
|
||||
if (node.type) {
|
||||
checkSourceElement(node.type);
|
||||
if (!isInAmbientContext(node)) {
|
||||
grammarErrorOnFirstToken(node.type, Diagnostics.A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration);
|
||||
}
|
||||
else {
|
||||
checkExpressionCached(node.expression);
|
||||
}
|
||||
|
||||
checkExternalModuleExports(container);
|
||||
|
||||
if (node.isExportEquals) {
|
||||
@@ -10873,6 +10854,8 @@ module ts {
|
||||
checkGrammarSourceFile(node);
|
||||
|
||||
emitExtends = false;
|
||||
emitDecorate = false;
|
||||
emitParam = false;
|
||||
potentialThisCollisions.length = 0;
|
||||
|
||||
forEach(node.statements, checkSourceElement);
|
||||
|
||||
@@ -165,7 +165,6 @@ module ts {
|
||||
}
|
||||
];
|
||||
|
||||
/* @internal */
|
||||
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
|
||||
var options: CompilerOptions = {};
|
||||
var fileNames: string[] = [];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="types.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
|
||||
// Ternary values are defined such that
|
||||
// x & y is False if either x or y is False.
|
||||
// x & y is Maybe if either x or y is Maybe, but neither x or y is False.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="checker.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
|
||||
interface ModuleElementDeclarationEmitInfo {
|
||||
node: Node;
|
||||
outputPos: number;
|
||||
@@ -442,20 +442,41 @@ module ts {
|
||||
emitLines(node.statements);
|
||||
}
|
||||
|
||||
// Return a temp variable name to be used in `export default` statements.
|
||||
// The temp name will be of the form _default_counter.
|
||||
// Note that export default is only allowed at most once in a module, so we
|
||||
// do not need to keep track of created temp names.
|
||||
function getExportDefaultTempVariableName(): string {
|
||||
let baseName = "_default";
|
||||
if (!hasProperty(currentSourceFile.identifiers, baseName)) {
|
||||
return baseName;
|
||||
}
|
||||
let count = 0;
|
||||
while (true) {
|
||||
let name = baseName + "_" + (++count);
|
||||
if (!hasProperty(currentSourceFile.identifiers, name)) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitExportAssignment(node: ExportAssignment) {
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
writeTextOfNode(currentSourceFile, node.expression);
|
||||
}
|
||||
else {
|
||||
// Expression
|
||||
let tempVarName = getExportDefaultTempVariableName();
|
||||
write("declare var ");
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
if (node.type) {
|
||||
emitType(node.type);
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
write(tempVarName);
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
@@ -1540,7 +1561,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[]) {
|
||||
let emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile);
|
||||
// TODO(shkamat): Should we not write any declaration file if any of them can produce error,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// <auto-generated />
|
||||
/// <reference path="types.ts" />
|
||||
/* @internal */
|
||||
module ts {
|
||||
export var Diagnostics = {
|
||||
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
|
||||
@@ -158,7 +159,6 @@ module ts {
|
||||
An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." },
|
||||
Unterminated_Unicode_escape_sequence: { code: 1199, category: DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." },
|
||||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
|
||||
A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { code: 1201, category: DiagnosticCategory.Error, key: "A type annotation on an export statement is only allowed in an ambient external module declaration." },
|
||||
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
|
||||
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
|
||||
Cannot_compile_external_modules_into_amd_system_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd, system or commonjs when targeting es6 or higher." },
|
||||
|
||||
@@ -623,10 +623,6 @@
|
||||
"category": "Error",
|
||||
"code": 1200
|
||||
},
|
||||
"A type annotation on an export statement is only allowed in an ambient external module declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1201
|
||||
},
|
||||
"Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead.": {
|
||||
"category": "Error",
|
||||
"code": 1202
|
||||
|
||||
+28
-2
@@ -1,6 +1,7 @@
|
||||
/// <reference path="checker.ts"/>
|
||||
/// <reference path="declarationEmitter.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
// represents one LexicalEnvironment frame to store unique generated names
|
||||
interface ScopeFrame {
|
||||
@@ -20,7 +21,6 @@ module ts {
|
||||
_n = 0x20000000, // Use/preference flag for '_n'
|
||||
}
|
||||
|
||||
// @internal
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult {
|
||||
// emit output for the __extends helper function
|
||||
@@ -1099,6 +1099,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
default:
|
||||
return Comparison.LessThan;
|
||||
}
|
||||
case SyntaxKind.YieldExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return Comparison.LessThan;
|
||||
default:
|
||||
@@ -1307,6 +1308,17 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
emit((<SpreadElementExpression>node).expression);
|
||||
}
|
||||
|
||||
function emitYieldExpression(node: YieldExpression) {
|
||||
write(tokenToString(SyntaxKind.YieldKeyword));
|
||||
if (node.asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
if (node.expression) {
|
||||
write(" ");
|
||||
emit(node.expression);
|
||||
}
|
||||
}
|
||||
|
||||
function needsParenthesisForPropertyAccessOrInvocation(node: Expression) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
@@ -1603,6 +1615,10 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
}
|
||||
|
||||
function emitMethod(node: MethodDeclaration) {
|
||||
if (languageVersion >= ScriptTarget.ES6 && node.asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
|
||||
emit(node.name, /*allowGeneratedIdentifiers*/ false);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
write(": function ");
|
||||
@@ -3133,7 +3149,12 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
write("default ");
|
||||
}
|
||||
}
|
||||
write("function ");
|
||||
|
||||
write("function");
|
||||
if (languageVersion >= ScriptTarget.ES6 && node.asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
write(" ");
|
||||
}
|
||||
|
||||
if (shouldEmitFunctionName(node)) {
|
||||
@@ -3517,6 +3538,9 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
else if (member.kind === SyntaxKind.SetAccessor) {
|
||||
write("set ");
|
||||
}
|
||||
if ((<MethodDeclaration>member).asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
emit((<MethodDeclaration>member).name);
|
||||
emitSignatureAndBody(<MethodDeclaration>member);
|
||||
emitEnd(member);
|
||||
@@ -5358,6 +5382,8 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
return emitConditionalExpression(<ConditionalExpression>node);
|
||||
case SyntaxKind.SpreadElementExpression:
|
||||
return emitSpreadElementExpression(<SpreadElementExpression>node);
|
||||
case SyntaxKind.YieldExpression:
|
||||
return emitYieldExpression(<YieldExpression>node);
|
||||
case SyntaxKind.OmittedExpression:
|
||||
return;
|
||||
case SyntaxKind.Block:
|
||||
|
||||
+12
-9
@@ -299,8 +299,7 @@ module ts {
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
visitNodes(cbNodes, node.modifiers) ||
|
||||
visitNode(cbNode, (<ExportAssignment>node).expression) ||
|
||||
visitNode(cbNode, (<ExportAssignment>node).type);
|
||||
visitNode(cbNode, (<ExportAssignment>node).expression);
|
||||
case SyntaxKind.TemplateExpression:
|
||||
return visitNode(cbNode, (<TemplateExpression>node).head) || visitNodes(cbNodes, (<TemplateExpression>node).templateSpans);
|
||||
case SyntaxKind.TemplateSpan:
|
||||
@@ -3221,6 +3220,16 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// If encounter "([" or "({", this could be the start of a binding pattern.
|
||||
// Examples:
|
||||
// ([ x ]) => { }
|
||||
// ({ x }) => { }
|
||||
// ([ x ])
|
||||
// ({ x })
|
||||
if (second === SyntaxKind.OpenBracketToken || second === SyntaxKind.OpenBraceToken) {
|
||||
return Tristate.Unknown;
|
||||
}
|
||||
|
||||
// Simple case: "(..."
|
||||
// This is an arrow function with a rest parameter.
|
||||
if (second === SyntaxKind.DotDotDotToken) {
|
||||
@@ -5123,17 +5132,11 @@ module ts {
|
||||
setModifiers(node, modifiers);
|
||||
if (parseOptional(SyntaxKind.EqualsToken)) {
|
||||
node.isExportEquals = true;
|
||||
node.expression = parseAssignmentExpressionOrHigher();
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.DefaultKeyword);
|
||||
if (parseOptional(SyntaxKind.ColonToken)) {
|
||||
node.type = parseType();
|
||||
}
|
||||
else {
|
||||
node.expression = parseAssignmentExpressionOrHigher();
|
||||
}
|
||||
}
|
||||
node.expression = parseAssignmentExpressionOrHigher();
|
||||
parseSemicolon();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ module ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export let version = "1.5.0";
|
||||
export const version = "1.5.0";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
var fileName = "tsconfig.json";
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
/// <reference path="diagnosticInformationMap.generated.ts"/>
|
||||
|
||||
module ts {
|
||||
|
||||
/* @internal */
|
||||
export interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
@@ -262,6 +263,7 @@ module ts {
|
||||
return textToToken[s];
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function computeLineStarts(text: string): number[] {
|
||||
let result: number[] = new Array();
|
||||
let pos = 0;
|
||||
@@ -293,15 +295,18 @@ module ts {
|
||||
return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number {
|
||||
Debug.assert(line >= 0 && line < lineStarts.length);
|
||||
return lineStarts[line] + character;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function getLineStarts(sourceFile: SourceFile): number[] {
|
||||
return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function computeLineAndCharacterOfPosition(lineStarts: number[], position: number) {
|
||||
let lineNumber = binarySearch(lineStarts, position);
|
||||
if (lineNumber < 0) {
|
||||
@@ -362,10 +367,12 @@ module ts {
|
||||
return ch >= CharacterCodes._0 && ch <= CharacterCodes._9;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function isOctalDigit(ch: number): boolean {
|
||||
return ch >= CharacterCodes._0 && ch <= CharacterCodes._7;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number {
|
||||
while (true) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
@@ -588,6 +595,7 @@ module ts {
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner {
|
||||
let pos: number; // Current position (end position of text of current token)
|
||||
let len: number; // Length of text
|
||||
|
||||
+5
-5
@@ -6,17 +6,17 @@ module ts {
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(fileName: string, encoding?: string): string;
|
||||
writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile? (fileName: string, callback: (fileName: string) => void): FileWatcher;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(directoryName: string): void;
|
||||
createDirectory(path: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage? (): number;
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
|
||||
|
||||
+94
-48
@@ -320,6 +320,7 @@ module ts {
|
||||
BlockScoped = Let | Const
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum ParserContextFlags {
|
||||
// Set if this node was parsed in strict mode. Used for grammar error checks, as well as
|
||||
// checking if the node can be reused in incremental settings.
|
||||
@@ -355,6 +356,7 @@ module ts {
|
||||
HasAggregatedChildData = 1 << 7
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum RelationComparisonResult {
|
||||
Succeeded = 1, // Should be truthy
|
||||
Failed = 2,
|
||||
@@ -366,15 +368,15 @@ module ts {
|
||||
flags: NodeFlags;
|
||||
// Specific context the parser was in when this node was created. Normally undefined.
|
||||
// Only set when the parser was in some interesting context (like async/yield).
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>; // Array of decorators (in document order)
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
id?: number; // Unique id (used to look up NodeLinks)
|
||||
parent?: Node; // Parent node (initialized by binding)
|
||||
symbol?: Symbol; // Symbol declared by node (initialized by binding)
|
||||
locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||
nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||
/* @internal */ parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>; // Array of decorators (in document order)
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
/* @internal */ id?: number; // Unique id (used to look up NodeLinks)
|
||||
parent?: Node; // Parent node (initialized by binding)
|
||||
/* @internal */ symbol?: Symbol; // Symbol declared by node (initialized by binding)
|
||||
/* @internal */ locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||
/* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||
/* @internal */ localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||
}
|
||||
|
||||
export interface NodeArray<T> extends Array<T>, TextRange {
|
||||
@@ -975,8 +977,7 @@ module ts {
|
||||
|
||||
export interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface FileReference extends TextRange {
|
||||
@@ -1002,11 +1003,12 @@ module ts {
|
||||
|
||||
hasNoDefaultLib: boolean;
|
||||
|
||||
// The first node that causes this file to be an external module
|
||||
externalModuleIndicator: Node;
|
||||
languageVersion: ScriptTarget;
|
||||
identifiers: Map<string>;
|
||||
|
||||
// The first node that causes this file to be an external module
|
||||
/* @internal */ externalModuleIndicator: Node;
|
||||
|
||||
/* @internal */ identifiers: Map<string>;
|
||||
/* @internal */ nodeCount: number;
|
||||
/* @internal */ identifierCount: number;
|
||||
/* @internal */ symbolCount: number;
|
||||
@@ -1034,6 +1036,9 @@ module ts {
|
||||
}
|
||||
|
||||
export interface Program extends ScriptReferenceHost {
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
getSourceFiles(): SourceFile[];
|
||||
|
||||
/**
|
||||
@@ -1053,10 +1058,12 @@ module ts {
|
||||
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
|
||||
// Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
/**
|
||||
* Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
*/
|
||||
getTypeChecker(): TypeChecker;
|
||||
|
||||
getCommonSourceDirectory(): string;
|
||||
/* @internal */ getCommonSourceDirectory(): string;
|
||||
|
||||
// For testing purposes only. Should not be used by any other consumers (including the
|
||||
// language service).
|
||||
@@ -1069,12 +1076,18 @@ module ts {
|
||||
}
|
||||
|
||||
export interface SourceMapSpan {
|
||||
emittedLine: number; // Line number in the .js file
|
||||
emittedColumn: number; // Column number in the .js file
|
||||
sourceLine: number; // Line number in the .ts file
|
||||
sourceColumn: number; // Column number in the .ts file
|
||||
nameIndex?: number; // Optional name (index into names array) associated with this span
|
||||
sourceIndex: number; // .ts file (index into sources array) associated with this span*/
|
||||
/** Line number in the .js file. */
|
||||
emittedLine: number;
|
||||
/** Column number in the .js file. */
|
||||
emittedColumn: number;
|
||||
/** Line number in the .ts file. */
|
||||
sourceLine: number;
|
||||
/** Column number in the .ts file. */
|
||||
sourceColumn: number;
|
||||
/** Optional name (index into names array) associated with this span. */
|
||||
nameIndex?: number;
|
||||
/** .ts file (index into sources array) associated with this span */
|
||||
sourceIndex: number;
|
||||
}
|
||||
|
||||
export interface SourceMapData {
|
||||
@@ -1089,7 +1102,7 @@ module ts {
|
||||
sourceMapDecodedMappings: SourceMapSpan[]; // Raw source map spans that were encoded into the sourceMapMappings
|
||||
}
|
||||
|
||||
// Return code used by getEmitOutput function to indicate status of the function
|
||||
/** Return code used by getEmitOutput function to indicate status of the function */
|
||||
export enum ExitStatus {
|
||||
// Compiler ran successfully. Either this was a simple do-nothing compilation (for example,
|
||||
// when -version or -help was provided, or this was a normal compilation, no diagnostics
|
||||
@@ -1106,7 +1119,7 @@ module ts {
|
||||
export interface EmitResult {
|
||||
emitSkipped: boolean;
|
||||
diagnostics: Diagnostic[];
|
||||
sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps
|
||||
/* @internal */ sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps
|
||||
}
|
||||
|
||||
export interface TypeCheckerHost {
|
||||
@@ -1125,8 +1138,6 @@ module ts {
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
|
||||
// If 'predicate' is supplied, then only the first symbol in scope matching the predicate
|
||||
// will be returned. Otherwise, all symbols in scope will be returned.
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol;
|
||||
@@ -1218,14 +1229,17 @@ module ts {
|
||||
UseOnlyExternalAliasing = 0x00000002,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum SymbolAccessibility {
|
||||
Accessible,
|
||||
NotAccessible,
|
||||
CannotBeNamed
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
|
||||
/* @internal */
|
||||
export interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: AnyImportSyntax[]; // aliases that need to have this symbol visible
|
||||
@@ -1233,10 +1247,12 @@ module ts {
|
||||
errorNode?: Node; // optional node that results in error
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface SymbolAccessiblityResult extends SymbolVisibilityResult {
|
||||
errorModuleName?: string // If the symbol is not visible from module, module's name
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface EmitResolver {
|
||||
hasGlobalName(name: string): boolean;
|
||||
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
|
||||
@@ -1342,19 +1358,20 @@ module ts {
|
||||
}
|
||||
|
||||
export interface Symbol {
|
||||
flags: SymbolFlags; // Symbol flags
|
||||
name: string; // Name of symbol
|
||||
id?: number; // Unique id (used to look up SymbolLinks)
|
||||
mergeId?: number; // Merge id (used to look up merged symbol)
|
||||
declarations?: Declaration[]; // Declarations associated with this symbol
|
||||
parent?: Symbol; // Parent symbol
|
||||
members?: SymbolTable; // Class, interface or literal instance members
|
||||
exports?: SymbolTable; // Module exports
|
||||
exportSymbol?: Symbol; // Exported symbol associated with this symbol
|
||||
valueDeclaration?: Declaration // First value declaration of the symbol
|
||||
constEnumOnlyModule?: boolean // True if module contains only const enums or other modules with only const enums
|
||||
flags: SymbolFlags; // Symbol flags
|
||||
name: string; // Name of symbol
|
||||
/* @internal */ id?: number; // Unique id (used to look up SymbolLinks)
|
||||
/* @internal */ mergeId?: number; // Merge id (used to look up merged symbol)
|
||||
declarations?: Declaration[]; // Declarations associated with this symbol
|
||||
/* @internal */ parent?: Symbol; // Parent symbol
|
||||
members?: SymbolTable; // Class, interface or literal instance members
|
||||
exports?: SymbolTable; // Module exports
|
||||
/* @internal */ exportSymbol?: Symbol; // Exported symbol associated with this symbol
|
||||
valueDeclaration?: Declaration; // First value declaration of the symbol
|
||||
/* @internal */ constEnumOnlyModule?: boolean; // True if module contains only const enums or other modules with only const enums
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface SymbolLinks {
|
||||
target?: Symbol; // Resolved (non-alias) target of an alias
|
||||
type?: Type; // Type of value symbol
|
||||
@@ -1366,12 +1383,14 @@ module ts {
|
||||
exportsChecked?: boolean; // True if exports of external module have been checked
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface TransientSymbol extends Symbol, SymbolLinks { }
|
||||
|
||||
export interface SymbolTable {
|
||||
[index: string]: Symbol;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum NodeCheckFlags {
|
||||
TypeChecked = 0x00000001, // Node has been type checked
|
||||
LexicalThis = 0x00000002, // Lexical 'this' reference
|
||||
@@ -1388,6 +1407,7 @@ module ts {
|
||||
EmitParam = 0x00000400, // Emit __param helper for decorators
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface NodeLinks {
|
||||
resolvedType?: Type; // Cached type of type node
|
||||
resolvedSignature?: Signature; // Cached signature of signature node or call expression
|
||||
@@ -1420,27 +1440,34 @@ module ts {
|
||||
Tuple = 0x00002000, // Tuple
|
||||
Union = 0x00004000, // Union
|
||||
Anonymous = 0x00008000, // Anonymous
|
||||
/* @internal */
|
||||
FromSignature = 0x00010000, // Created for signature assignment check
|
||||
ObjectLiteral = 0x00020000, // Originates in an object literal
|
||||
/* @internal */
|
||||
ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type
|
||||
ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type
|
||||
/* @internal */
|
||||
ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type
|
||||
ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6
|
||||
|
||||
/* @internal */
|
||||
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null,
|
||||
/* @internal */
|
||||
Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum,
|
||||
StringLike = String | StringLiteral,
|
||||
NumberLike = Number | Enum,
|
||||
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
|
||||
/* @internal */
|
||||
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral
|
||||
}
|
||||
|
||||
// Properties common to all types
|
||||
export interface Type {
|
||||
flags: TypeFlags; // Flags
|
||||
id: number; // Unique ID
|
||||
symbol?: Symbol; // Symbol associated with type (if any)
|
||||
flags: TypeFlags; // Flags
|
||||
/* @internal */ id: number; // Unique ID
|
||||
symbol?: Symbol; // Symbol associated with type (if any)
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
// Intrinsic types (TypeFlags.Intrinsic)
|
||||
export interface IntrinsicType extends Type {
|
||||
intrinsicName: string; // Name of intrinsic type
|
||||
@@ -1473,6 +1500,7 @@ module ts {
|
||||
|
||||
// Generic class and interface types
|
||||
export interface GenericType extends InterfaceType, TypeReference {
|
||||
/* @internal */
|
||||
instantiations: Map<TypeReference>; // Generic instantiation cache
|
||||
}
|
||||
|
||||
@@ -1483,9 +1511,11 @@ module ts {
|
||||
|
||||
export interface UnionType extends Type {
|
||||
types: Type[]; // Constituent types
|
||||
/* @internal */
|
||||
resolvedProperties: SymbolTable; // Cache of resolved properties
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
// Resolved object or union type
|
||||
export interface ResolvedType extends ObjectType, UnionType {
|
||||
members: SymbolTable; // Properties by name
|
||||
@@ -1499,7 +1529,9 @@ module ts {
|
||||
// Type parameters (TypeFlags.TypeParameter)
|
||||
export interface TypeParameter extends Type {
|
||||
constraint: Type; // Constraint
|
||||
/* @internal */
|
||||
target?: TypeParameter; // Instantiation target
|
||||
/* @internal */
|
||||
mapper?: TypeMapper; // Instantiation mapper
|
||||
}
|
||||
|
||||
@@ -1512,14 +1544,23 @@ module ts {
|
||||
declaration: SignatureDeclaration; // Originating declaration
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
parameters: Symbol[]; // Parameters
|
||||
/* @internal */
|
||||
resolvedReturnType: Type; // Resolved return type
|
||||
/* @internal */
|
||||
minArgumentCount: number; // Number of non-optional parameters
|
||||
/* @internal */
|
||||
hasRestParameter: boolean; // True if last parameter is rest parameter
|
||||
/* @internal */
|
||||
hasStringLiterals: boolean; // True if specialized
|
||||
/* @internal */
|
||||
target?: Signature; // Instantiation target
|
||||
/* @internal */
|
||||
mapper?: TypeMapper; // Instantiation mapper
|
||||
/* @internal */
|
||||
unionSignatures?: Signature[]; // Underlying signatures of a union signature
|
||||
/* @internal */
|
||||
erasedSignatureCache?: Signature; // Erased version of signature (deferred)
|
||||
/* @internal */
|
||||
isolatedSignatureType?: ObjectType; // A manufactured type that just contains the signature for purposes of signature comparison
|
||||
}
|
||||
|
||||
@@ -1528,11 +1569,12 @@ module ts {
|
||||
Number,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export interface TypeInferences {
|
||||
primary: Type[]; // Inferences made directly to a type parameter
|
||||
secondary: Type[]; // Inferences made to a type parameter in a union type
|
||||
@@ -1540,7 +1582,7 @@ module ts {
|
||||
// If a type parameter is fixed, no more inferences can be made for the type parameter
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export interface InferenceContext {
|
||||
typeParameters: TypeParameter[]; // Type parameters for which inferences are made
|
||||
inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType)
|
||||
@@ -1556,10 +1598,12 @@ module ts {
|
||||
code: number;
|
||||
}
|
||||
|
||||
// A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
// It is built from the bottom up, leaving the head to be the "main" diagnostic.
|
||||
// While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
|
||||
// the difference is that messages are all preformatted in DMC.
|
||||
/**
|
||||
* A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
* It is built from the bottom up, leaving the head to be the "main" diagnostic.
|
||||
* While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
|
||||
* the difference is that messages are all preformatted in DMC.
|
||||
*/
|
||||
export interface DiagnosticMessageChain {
|
||||
messageText: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1644,6 +1688,7 @@ module ts {
|
||||
errors: Diagnostic[];
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface CommandLineOption {
|
||||
name: string;
|
||||
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
|
||||
@@ -1655,6 +1700,7 @@ module ts {
|
||||
experimental?: boolean;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum CharacterCodes {
|
||||
nullCharacter = 0,
|
||||
maxAsciiCharacter = 0x7F,
|
||||
@@ -1816,7 +1862,7 @@ module ts {
|
||||
newLength: number;
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export interface DiagnosticCollection {
|
||||
// Adds a diagnostic to this diagnostic collection.
|
||||
add(diagnostic: Diagnostic): void;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/// <reference path="binder.ts" />
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
export interface ReferencePathMatchResult {
|
||||
fileReference?: FileReference
|
||||
@@ -1394,7 +1395,7 @@ module ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export function createDiagnosticCollection(): DiagnosticCollection {
|
||||
let nonFileDiagnostics: Diagnostic[] = [];
|
||||
let fileDiagnostics: Map<Diagnostic[]> = {};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
/// <reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.BreakpointResolver {
|
||||
/**
|
||||
* Get the breakpoint span in given sourceFile
|
||||
@@ -173,10 +174,6 @@ module ts.BreakpointResolver {
|
||||
return textSpan(node, (<ThrowStatement>node).expression);
|
||||
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if (!(<ExportAssignment>node).expression) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// span on export = id
|
||||
return textSpan(node, (<ExportAssignment>node).expression);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
///<reference path='rulesProvider.ts' />
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
|
||||
export interface TextRangeWithKind extends TextRange {
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// <reference path="references.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class FormattingContext {
|
||||
public currentTokenSpan: TextRangeWithKind;
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// <reference path="references.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export const enum FormattingRequestKind {
|
||||
FormatDocument,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference path="formatting.ts"/>
|
||||
/// <reference path="..\..\compiler\scanner.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
let scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
||||
|
||||
|
||||
@@ -1,18 +1,3 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='..\services.ts' />
|
||||
///<reference path='formattingContext.ts' />
|
||||
///<reference path='formattingRequestKind.ts' />
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class Rule {
|
||||
constructor(
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export const enum RuleAction {
|
||||
Ignore = 0x00000001,
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RuleDescriptor {
|
||||
constructor(public LeftTokenRange: Shared.TokenRange, public RightTokenRange: Shared.TokenRange) {
|
||||
|
||||
@@ -1,20 +1,7 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export const enum RuleFlags {
|
||||
None,
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RuleOperation {
|
||||
public Context: RuleOperationContext;
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
|
||||
export class RuleOperationContext {
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class Rules {
|
||||
public getRuleName(rule: Rule) {
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RulesMap {
|
||||
public map: RulesBucket[];
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// <reference path="references.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RulesProvider {
|
||||
private globalRules: Rules;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
///<reference path='..\services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export module SmartIndenter {
|
||||
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export module Shared {
|
||||
export interface ITokenAccess {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* @internal */
|
||||
module ts.NavigateTo {
|
||||
type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration };
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/// <reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.NavigationBar {
|
||||
export function getNavigationBarItems(sourceFile: SourceFile): ts.NavigationBarItem[] {
|
||||
// If the source file has any child items, then it included in the tree
|
||||
|
||||
@@ -1,179 +1,180 @@
|
||||
module ts {
|
||||
export module OutliningElementsCollector {
|
||||
export function collectElements(sourceFile: SourceFile): OutliningSpan[] {
|
||||
let elements: OutliningSpan[] = [];
|
||||
let collapseText = "...";
|
||||
|
||||
function addOutliningSpan(hintSpanNode: Node, startElement: Node, endElement: Node, autoCollapse: boolean) {
|
||||
if (hintSpanNode && startElement && endElement) {
|
||||
let span: OutliningSpan = {
|
||||
textSpan: createTextSpanFromBounds(startElement.pos, endElement.end),
|
||||
hintSpan: createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end),
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse
|
||||
};
|
||||
elements.push(span);
|
||||
}
|
||||
}
|
||||
|
||||
function addOutliningSpanComments(commentSpan: CommentRange, autoCollapse: boolean) {
|
||||
if (commentSpan) {
|
||||
let span: OutliningSpan = {
|
||||
textSpan: createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
|
||||
hintSpan: createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse
|
||||
};
|
||||
elements.push(span);
|
||||
}
|
||||
}
|
||||
|
||||
function addOutliningForLeadingCommentsForNode(n: Node) {
|
||||
let comments = ts.getLeadingCommentRangesOfNode(n, sourceFile);
|
||||
|
||||
if (comments) {
|
||||
let firstSingleLineCommentStart = -1;
|
||||
let lastSingleLineCommentEnd = -1;
|
||||
let isFirstSingleLineComment = true;
|
||||
let singleLineCommentCount = 0;
|
||||
|
||||
for (let currentComment of comments) {
|
||||
|
||||
// For single line comments, combine consecutive ones (2 or more) into
|
||||
// a single span from the start of the first till the end of the last
|
||||
if (currentComment.kind === SyntaxKind.SingleLineCommentTrivia) {
|
||||
if (isFirstSingleLineComment) {
|
||||
firstSingleLineCommentStart = currentComment.pos;
|
||||
}
|
||||
isFirstSingleLineComment = false;
|
||||
lastSingleLineCommentEnd = currentComment.end;
|
||||
singleLineCommentCount++;
|
||||
}
|
||||
else if (currentComment.kind === SyntaxKind.MultiLineCommentTrivia) {
|
||||
combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
|
||||
addOutliningSpanComments(currentComment, /*autoCollapse*/ false);
|
||||
|
||||
singleLineCommentCount = 0;
|
||||
lastSingleLineCommentEnd = -1;
|
||||
isFirstSingleLineComment = true;
|
||||
}
|
||||
}
|
||||
|
||||
combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
|
||||
}
|
||||
}
|
||||
|
||||
function combineAndAddMultipleSingleLineComments(count: number, start: number, end: number) {
|
||||
// Only outline spans of two or more consecutive single line comments
|
||||
if (count > 1) {
|
||||
let multipleSingleLineComments = {
|
||||
pos: start,
|
||||
end: end,
|
||||
kind: SyntaxKind.SingleLineCommentTrivia
|
||||
}
|
||||
|
||||
addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false);
|
||||
}
|
||||
}
|
||||
|
||||
function autoCollapse(node: Node) {
|
||||
return isFunctionBlock(node) && node.parent.kind !== SyntaxKind.ArrowFunction;
|
||||
}
|
||||
|
||||
let depth = 0;
|
||||
let maxDepth = 20;
|
||||
function walk(n: Node): void {
|
||||
if (depth > maxDepth) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDeclaration(n)) {
|
||||
addOutliningForLeadingCommentsForNode(n);
|
||||
}
|
||||
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.Block:
|
||||
if (!isFunctionBlock(n)) {
|
||||
let parent = n.parent;
|
||||
let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
|
||||
// Check if the block is standalone, or 'attached' to some parent statement.
|
||||
// If the latter, we want to collaps the block, but consider its hint span
|
||||
// to be the entire span of the parent.
|
||||
if (parent.kind === SyntaxKind.DoStatement ||
|
||||
parent.kind === SyntaxKind.ForInStatement ||
|
||||
parent.kind === SyntaxKind.ForOfStatement ||
|
||||
parent.kind === SyntaxKind.ForStatement ||
|
||||
parent.kind === SyntaxKind.IfStatement ||
|
||||
parent.kind === SyntaxKind.WhileStatement ||
|
||||
parent.kind === SyntaxKind.WithStatement ||
|
||||
parent.kind === SyntaxKind.CatchClause) {
|
||||
|
||||
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
|
||||
if (parent.kind === SyntaxKind.TryStatement) {
|
||||
// Could be the try-block, or the finally-block.
|
||||
let tryStatement = <TryStatement>parent;
|
||||
if (tryStatement.tryBlock === n) {
|
||||
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
else if (tryStatement.finallyBlock === n) {
|
||||
let finallyKeyword = findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile);
|
||||
if (finallyKeyword) {
|
||||
addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// fall through.
|
||||
}
|
||||
|
||||
// Block was a standalone block. In this case we want to only collapse
|
||||
// the span of the block, independent of any parent span.
|
||||
let span = createTextSpanFromBounds(n.getStart(), n.end);
|
||||
elements.push({
|
||||
textSpan: span,
|
||||
hintSpan: span,
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse(n)
|
||||
});
|
||||
break;
|
||||
}
|
||||
// Fallthrough.
|
||||
|
||||
case SyntaxKind.ModuleBlock: {
|
||||
let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.CaseBlock: {
|
||||
let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
let openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile);
|
||||
let closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
depth++;
|
||||
forEachChild(n, walk);
|
||||
depth--;
|
||||
}
|
||||
|
||||
walk(sourceFile);
|
||||
return elements;
|
||||
}
|
||||
}
|
||||
/* @internal */
|
||||
module ts {
|
||||
export module OutliningElementsCollector {
|
||||
export function collectElements(sourceFile: SourceFile): OutliningSpan[] {
|
||||
let elements: OutliningSpan[] = [];
|
||||
let collapseText = "...";
|
||||
|
||||
function addOutliningSpan(hintSpanNode: Node, startElement: Node, endElement: Node, autoCollapse: boolean) {
|
||||
if (hintSpanNode && startElement && endElement) {
|
||||
let span: OutliningSpan = {
|
||||
textSpan: createTextSpanFromBounds(startElement.pos, endElement.end),
|
||||
hintSpan: createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end),
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse
|
||||
};
|
||||
elements.push(span);
|
||||
}
|
||||
}
|
||||
|
||||
function addOutliningSpanComments(commentSpan: CommentRange, autoCollapse: boolean) {
|
||||
if (commentSpan) {
|
||||
let span: OutliningSpan = {
|
||||
textSpan: createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
|
||||
hintSpan: createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse
|
||||
};
|
||||
elements.push(span);
|
||||
}
|
||||
}
|
||||
|
||||
function addOutliningForLeadingCommentsForNode(n: Node) {
|
||||
let comments = ts.getLeadingCommentRangesOfNode(n, sourceFile);
|
||||
|
||||
if (comments) {
|
||||
let firstSingleLineCommentStart = -1;
|
||||
let lastSingleLineCommentEnd = -1;
|
||||
let isFirstSingleLineComment = true;
|
||||
let singleLineCommentCount = 0;
|
||||
|
||||
for (let currentComment of comments) {
|
||||
|
||||
// For single line comments, combine consecutive ones (2 or more) into
|
||||
// a single span from the start of the first till the end of the last
|
||||
if (currentComment.kind === SyntaxKind.SingleLineCommentTrivia) {
|
||||
if (isFirstSingleLineComment) {
|
||||
firstSingleLineCommentStart = currentComment.pos;
|
||||
}
|
||||
isFirstSingleLineComment = false;
|
||||
lastSingleLineCommentEnd = currentComment.end;
|
||||
singleLineCommentCount++;
|
||||
}
|
||||
else if (currentComment.kind === SyntaxKind.MultiLineCommentTrivia) {
|
||||
combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
|
||||
addOutliningSpanComments(currentComment, /*autoCollapse*/ false);
|
||||
|
||||
singleLineCommentCount = 0;
|
||||
lastSingleLineCommentEnd = -1;
|
||||
isFirstSingleLineComment = true;
|
||||
}
|
||||
}
|
||||
|
||||
combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
|
||||
}
|
||||
}
|
||||
|
||||
function combineAndAddMultipleSingleLineComments(count: number, start: number, end: number) {
|
||||
// Only outline spans of two or more consecutive single line comments
|
||||
if (count > 1) {
|
||||
let multipleSingleLineComments = {
|
||||
pos: start,
|
||||
end: end,
|
||||
kind: SyntaxKind.SingleLineCommentTrivia
|
||||
}
|
||||
|
||||
addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false);
|
||||
}
|
||||
}
|
||||
|
||||
function autoCollapse(node: Node) {
|
||||
return isFunctionBlock(node) && node.parent.kind !== SyntaxKind.ArrowFunction;
|
||||
}
|
||||
|
||||
let depth = 0;
|
||||
let maxDepth = 20;
|
||||
function walk(n: Node): void {
|
||||
if (depth > maxDepth) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDeclaration(n)) {
|
||||
addOutliningForLeadingCommentsForNode(n);
|
||||
}
|
||||
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.Block:
|
||||
if (!isFunctionBlock(n)) {
|
||||
let parent = n.parent;
|
||||
let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
|
||||
// Check if the block is standalone, or 'attached' to some parent statement.
|
||||
// If the latter, we want to collaps the block, but consider its hint span
|
||||
// to be the entire span of the parent.
|
||||
if (parent.kind === SyntaxKind.DoStatement ||
|
||||
parent.kind === SyntaxKind.ForInStatement ||
|
||||
parent.kind === SyntaxKind.ForOfStatement ||
|
||||
parent.kind === SyntaxKind.ForStatement ||
|
||||
parent.kind === SyntaxKind.IfStatement ||
|
||||
parent.kind === SyntaxKind.WhileStatement ||
|
||||
parent.kind === SyntaxKind.WithStatement ||
|
||||
parent.kind === SyntaxKind.CatchClause) {
|
||||
|
||||
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
|
||||
if (parent.kind === SyntaxKind.TryStatement) {
|
||||
// Could be the try-block, or the finally-block.
|
||||
let tryStatement = <TryStatement>parent;
|
||||
if (tryStatement.tryBlock === n) {
|
||||
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
else if (tryStatement.finallyBlock === n) {
|
||||
let finallyKeyword = findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile);
|
||||
if (finallyKeyword) {
|
||||
addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// fall through.
|
||||
}
|
||||
|
||||
// Block was a standalone block. In this case we want to only collapse
|
||||
// the span of the block, independent of any parent span.
|
||||
let span = createTextSpanFromBounds(n.getStart(), n.end);
|
||||
elements.push({
|
||||
textSpan: span,
|
||||
hintSpan: span,
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse(n)
|
||||
});
|
||||
break;
|
||||
}
|
||||
// Fallthrough.
|
||||
|
||||
case SyntaxKind.ModuleBlock: {
|
||||
let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.CaseBlock: {
|
||||
let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
let openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile);
|
||||
let closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
depth++;
|
||||
forEachChild(n, walk);
|
||||
depth--;
|
||||
}
|
||||
|
||||
walk(sourceFile);
|
||||
return elements;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
/* @internal */
|
||||
module ts {
|
||||
// Note(cyrusn): this enum is ordered from strongest match type to weakest match type.
|
||||
export enum PatternMatchKind {
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
|
||||
/// <reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
var debugObjectHost = (<any>this);
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
export interface ScriptSnapshotShim {
|
||||
/** Gets a portion of the script snapshot specified by [start, end). */
|
||||
@@ -341,7 +343,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { message: string; start: number; length: number; category: string; } []{
|
||||
return diagnostics.map(d => realizeDiagnostic(d, newLine));
|
||||
}
|
||||
@@ -862,8 +863,10 @@ module ts {
|
||||
|
||||
|
||||
/// TODO: this is used by VS, clean this up on both sides of the interface
|
||||
/* @internal */
|
||||
module TypeScript.Services {
|
||||
export var TypeScriptServicesFactory = ts.TypeScriptServicesFactory;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
let toolsVersion = "1.4";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///<reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.SignatureHelp {
|
||||
|
||||
// A partially written generic type expression is not guaranteed to have the correct syntax tree. the expression could be parsed as less than/greater than expression or a comma expression
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// These utilities are common to multiple language service features.
|
||||
/* @internal */
|
||||
module ts {
|
||||
export interface ListItemInfo {
|
||||
listItemIndex: number;
|
||||
@@ -500,6 +501,7 @@ module ts {
|
||||
}
|
||||
|
||||
// Display-part writer helpers
|
||||
/* @internal */
|
||||
module ts {
|
||||
export function isFirstDeclarationOfSymbolParameter(symbol: Symbol) {
|
||||
return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter;
|
||||
|
||||
Reference in New Issue
Block a user