merge with master

This commit is contained in:
Vladimir Matveev
2015-08-27 17:15:49 -07:00
69 changed files with 2631 additions and 288 deletions

View File

@@ -30,6 +30,11 @@ namespace ts {
type: "boolean",
description: Diagnostics.Print_this_message,
},
{
name: "init",
type: "boolean",
description: Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,
},
{
name: "inlineSourceMap",
type: "boolean",
@@ -179,6 +184,12 @@ namespace ts {
description: Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
paramType: Diagnostics.LOCATION,
},
{
name: "suppressExcessPropertyErrors",
type: "boolean",
description: Diagnostics.Suppress_excess_property_checks_for_object_literals,
experimental: true
},
{
name: "suppressImplicitAnyIndexErrors",
type: "boolean",
@@ -237,19 +248,38 @@ namespace ts {
}
];
export function parseCommandLine(commandLine: string[], readFile?: (fileName: string) => string): ParsedCommandLine {
let options: CompilerOptions = {};
let fileNames: string[] = [];
let errors: Diagnostic[] = [];
let shortOptionNames: Map<string> = {};
/* @internal */
export interface OptionNameMap {
optionNameMap: Map<CommandLineOption>;
shortOptionNames: Map<string>;
}
let optionNameMapCache: OptionNameMap;
/* @internal */
export function getOptionNameMap(): OptionNameMap {
if (optionNameMapCache) {
return optionNameMapCache;
}
let optionNameMap: Map<CommandLineOption> = {};
let shortOptionNames: Map<string> = {};
forEach(optionDeclarations, option => {
optionNameMap[option.name.toLowerCase()] = option;
if (option.shortName) {
shortOptionNames[option.shortName] = option.name;
}
});
optionNameMapCache = { optionNameMap, shortOptionNames };
return optionNameMapCache;
}
export function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine {
let options: CompilerOptions = {};
let fileNames: string[] = [];
let errors: Diagnostic[] = [];
let { optionNameMap, shortOptionNames } = getOptionNameMap();
parseStrings(commandLine);
return {
options,
@@ -313,7 +343,7 @@ namespace ts {
}
function parseResponseFile(fileName: string) {
let text = readFile ? readFile(fileName): sys.readFile(fileName);
let text = readFile ? readFile(fileName) : sys.readFile(fileName);
if (!text) {
errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, fileName));
@@ -466,4 +496,4 @@ namespace ts {
return fileNames;
}
}
}
}