mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript
This commit is contained in:
+31
-49
@@ -2516,10 +2516,11 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getDeclaredTypeOfClass(symbol: Symbol): InterfaceType {
|
||||
function getDeclaredTypeOfClassOrInterface(symbol: Symbol): InterfaceType {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
let type = links.declaredType = <InterfaceType>createObjectType(TypeFlags.Class, symbol);
|
||||
let kind = symbol.flags & SymbolFlags.Class ? TypeFlags.Class : TypeFlags.Interface;
|
||||
let type = links.declaredType = <InterfaceType>createObjectType(kind, symbol);
|
||||
let typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= TypeFlags.Reference;
|
||||
@@ -2529,35 +2530,6 @@ module ts {
|
||||
(<GenericType>type).target = <GenericType>type;
|
||||
(<GenericType>type).typeArguments = type.typeParameters;
|
||||
}
|
||||
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = emptyArray;
|
||||
type.declaredConstructSignatures = emptyArray;
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
||||
}
|
||||
return <InterfaceType>links.declaredType;
|
||||
}
|
||||
|
||||
function getDeclaredTypeOfInterface(symbol: Symbol): InterfaceType {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
let type = links.declaredType = <InterfaceType>createObjectType(TypeFlags.Interface, symbol);
|
||||
let typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= TypeFlags.Reference;
|
||||
type.typeParameters = typeParameters;
|
||||
(<GenericType>type).instantiations = {};
|
||||
(<GenericType>type).instantiations[getTypeListId(type.typeParameters)] = <GenericType>type;
|
||||
(<GenericType>type).target = <GenericType>type;
|
||||
(<GenericType>type).typeArguments = type.typeParameters;
|
||||
}
|
||||
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
||||
}
|
||||
return <InterfaceType>links.declaredType;
|
||||
}
|
||||
@@ -2613,11 +2585,8 @@ module ts {
|
||||
|
||||
function getDeclaredTypeOfSymbol(symbol: Symbol): Type {
|
||||
Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0);
|
||||
if (symbol.flags & SymbolFlags.Class) {
|
||||
return getDeclaredTypeOfClass(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.Interface) {
|
||||
return getDeclaredTypeOfInterface(symbol);
|
||||
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
return getDeclaredTypeOfClassOrInterface(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.TypeAlias) {
|
||||
return getDeclaredTypeOfTypeAlias(symbol);
|
||||
@@ -2666,15 +2635,28 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers {
|
||||
if (!(<InterfaceTypeWithDeclaredMembers>type).declaredProperties) {
|
||||
var symbol = type.symbol;
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(symbol.members);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
||||
}
|
||||
return <InterfaceTypeWithDeclaredMembers>type;
|
||||
}
|
||||
|
||||
function resolveClassOrInterfaceMembers(type: InterfaceType): void {
|
||||
let members = type.symbol.members;
|
||||
let callSignatures = type.declaredCallSignatures;
|
||||
let constructSignatures = type.declaredConstructSignatures;
|
||||
let stringIndexType = type.declaredStringIndexType;
|
||||
let numberIndexType = type.declaredNumberIndexType;
|
||||
let baseTypes = getBaseTypes(type);
|
||||
let target = resolveDeclaredMembers(type);
|
||||
let members = target.symbol.members;
|
||||
let callSignatures = target.declaredCallSignatures;
|
||||
let constructSignatures = target.declaredConstructSignatures;
|
||||
let stringIndexType = target.declaredStringIndexType;
|
||||
let numberIndexType = target.declaredNumberIndexType;
|
||||
let baseTypes = getBaseTypes(target);
|
||||
if (baseTypes.length) {
|
||||
members = createSymbolTable(type.declaredProperties);
|
||||
members = createSymbolTable(target.declaredProperties);
|
||||
for (let baseType of baseTypes) {
|
||||
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
||||
callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call));
|
||||
@@ -2687,7 +2669,7 @@ module ts {
|
||||
}
|
||||
|
||||
function resolveTypeReferenceMembers(type: TypeReference): void {
|
||||
let target = type.target;
|
||||
let target = resolveDeclaredMembers(type.target);
|
||||
let mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
||||
let members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
||||
let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
||||
@@ -2843,7 +2825,7 @@ module ts {
|
||||
callSignatures = getSignaturesOfSymbol(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.Class) {
|
||||
let classType = getDeclaredTypeOfClass(symbol);
|
||||
let classType = getDeclaredTypeOfClassOrInterface(symbol);
|
||||
constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]);
|
||||
if (!constructSignatures.length) {
|
||||
constructSignatures = getDefaultConstructSignatures(classType);
|
||||
@@ -2956,7 +2938,7 @@ module ts {
|
||||
let type = getApparentType(current);
|
||||
if (type !== unknownType) {
|
||||
let prop = getPropertyOfType(type, name);
|
||||
if (!prop) {
|
||||
if (!prop || getDeclarationFlagsFromSymbol(prop) & (NodeFlags.Private | NodeFlags.Protected)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!props) {
|
||||
@@ -3084,7 +3066,7 @@ module ts {
|
||||
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
|
||||
let links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClass((<ClassDeclaration>declaration.parent).symbol) : undefined;
|
||||
let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClassOrInterface((<ClassDeclaration>declaration.parent).symbol) : undefined;
|
||||
let typeParameters = classType ? classType.typeParameters :
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
|
||||
let parameters: Symbol[] = [];
|
||||
@@ -9367,7 +9349,7 @@ module ts {
|
||||
}
|
||||
|
||||
if (node.condition) checkExpression(node.condition);
|
||||
if (node.iterator) checkExpression(node.iterator);
|
||||
if (node.incrementor) checkExpression(node.incrementor);
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
|
||||
@@ -10152,7 +10134,7 @@ module ts {
|
||||
}
|
||||
|
||||
let seen: Map<{ prop: Symbol; containingType: Type }> = {};
|
||||
forEach(type.declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; });
|
||||
forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; });
|
||||
let ok = true;
|
||||
|
||||
for (let base of baseTypes) {
|
||||
|
||||
@@ -50,11 +50,12 @@ module ts {
|
||||
shortName: "m",
|
||||
type: {
|
||||
"commonjs": ModuleKind.CommonJS,
|
||||
"amd": ModuleKind.AMD
|
||||
"amd": ModuleKind.AMD,
|
||||
"umd": ModuleKind.UMD
|
||||
},
|
||||
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd,
|
||||
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd,
|
||||
paramType: Diagnostics.KIND,
|
||||
error: Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd
|
||||
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
@@ -150,7 +151,7 @@ module ts {
|
||||
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES6 },
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: Diagnostics.VERSION,
|
||||
error: Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
|
||||
@@ -161,7 +161,7 @@ module ts {
|
||||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
|
||||
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_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
|
||||
Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." },
|
||||
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
@@ -463,7 +463,7 @@ module ts {
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." },
|
||||
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." },
|
||||
@@ -484,8 +484,8 @@ module ts {
|
||||
Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
|
||||
Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." },
|
||||
Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." },
|
||||
Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." },
|
||||
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
|
||||
@@ -631,7 +631,7 @@
|
||||
"category": "Error",
|
||||
"code": 1203
|
||||
},
|
||||
"Cannot compile external modules into amd or commonjs when targeting es6 or higher.": {
|
||||
"Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.": {
|
||||
"category": "Error",
|
||||
"code": 1204
|
||||
},
|
||||
@@ -1840,7 +1840,7 @@
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
"Specify module code generation: 'commonjs' or 'amd'": {
|
||||
"Specify module code generation: 'commonjs', 'amd', or 'umd'.": {
|
||||
"category": "Message",
|
||||
"code": 6016
|
||||
},
|
||||
@@ -1924,11 +1924,11 @@
|
||||
"category": "Error",
|
||||
"code": 6045
|
||||
},
|
||||
"Argument for '--module' option must be 'commonjs' or 'amd'.": {
|
||||
"Argument for '--module' option must be 'commonjs', 'amd', or 'umd'.": {
|
||||
"category": "Error",
|
||||
"code": 6046
|
||||
},
|
||||
"Argument for '--target' option must be 'es3', 'es5', or 'es6'.": {
|
||||
"Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'.": {
|
||||
"category": "Error",
|
||||
"code": 6047
|
||||
},
|
||||
|
||||
+51
-19
@@ -2138,7 +2138,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
write(";");
|
||||
emitOptional(" ", node.condition);
|
||||
write(";");
|
||||
emitOptional(" ", node.iterator);
|
||||
emitOptional(" ", node.incrementor);
|
||||
write(")");
|
||||
emitEmbeddedStatement(node.statement);
|
||||
}
|
||||
@@ -4645,27 +4645,25 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
}
|
||||
}
|
||||
|
||||
function emitAMDModule(node: SourceFile, startIndex: number) {
|
||||
collectExternalModuleInfo(node);
|
||||
|
||||
function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean) {
|
||||
// An AMD define function has the following shape:
|
||||
// define(id?, dependencies?, factory);
|
||||
//
|
||||
// This has the shape of
|
||||
// define(name, ["module1", "module2"], function (module1Alias) {
|
||||
// The location of the alias in the parameter list in the factory function needs to
|
||||
// The location of the alias in the parameter list in the factory function needs to
|
||||
// match the position of the module name in the dependency list.
|
||||
//
|
||||
// To ensure this is true in cases of modules with no aliases, e.g.:
|
||||
// `import "module"` or `<amd-dependency path= "a.css" />`
|
||||
// To ensure this is true in cases of modules with no aliases, e.g.:
|
||||
// `import "module"` or `<amd-dependency path= "a.css" />`
|
||||
// we need to add modules without alias names to the end of the dependencies list
|
||||
|
||||
let aliasedModuleNames: string[] = []; // names of modules with corresponding parameter in the
|
||||
|
||||
let aliasedModuleNames: string[] = []; // names of modules with corresponding parameter in the
|
||||
// factory function.
|
||||
let unaliasedModuleNames: string[] = []; // names of modules with no corresponding parameters in
|
||||
// factory function.
|
||||
let importAliasNames: string[] = []; // names of the parameters in the factory function; these
|
||||
// paramters need to match the indexes of the corresponding
|
||||
let importAliasNames: string[] = []; // names of the parameters in the factory function; these
|
||||
// parameters need to match the indexes of the corresponding
|
||||
// module names in aliasedModuleNames.
|
||||
|
||||
// Fill in amd-dependency tags
|
||||
@@ -4687,7 +4685,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
externalModuleName = getLiteralText(<LiteralExpression>moduleName);
|
||||
}
|
||||
|
||||
// Find the name of the module alais, if there is one
|
||||
// Find the name of the module alias, if there is one
|
||||
let importAliasName: string;
|
||||
let namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
||||
if (namespaceDeclaration && !isDefaultImport(importNode)) {
|
||||
@@ -4697,7 +4695,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
importAliasName = getGeneratedNameForNode(<ImportDeclaration | ExportDeclaration>importNode);
|
||||
}
|
||||
|
||||
if (importAliasName) {
|
||||
if (includeNonAmdDependencies && importAliasName) {
|
||||
aliasedModuleNames.push(externalModuleName);
|
||||
importAliasNames.push(importAliasName);
|
||||
}
|
||||
@@ -4705,12 +4703,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
unaliasedModuleNames.push(externalModuleName);
|
||||
}
|
||||
}
|
||||
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
|
||||
write("[\"require\", \"exports\"");
|
||||
if (aliasedModuleNames.length) {
|
||||
write(", ");
|
||||
@@ -4725,6 +4718,17 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
write(", ");
|
||||
write(importAliasNames.join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
function emitAMDModule(node: SourceFile, startIndex: number) {
|
||||
collectExternalModuleInfo(node);
|
||||
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
emitAMDDependencies(node, /*includeNonAmdDependencies*/ true);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
@@ -4746,6 +4750,31 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
emitExportEquals(/*emitAsReturn*/ false);
|
||||
}
|
||||
|
||||
function emitUMDModule(node: SourceFile, startIndex: number) {
|
||||
collectExternalModuleInfo(node);
|
||||
|
||||
// Module is detected first to support Browserify users that load into a browser with an AMD loader
|
||||
writeLines(`(function (deps, factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(deps, factory);
|
||||
}
|
||||
})(`);
|
||||
emitAMDDependencies(node, false);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
emitExportEquals(/*emitAsReturn*/ true);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
}
|
||||
|
||||
function emitES6Module(node: SourceFile, startIndex: number) {
|
||||
externalImports = undefined;
|
||||
exportSpecifiers = undefined;
|
||||
@@ -4830,6 +4859,9 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
else if (compilerOptions.module === ModuleKind.AMD) {
|
||||
emitAMDModule(node, startIndex);
|
||||
}
|
||||
else if (compilerOptions.module === ModuleKind.UMD) {
|
||||
emitUMDModule(node, startIndex);
|
||||
}
|
||||
else {
|
||||
emitCommonJSModule(node, startIndex);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ module ts {
|
||||
case SyntaxKind.ForStatement:
|
||||
return visitNode(cbNode, (<ForStatement>node).initializer) ||
|
||||
visitNode(cbNode, (<ForStatement>node).condition) ||
|
||||
visitNode(cbNode, (<ForStatement>node).iterator) ||
|
||||
visitNode(cbNode, (<ForStatement>node).incrementor) ||
|
||||
visitNode(cbNode, (<ForStatement>node).statement);
|
||||
case SyntaxKind.ForInStatement:
|
||||
return visitNode(cbNode, (<ForInStatement>node).initializer) ||
|
||||
@@ -3497,7 +3497,7 @@ module ts {
|
||||
}
|
||||
parseExpected(SyntaxKind.SemicolonToken);
|
||||
if (token !== SyntaxKind.CloseParenToken) {
|
||||
forStatement.iterator = allowInAnd(parseExpression);
|
||||
forStatement.incrementor = allowInAnd(parseExpression);
|
||||
}
|
||||
parseExpected(SyntaxKind.CloseParenToken);
|
||||
forOrForInOrForOfStatement = forStatement;
|
||||
|
||||
@@ -567,7 +567,7 @@ module ts {
|
||||
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= ScriptTarget.ES6) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
|
||||
// there has to be common source directory if user specified --outdir || --sourceRoot
|
||||
|
||||
@@ -795,7 +795,7 @@ module ts {
|
||||
export interface ForStatement extends IterationStatement {
|
||||
initializer?: VariableDeclarationList | Expression;
|
||||
condition?: Expression;
|
||||
iterator?: Expression;
|
||||
incrementor?: Expression;
|
||||
}
|
||||
|
||||
export interface ForInStatement extends IterationStatement {
|
||||
@@ -1489,6 +1489,13 @@ module ts {
|
||||
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
||||
export interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[]; // Declared members
|
||||
declaredCallSignatures: Signature[]; // Declared call signatures
|
||||
declaredConstructSignatures: Signature[]; // Declared construct signatures
|
||||
@@ -1496,10 +1503,6 @@ module ts {
|
||||
declaredNumberIndexType: Type; // Declared numeric index type
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
|
||||
// Type references (TypeFlags.Reference)
|
||||
export interface TypeReference extends ObjectType {
|
||||
target: GenericType; // Type reference target
|
||||
@@ -1675,6 +1678,7 @@ module ts {
|
||||
None = 0,
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
}
|
||||
|
||||
export interface LineAndCharacter {
|
||||
|
||||
@@ -775,7 +775,7 @@ module ts {
|
||||
let forStatement = <ForStatement>parent;
|
||||
return (forStatement.initializer === node && forStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) ||
|
||||
forStatement.condition === node ||
|
||||
forStatement.iterator === node;
|
||||
forStatement.incrementor === node;
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
let forInStatement = <ForInStatement | ForOfStatement>parent;
|
||||
|
||||
@@ -957,6 +957,8 @@ module Harness {
|
||||
if (typeof setting.value === 'string') {
|
||||
if (setting.value.toLowerCase() === 'amd') {
|
||||
options.module = ts.ModuleKind.AMD;
|
||||
} else if (setting.value.toLowerCase() === 'umd') {
|
||||
options.module = ts.ModuleKind.UMD;
|
||||
} else if (setting.value.toLowerCase() === 'commonjs') {
|
||||
options.module = ts.ModuleKind.CommonJS;
|
||||
} else if (setting.value.toLowerCase() === 'unspecified') {
|
||||
|
||||
Vendored
+1
-1
@@ -546,7 +546,7 @@ interface Math {
|
||||
*/
|
||||
atan(x: number): number;
|
||||
/**
|
||||
* Returns the angle (in radians) from the X axis to a point (y,x).
|
||||
* Returns the angle (in radians) from the X axis to a point.
|
||||
* @param y A numeric expression representing the cartesian y-coordinate.
|
||||
* @param x A numeric expression representing the cartesian x-coordinate.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -442,7 +442,7 @@ interface IteratorResult<T> {
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(): IteratorResult<T>;
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
|
||||
@@ -401,8 +401,8 @@ module ts.BreakpointResolver {
|
||||
if (forStatement.condition) {
|
||||
return textSpan(forStatement.condition);
|
||||
}
|
||||
if (forStatement.iterator) {
|
||||
return textSpan(forStatement.iterator);
|
||||
if (forStatement.incrementor) {
|
||||
return textSpan(forStatement.incrementor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -458,7 +458,11 @@ module ts.formatting {
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return true;
|
||||
|
||||
|
||||
// equals in binding elements: function foo([[x, y] = [1, 2]])
|
||||
case SyntaxKind.BindingElement:
|
||||
// equals in type X = ...
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
// equal in import a = module('a');
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
// equal in let a = 0;
|
||||
@@ -475,8 +479,6 @@ module ts.formatting {
|
||||
// Technically, "of" is not a binary operator, but format it the same way as "in"
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword;
|
||||
case SyntaxKind.BindingElement:
|
||||
return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user