Merge branch 'master' into emitArrowFunctionES6

This commit is contained in:
Yui T
2015-01-30 17:53:48 -08:00
11 changed files with 1717 additions and 830 deletions

1195
bin/tsc.js

File diff suppressed because it is too large Load Diff

16
bin/typescript.d.ts vendored
View File

@@ -283,6 +283,11 @@ declare module "typescript" {
ThisNodeOrAnySubNodesHasError = 32,
HasAggregatedChildData = 64,
}
const enum RelationComparisonResult {
Succeeded = 1,
Failed = 2,
FailedAndReported = 3,
}
interface Node extends TextRange {
kind: SyntaxKind;
flags: NodeFlags;
@@ -994,11 +999,15 @@ declare module "typescript" {
Union = 16384,
Anonymous = 32768,
FromSignature = 65536,
Unwidened = 131072,
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
RequiresWidening = 786432,
}
interface Type {
flags: TypeFlags;
@@ -1123,6 +1132,7 @@ declare module "typescript" {
diagnostics?: boolean;
emitBOM?: boolean;
help?: boolean;
listFiles?: boolean;
locale?: string;
mapRoot?: string;
module?: ModuleKind;
@@ -1136,6 +1146,7 @@ declare module "typescript" {
out?: string;
outDir?: string;
preserveConstEnums?: boolean;
project?: string;
removeComments?: boolean;
sourceMap?: boolean;
sourceRoot?: string;
@@ -1168,6 +1179,7 @@ declare module "typescript" {
interface CommandLineOption {
name: string;
type: string | Map<number>;
isFilePath?: boolean;
shortName?: string;
description?: DiagnosticMessage;
paramType?: DiagnosticMessage;
@@ -1428,6 +1440,7 @@ declare module "typescript" {
isOpen: boolean;
version: string;
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
}
/**
@@ -1470,6 +1483,7 @@ declare module "typescript" {
}
interface LanguageServiceHost extends Logger {
getCompilationSettings(): CompilerOptions;
getNewLine?(): string;
getScriptFileNames(): string[];
getScriptVersion(fileName: string): string;
getScriptIsOpen(fileName: string): boolean;

View File

@@ -283,6 +283,11 @@ declare module ts {
ThisNodeOrAnySubNodesHasError = 32,
HasAggregatedChildData = 64,
}
const enum RelationComparisonResult {
Succeeded = 1,
Failed = 2,
FailedAndReported = 3,
}
interface Node extends TextRange {
kind: SyntaxKind;
flags: NodeFlags;
@@ -994,11 +999,15 @@ declare module ts {
Union = 16384,
Anonymous = 32768,
FromSignature = 65536,
Unwidened = 131072,
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
RequiresWidening = 786432,
}
interface Type {
flags: TypeFlags;
@@ -1123,6 +1132,7 @@ declare module ts {
diagnostics?: boolean;
emitBOM?: boolean;
help?: boolean;
listFiles?: boolean;
locale?: string;
mapRoot?: string;
module?: ModuleKind;
@@ -1136,6 +1146,7 @@ declare module ts {
out?: string;
outDir?: string;
preserveConstEnums?: boolean;
project?: string;
removeComments?: boolean;
sourceMap?: boolean;
sourceRoot?: string;
@@ -1168,6 +1179,7 @@ declare module ts {
interface CommandLineOption {
name: string;
type: string | Map<number>;
isFilePath?: boolean;
shortName?: string;
description?: DiagnosticMessage;
paramType?: DiagnosticMessage;
@@ -1428,6 +1440,7 @@ declare module ts {
isOpen: boolean;
version: string;
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
}
/**
@@ -1470,6 +1483,7 @@ declare module ts {
}
interface LanguageServiceHost extends Logger {
getCompilationSettings(): CompilerOptions;
getNewLine?(): string;
getScriptFileNames(): string[];
getScriptVersion(fileName: string): string;
getScriptIsOpen(fileName: string): boolean;

File diff suppressed because it is too large Load Diff

View File

@@ -44,6 +44,7 @@ declare module ts {
function getProperty<T>(map: Map<T>, key: string): T;
function isEmpty<T>(map: Map<T>): boolean;
function clone<T>(object: T): T;
function extend<T>(first: Map<T>, second: Map<T>): Map<T>;
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
function lookUp<T>(map: Map<T>, key: string): T;
@@ -125,6 +126,7 @@ declare module ts {
createDirectory(directoryName: string): void;
getExecutingFilePath(): string;
getCurrentDirectory(): string;
readDirectory(path: string, extension?: string): string[];
getMemoryUsage?(): number;
exit(exitCode?: number): void;
}
@@ -186,7 +188,7 @@ declare module ts {
function isObjectLiteralMethod(node: Node): boolean;
function getContainingFunction(node: Node): FunctionLikeDeclaration;
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
function getSuperContainer(node: Node): Node;
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
function getInvokedExpression(node: CallLikeExpression): Expression;
function isExpression(node: Node): boolean;
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
@@ -244,6 +246,8 @@ declare module ts {
declare module ts {
var optionDeclarations: CommandLineOption[];
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
function readConfigFile(filename: string): any;
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
}
declare module ts {
interface ListItemInfo {

View File

@@ -44,6 +44,7 @@ declare module "typescript" {
function getProperty<T>(map: Map<T>, key: string): T;
function isEmpty<T>(map: Map<T>): boolean;
function clone<T>(object: T): T;
function extend<T>(first: Map<T>, second: Map<T>): Map<T>;
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
function lookUp<T>(map: Map<T>, key: string): T;
@@ -125,6 +126,7 @@ declare module "typescript" {
createDirectory(directoryName: string): void;
getExecutingFilePath(): string;
getCurrentDirectory(): string;
readDirectory(path: string, extension?: string): string[];
getMemoryUsage?(): number;
exit(exitCode?: number): void;
}
@@ -186,7 +188,7 @@ declare module "typescript" {
function isObjectLiteralMethod(node: Node): boolean;
function getContainingFunction(node: Node): FunctionLikeDeclaration;
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
function getSuperContainer(node: Node): Node;
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
function getInvokedExpression(node: CallLikeExpression): Expression;
function isExpression(node: Node): boolean;
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
@@ -244,6 +246,8 @@ declare module "typescript" {
declare module "typescript" {
var optionDeclarations: CommandLineOption[];
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
function readConfigFile(filename: string): any;
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
}
declare module "typescript" {
interface ListItemInfo {

View File

@@ -1,46 +1,46 @@
{
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "1.4.0",
"licenses": [
{
"type": "Apache License 2.0",
"url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt"
}
],
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript"
],
"bugs": {
"url" : "https://github.com/Microsoft/TypeScript/issues"
},
"repository" : {
"type" : "git",
"url" : "https://github.com/Microsoft/TypeScript.git"
},
"preferGlobal" : true,
"main" : "./bin/typescriptServices.js",
"bin" : {
"tsc" : "./bin/tsc"
},
"engines" : {
"node" : ">=0.8.0"
},
"devDependencies": {
"jake" : "latest",
"mocha" : "latest",
"chai" : "latest",
"browserify" : "latest",
"istanbul": "latest",
"codeclimate-test-reporter": "latest"
},
"scripts": {
"test": "jake generate-code-coverage"
}
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "1.5.0",
"licenses": [
{
"type": "Apache License 2.0",
"url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt"
}
],
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript"
],
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/TypeScript.git"
},
"preferGlobal": true,
"main": "./bin/typescriptServices.js",
"bin": {
"tsc": "./bin/tsc"
},
"engines": {
"node": ">=0.8.0"
},
"devDependencies": {
"jake": "latest",
"mocha": "latest",
"chai": "latest",
"browserify": "latest",
"istanbul": "latest",
"codeclimate-test-reporter": "latest"
},
"scripts": {
"test": "jake generate-code-coverage"
}
}

View File

@@ -2,7 +2,7 @@
/// <reference path="commandLineParser.ts"/>
module ts {
var version = "1.4.0.0";
var version = "1.5.0.0";
export interface SourceFile {
fileWatcher: FileWatcher;

View File

@@ -50,8 +50,9 @@ module ts.NavigationBar {
case SyntaxKind.ArrayBindingPattern:
forEach((<BindingPattern>node).elements, visit);
break;
case SyntaxKind.BindingElement:
case SyntaxKind.VariableDeclaration:
if (isBindingPattern(node)) {
if (isBindingPattern((<VariableDeclaration>node).name)) {
visit((<VariableDeclaration>node).name);
break;
}
@@ -262,17 +263,34 @@ module ts.NavigationBar {
return createItem(node, getTextOfNode((<FunctionLikeDeclaration>node).name), ts.ScriptElementKind.functionElement);
case SyntaxKind.VariableDeclaration:
if (isBindingPattern((<VariableDeclaration>node).name)) {
break;
}
if (isConst(node)) {
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.constElement);
}
else if (isLet(node)) {
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.letElement);
case SyntaxKind.BindingElement:
var variableDeclarationNode: Node;
var name: Node;
if (node.kind === SyntaxKind.BindingElement) {
name = (<BindingElement>node).name;
variableDeclarationNode = node;
// binding elements are added only for variable declarations
// bubble up to the containing variable declaration
while (variableDeclarationNode && variableDeclarationNode.kind !== SyntaxKind.VariableDeclaration) {
variableDeclarationNode = variableDeclarationNode.parent;
}
Debug.assert(variableDeclarationNode !== undefined);
}
else {
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.variableElement);
Debug.assert(!isBindingPattern((<VariableDeclaration>node).name));
variableDeclarationNode = node;
name = (<VariableDeclaration>node).name;
}
if (isConst(variableDeclarationNode)) {
return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement);
}
else if (isLet(variableDeclarationNode)) {
return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement);
}
else {
return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement);
}
case SyntaxKind.Constructor:

View File

@@ -9,7 +9,7 @@
/// <reference path='formatting\smartIndenter.ts' />
module ts {
export var servicesVersion = "0.4"
export var servicesVersion = "0.5"
export interface Node {
getSourceFile(): SourceFile;

View File

@@ -0,0 +1,21 @@
/// <reference path='fourslash.ts'/>
////'use strict'
////var foo, {}
////var bar, []
////let foo1, {a, b}
////const bar1, [c, d]
////var {e, x: [f, g]} = {a:1, x:[]};
verify.getScriptLexicalStructureListCount(12); // global (1) + variable declarations (4) + binding patterns (7)
verify.getScriptLexicalStructureListContains("foo", "var");
verify.getScriptLexicalStructureListContains("bar", "var");
verify.getScriptLexicalStructureListContains("foo1", "let")
verify.getScriptLexicalStructureListContains("a", "let");
verify.getScriptLexicalStructureListContains("b", "let");
verify.getScriptLexicalStructureListContains("bar1", "const");
verify.getScriptLexicalStructureListContains("c", "const");
verify.getScriptLexicalStructureListContains("d", "const");
verify.getScriptLexicalStructureListContains("e", "var");
verify.getScriptLexicalStructureListContains("f", "var");
verify.getScriptLexicalStructureListContains("g", "var");