Merge branch 'master' of https://github.com/Microsoft/TypeScript into generators

Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
This commit is contained in:
Jason Freeman
2015-05-06 11:42:26 -07:00
38 changed files with 573 additions and 454 deletions
+3 -1
View File
@@ -807,7 +807,9 @@ module ts {
let symbol: Symbol;
if (name.kind === SyntaxKind.Identifier) {
symbol = resolveName(name, (<Identifier>name).text, meaning, Diagnostics.Cannot_find_name_0, <Identifier>name);
let message = meaning === SymbolFlags.Namespace ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0;
symbol = resolveName(name, (<Identifier>name).text, meaning, message, <Identifier>name);
if (!symbol) {
return undefined;
}
@@ -367,8 +367,9 @@ module ts {
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
No_best_common_type_exists_among_yield_expressions: { code: 2503, category: DiagnosticCategory.Error, key: "No best common type exists among yield expressions." },
A_generator_cannot_have_a_void_type_annotation: { code: 2504, category: DiagnosticCategory.Error, key: "A generator cannot have a 'void' type annotation." },
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
No_best_common_type_exists_among_yield_expressions: { code: 2504, category: DiagnosticCategory.Error, key: "No best common type exists among yield expressions." },
A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: DiagnosticCategory.Error, key: "A generator cannot have a 'void' type annotation." },
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}'." },
+6 -2
View File
@@ -1457,13 +1457,17 @@
"category": "Error",
"code": 2502
},
"No best common type exists among yield expressions.": {
"Cannot find namespace '{0}'.": {
"category": "Error",
"code": 2503
},
"No best common type exists among yield expressions.": {
"category": "Error",
"code": 2504
},
"A generator cannot have a 'void' type annotation.": {
"category": "Error",
"code": 2504
"code": 2505
},
"Import declaration '{0}' is using private name '{1}'.": {
+3 -3
View File
@@ -45,10 +45,10 @@ module Utils {
export function getExecutionEnvironment() {
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
return ExecutionEnvironment.CScript;
} else if (process && process.execPath && process.execPath.indexOf("node") !== -1) {
return ExecutionEnvironment.Node;
} else {
} else if (typeof window !== "undefined") {
return ExecutionEnvironment.Browser;
} else {
return ExecutionEnvironment.Node;
}
}
+26 -26
View File
@@ -398,7 +398,7 @@ module ts.server {
export class ProjectService {
filenameToScriptInfo: ts.Map<ScriptInfo> = {};
// open, non-configured root files
// open, non-configured root files
openFileRoots: ScriptInfo[] = [];
// projects built from openFileRoots
inferredProjects: Project[] = [];
@@ -421,7 +421,7 @@ module ts.server {
hostInfo: "Unknown host"
}
}
getFormatCodeOptions(file?: string) {
if (file) {
var info = this.filenameToScriptInfo[file];
@@ -448,7 +448,7 @@ module ts.server {
}
}
}
log(msg: string, type = "Err") {
this.psLogger.msg(msg, type);
}
@@ -457,17 +457,17 @@ module ts.server {
if (args.file) {
var info = this.filenameToScriptInfo[args.file];
if (info) {
info.setFormatOptions(args.formatOptions);
info.setFormatOptions(args.formatOptions);
this.log("Host configuration update for file " + args.file, "Info");
}
}
else {
if (args.hostInfo !== undefined) {
this.hostConfiguration.hostInfo = args.hostInfo;
this.log("Host information " + args.hostInfo, "Info");
this.log("Host information " + args.hostInfo, "Info");
}
if (args.formatOptions) {
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
this.log("Format host information updated", "Info");
}
}
@@ -487,7 +487,7 @@ module ts.server {
fileDeletedInFilesystem(info: ScriptInfo) {
this.psLogger.info(info.fileName + " deleted");
if (info.fileWatcher) {
info.fileWatcher.close();
info.fileWatcher = undefined;
@@ -537,7 +537,7 @@ module ts.server {
}
return false;
}
addOpenFile(info: ScriptInfo) {
if (this.setConfiguredProjectRoot(info)) {
this.openFileRootsConfigured.push(info);
@@ -561,7 +561,7 @@ module ts.server {
copyListRemovingItem(r.defaultProject, this.inferredProjects);
// put r in referenced open file list
this.openFilesReferenced.push(r);
// set default project of r to the new project
// set default project of r to the new project
r.defaultProject = info.defaultProject;
}
else {
@@ -694,7 +694,7 @@ module ts.server {
this.openFilesReferenced = openFilesReferenced;
// Then, loop through all of the open files that are project roots.
// For each root file, note the project that it roots. Then see if
// For each root file, note the project that it roots. Then see if
// any other projects newly reference the file. If zero projects
// newly reference the file, keep it as a root. If one or more
// projects newly references the file, remove its project from the
@@ -719,7 +719,7 @@ module ts.server {
// Finally, if we found any open, referenced files that are no longer
// referenced by their default project, treat them as newly opened
// by the editor.
// by the editor.
for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) {
this.addOpenFile(unattachedOpenFiles[i]);
}
@@ -809,7 +809,7 @@ module ts.server {
}
else {
this.log("Opened configuration file " + configFileName,"Info");
this.configuredProjects.push(configResult.project);
this.configuredProjects.push(configResult.project);
}
}
var info = this.openFile(fileName, true);
@@ -901,22 +901,22 @@ module ts.server {
}
return false;
}
openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult {
configFilename = ts.normalizePath(configFilename);
// file references will be relative to dirPath (or absolute)
var dirPath = ts.getDirectoryPath(configFilename);
var rawConfig = <ProjectOptions>ts.readConfigFile(configFilename);
if (!rawConfig) {
return { errorMsg: "tsconfig syntax error" };
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.readConfigFile(configFilename);
if (rawConfig.error) {
return rawConfig.error;
}
else {
var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath);
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath);
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
return { errorMsg: "tsconfig option errors" };
}
else if (parsedCommandLine.fileNames) {
var projectOptions: ProjectOptions = {
var projectOptions: ProjectOptions = {
files: parsedCommandLine.fileNames,
compilerOptions: parsedCommandLine.options
};
@@ -1040,7 +1040,7 @@ module ts.server {
startPath: LineCollection[];
endBranch: LineCollection[] = [];
branchNode: LineNode;
// path to current node
// path to current node
stack: LineNode[];
state = CharRangeSection.Entire;
lineCollectionAtBranch: LineCollection;
@@ -1242,7 +1242,7 @@ module ts.server {
}
}
// text change information
// text change information
class TextChange {
constructor(public pos: number, public deleteLen: number, public insertedText?: string) {
}
@@ -1290,7 +1290,7 @@ module ts.server {
if (cb)
cb();
}
// reload whole script, leaving no change history behind reload
reload(script: string) {
this.currentVersion++;
@@ -1300,7 +1300,7 @@ module ts.server {
snap.index = new LineIndex();
var lm = LineIndex.linesFromText(script);
snap.index.load(lm.lines);
// REVIEW: could use linked list
// REVIEW: could use linked list
for (var i = this.minVersion; i < this.currentVersion; i++) {
this.versions[i] = undefined;
}
@@ -1381,7 +1381,7 @@ module ts.server {
return this.index.root.charCount();
}
// this requires linear space so don't hold on to these
// this requires linear space so don't hold on to these
getLineStartPositions(): number[] {
var starts: number[] = [-1];
var count = 1;
@@ -1643,7 +1643,7 @@ module ts.server {
}
walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) {
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
var childIndex = 0;
var child = this.children[0];
var childCharCount = child.charCount();
@@ -1729,7 +1729,7 @@ module ts.server {
line: lineNumber,
offset: charOffset
}
}
}
else if (childInfo.child.isLeaf()) {
return {
line: lineNumber,
@@ -1917,4 +1917,4 @@ module ts.server {
return 1;
}
}
}
}
+13 -13
View File
@@ -1,6 +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
@@ -83,7 +83,7 @@ module ts {
export interface Shim {
dispose(dummy: any): void;
}
export interface LanguageServiceShim extends Shim {
languageService: LanguageService;
@@ -145,7 +145,7 @@ module ts {
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[]
*/
getReferencesAtPosition(fileName: string, position: number): string;
/**
* Returns a JSON-encoded value of the type:
* { definition: <encoded>; references: <encoded>[] }[]
@@ -162,8 +162,8 @@ module ts {
/**
* Returns a JSON-encoded value of the type:
* { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[]
*
* @param fileToSearch A JSON encoded string[] containing the file names that should be
*
* @param fileToSearch A JSON encoded string[] containing the file names that should be
* considered when searching.
*/
getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string;
@@ -244,7 +244,7 @@ module ts {
export class LanguageServiceShimHostAdapter implements LanguageServiceHost {
private files: string[];
constructor(private shimHost: LanguageServiceShimHost) {
}
@@ -255,7 +255,7 @@ module ts {
public trace(s: string): void {
this.shimHost.trace(s);
}
public error(s: string): void {
this.shimHost.error(s);
}
@@ -322,7 +322,7 @@ module ts {
}
}
}
export class CoreServicesShimHostAdapter implements ParseConfigHost {
constructor(private shimHost: CoreServicesShimHost) {
@@ -587,7 +587,7 @@ module ts {
/**
* Computes the definition location and file for the symbol
* at the requested position.
* at the requested position.
*/
public getDefinitionAtPosition(fileName: string, position: number): string {
return this.forwardJSONCall(
@@ -601,7 +601,7 @@ module ts {
/**
* Computes the definition location of the type of the symbol
* at the requested position.
* at the requested position.
*/
public getTypeDefinitionAtPosition(fileName: string, position: number): string {
return this.forwardJSONCall(
@@ -684,8 +684,8 @@ module ts {
/// COMPLETION LISTS
/**
* Get a string based representation of the completions
* to provide at the given source position and providing a member completion
* Get a string based representation of the completions
* to provide at the given source position and providing a member completion
* list if requested.
*/
public getCompletionsAtPosition(fileName: string, position: number) {
@@ -883,7 +883,7 @@ module ts {
return {
options: configFile.options,
files: configFile.fileNames,
errors: realizeDiagnostics(configFile.errors, '\r\n')
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
};
});
}