Updated LKG
This commit is contained in:
Родитель
bc5e5a20ea
Коммит
a906076b41
|
@ -561,7 +561,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.
|
||||
*/
|
||||
|
|
|
@ -561,7 +561,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.
|
||||
*/
|
||||
|
@ -1628,7 +1628,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>;
|
||||
}
|
||||
|
|
|
@ -561,7 +561,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.
|
||||
*/
|
||||
|
|
|
@ -561,7 +561,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.
|
||||
*/
|
||||
|
@ -1628,7 +1628,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>;
|
||||
}
|
||||
|
|
204
bin/tsc.js
204
bin/tsc.js
|
@ -275,6 +275,17 @@ var ts;
|
|||
return result;
|
||||
}
|
||||
ts.arrayToMap = arrayToMap;
|
||||
function memoize(callback) {
|
||||
var value;
|
||||
return function () {
|
||||
if (callback) {
|
||||
value = callback();
|
||||
callback = undefined;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
ts.memoize = memoize;
|
||||
function formatStringFromArgs(text, args, baseIndex) {
|
||||
baseIndex = baseIndex || 0;
|
||||
return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; });
|
||||
|
@ -1064,7 +1075,7 @@ var ts;
|
|||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.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: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
|
@ -1366,7 +1377,7 @@ var ts;
|
|||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." },
|
||||
Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." },
|
||||
|
@ -1387,8 +1398,8 @@ var ts;
|
|||
Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
|
@ -1688,7 +1699,7 @@ var ts;
|
|||
function isLineBreak(ch) {
|
||||
// ES5 7.3:
|
||||
// The ECMAScript line terminator characters are listed in Table 3.
|
||||
// Table 3 <20> Line Terminator Characters
|
||||
// Table 3: Line Terminator Characters
|
||||
// Code Unit Value Name Formal Name
|
||||
// \u000A Line Feed <LF>
|
||||
// \u000D Carriage Return <CR>
|
||||
|
@ -2875,10 +2886,7 @@ var ts;
|
|||
parent = node;
|
||||
if (symbolKind & 262128) {
|
||||
container = node;
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = container;
|
||||
}
|
||||
lastContainer = container;
|
||||
addToContainerChain(container);
|
||||
}
|
||||
if (isBlockScopeContainer) {
|
||||
setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227);
|
||||
|
@ -2888,6 +2896,12 @@ var ts;
|
|||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
function addToContainerChain(node) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = node;
|
||||
}
|
||||
lastContainer = node;
|
||||
}
|
||||
function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) {
|
||||
switch (container.kind) {
|
||||
case 205:
|
||||
|
@ -3016,6 +3030,7 @@ var ts;
|
|||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
addToContainerChain(blockScopeContainer);
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
|
@ -3808,7 +3823,7 @@ var ts;
|
|||
var forStatement = parent_1;
|
||||
return (forStatement.initializer === node && forStatement.initializer.kind !== 199) ||
|
||||
forStatement.condition === node ||
|
||||
forStatement.iterator === node;
|
||||
forStatement.incrementor === node;
|
||||
case 187:
|
||||
case 188:
|
||||
var forInStatement = parent_1;
|
||||
|
@ -4905,7 +4920,7 @@ var ts;
|
|||
case 186:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
visitNode(cbNode, node.condition) ||
|
||||
visitNode(cbNode, node.iterator) ||
|
||||
visitNode(cbNode, node.incrementor) ||
|
||||
visitNode(cbNode, node.statement);
|
||||
case 187:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
|
@ -7114,7 +7129,7 @@ var ts;
|
|||
}
|
||||
parseExpected(22);
|
||||
if (token !== 17) {
|
||||
forStatement.iterator = allowInAnd(parseExpression);
|
||||
forStatement.incrementor = allowInAnd(parseExpression);
|
||||
}
|
||||
parseExpected(17);
|
||||
forOrForInOrForOfStatement = forStatement;
|
||||
|
@ -8516,11 +8531,10 @@ var ts;
|
|||
var globalESSymbolType;
|
||||
var globalIterableType;
|
||||
var anyArrayType;
|
||||
var globalTypedPropertyDescriptorType;
|
||||
var globalClassDecoratorType;
|
||||
var globalParameterDecoratorType;
|
||||
var globalPropertyDecoratorType;
|
||||
var globalMethodDecoratorType;
|
||||
var getGlobalClassDecoratorType;
|
||||
var getGlobalParameterDecoratorType;
|
||||
var getGlobalPropertyDecoratorType;
|
||||
var getGlobalMethodDecoratorType;
|
||||
var tupleTypes = {};
|
||||
var unionTypes = {};
|
||||
var stringLiteralTypes = {};
|
||||
|
@ -10442,10 +10456,11 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function getDeclaredTypeOfClass(symbol) {
|
||||
function getDeclaredTypeOfClassOrInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(1024, symbol);
|
||||
var kind = symbol.flags & 32 ? 1024 : 2048;
|
||||
var type = links.declaredType = createObjectType(kind, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096;
|
||||
|
@ -10455,32 +10470,6 @@ var ts;
|
|||
type.target = type;
|
||||
type.typeArguments = type.typeParameters;
|
||||
}
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = emptyArray;
|
||||
type.declaredConstructSignatures = emptyArray;
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
function getDeclaredTypeOfInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(2048, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096;
|
||||
type.typeParameters = typeParameters;
|
||||
type.instantiations = {};
|
||||
type.instantiations[getTypeListId(type.typeParameters)] = type;
|
||||
type.target = type;
|
||||
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, 0);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
|
@ -10531,11 +10520,8 @@ var ts;
|
|||
}
|
||||
function getDeclaredTypeOfSymbol(symbol) {
|
||||
ts.Debug.assert((symbol.flags & 16777216) === 0);
|
||||
if (symbol.flags & 32) {
|
||||
return getDeclaredTypeOfClass(symbol);
|
||||
}
|
||||
if (symbol.flags & 64) {
|
||||
return getDeclaredTypeOfInterface(symbol);
|
||||
if (symbol.flags & (32 | 64)) {
|
||||
return getDeclaredTypeOfClassOrInterface(symbol);
|
||||
}
|
||||
if (symbol.flags & 524288) {
|
||||
return getDeclaredTypeOfTypeAlias(symbol);
|
||||
|
@ -10583,15 +10569,27 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function resolveDeclaredMembers(type) {
|
||||
if (!type.declaredProperties) {
|
||||
var symbol = type.symbol;
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
function resolveClassOrInterfaceMembers(type) {
|
||||
var members = type.symbol.members;
|
||||
var callSignatures = type.declaredCallSignatures;
|
||||
var constructSignatures = type.declaredConstructSignatures;
|
||||
var stringIndexType = type.declaredStringIndexType;
|
||||
var numberIndexType = type.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(type);
|
||||
var target = resolveDeclaredMembers(type);
|
||||
var members = target.symbol.members;
|
||||
var callSignatures = target.declaredCallSignatures;
|
||||
var constructSignatures = target.declaredConstructSignatures;
|
||||
var stringIndexType = target.declaredStringIndexType;
|
||||
var numberIndexType = target.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(target);
|
||||
if (baseTypes.length) {
|
||||
members = createSymbolTable(type.declaredProperties);
|
||||
members = createSymbolTable(target.declaredProperties);
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var baseType = baseTypes[_i];
|
||||
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
||||
|
@ -10604,7 +10602,7 @@ var ts;
|
|||
setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType);
|
||||
}
|
||||
function resolveTypeReferenceMembers(type) {
|
||||
var target = type.target;
|
||||
var target = resolveDeclaredMembers(type.target);
|
||||
var mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
||||
var members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
||||
var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
||||
|
@ -10742,7 +10740,7 @@ var ts;
|
|||
callSignatures = getSignaturesOfSymbol(symbol);
|
||||
}
|
||||
if (symbol.flags & 32) {
|
||||
var classType = getDeclaredTypeOfClass(symbol);
|
||||
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
||||
constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]);
|
||||
if (!constructSignatures.length) {
|
||||
constructSignatures = getDefaultConstructSignatures(classType);
|
||||
|
@ -10843,7 +10841,7 @@ var ts;
|
|||
var type = getApparentType(current);
|
||||
if (type !== unknownType) {
|
||||
var prop = getPropertyOfType(type, name);
|
||||
if (!prop) {
|
||||
if (!prop || getDeclarationFlagsFromSymbol(prop) & (32 | 64)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!props) {
|
||||
|
@ -10953,7 +10951,7 @@ var ts;
|
|||
function getSignatureFromDeclaration(declaration) {
|
||||
var links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
var classType = declaration.kind === 135 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined;
|
||||
var classType = declaration.kind === 135 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined;
|
||||
var typeParameters = classType ? classType.typeParameters :
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
|
||||
var parameters = [];
|
||||
|
@ -15409,21 +15407,21 @@ var ts;
|
|||
case 201:
|
||||
var classSymbol = getSymbolOfNode(node.parent);
|
||||
var classConstructorType = getTypeOfSymbol(classSymbol);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]);
|
||||
checkTypeAssignableTo(exprType, classDecoratorType, node);
|
||||
break;
|
||||
case 132:
|
||||
checkTypeAssignableTo(exprType, globalPropertyDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node);
|
||||
break;
|
||||
case 134:
|
||||
case 136:
|
||||
case 137:
|
||||
var methodType = getTypeOfNode(node.parent);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]);
|
||||
checkTypeAssignableTo(exprType, methodDecoratorType, node);
|
||||
break;
|
||||
case 129:
|
||||
checkTypeAssignableTo(exprType, globalParameterDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -15806,8 +15804,8 @@ var ts;
|
|||
}
|
||||
if (node.condition)
|
||||
checkExpression(node.condition);
|
||||
if (node.iterator)
|
||||
checkExpression(node.iterator);
|
||||
if (node.incrementor)
|
||||
checkExpression(node.incrementor);
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
function checkForOfStatement(node) {
|
||||
|
@ -16387,7 +16385,7 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
var seen = {};
|
||||
ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
var ok = true;
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var base = baseTypes[_i];
|
||||
|
@ -17882,11 +17880,10 @@ var ts;
|
|||
globalNumberType = getGlobalType("Number");
|
||||
globalBooleanType = getGlobalType("Boolean");
|
||||
globalRegExpType = getGlobalType("RegExp");
|
||||
globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
|
||||
globalClassDecoratorType = getGlobalType("ClassDecorator");
|
||||
globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
|
||||
globalMethodDecoratorType = getGlobalType("MethodDecorator");
|
||||
globalParameterDecoratorType = getGlobalType("ParameterDecorator");
|
||||
getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); });
|
||||
getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); });
|
||||
getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); });
|
||||
getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); });
|
||||
if (languageVersion >= 2) {
|
||||
globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray");
|
||||
globalESSymbolType = getGlobalType("Symbol");
|
||||
|
@ -21775,7 +21772,7 @@ var ts;
|
|||
write(";");
|
||||
emitOptional(" ", node.condition);
|
||||
write(";");
|
||||
emitOptional(" ", node.iterator);
|
||||
emitOptional(" ", node.incrementor);
|
||||
write(")");
|
||||
emitEmbeddedStatement(node.statement);
|
||||
}
|
||||
|
@ -23813,8 +23810,18 @@ var ts;
|
|||
write("}");
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
function emitAMDDependencies(node, includeNonAmdDependencies) {
|
||||
// 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
|
||||
// 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" />`
|
||||
// we need to add modules without alias names to the end of the dependencies list
|
||||
var aliasedModuleNames = [];
|
||||
var unaliasedModuleNames = [];
|
||||
var importAliasNames = [];
|
||||
|
@ -23843,7 +23850,7 @@ var ts;
|
|||
else {
|
||||
importAliasName = getGeneratedNameForNode(importNode);
|
||||
}
|
||||
if (importAliasName) {
|
||||
if (includeNonAmdDependencies && importAliasName) {
|
||||
aliasedModuleNames.push(externalModuleName);
|
||||
importAliasNames.push(importAliasName);
|
||||
}
|
||||
|
@ -23851,11 +23858,6 @@ var ts;
|
|||
unaliasedModuleNames.push(externalModuleName);
|
||||
}
|
||||
}
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
write("[\"require\", \"exports\"");
|
||||
if (aliasedModuleNames.length) {
|
||||
write(", ");
|
||||
|
@ -23870,6 +23872,15 @@ var ts;
|
|||
write(", ");
|
||||
write(importAliasNames.join(", "));
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
emitAMDDependencies(node, true);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
|
@ -23889,6 +23900,21 @@ var ts;
|
|||
emitTempDeclarations(true);
|
||||
emitExportEquals(false);
|
||||
}
|
||||
function emitUMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})(");
|
||||
emitAMDDependencies(node, false);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(true);
|
||||
emitExportEquals(true);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
}
|
||||
function emitES6Module(node, startIndex) {
|
||||
externalImports = undefined;
|
||||
exportSpecifiers = undefined;
|
||||
|
@ -23958,6 +23984,9 @@ var ts;
|
|||
else if (compilerOptions.module === 2) {
|
||||
emitAMDModule(node, startIndex);
|
||||
}
|
||||
else if (compilerOptions.module === 3) {
|
||||
emitUMDModule(node, startIndex);
|
||||
}
|
||||
else {
|
||||
emitCommonJSModule(node, startIndex);
|
||||
}
|
||||
|
@ -24753,7 +24782,7 @@ var ts;
|
|||
diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
if (options.module && languageVersion >= 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
if (options.outDir ||
|
||||
options.sourceRoot ||
|
||||
|
@ -24832,11 +24861,12 @@ var ts;
|
|||
shortName: "m",
|
||||
type: {
|
||||
"commonjs": 1,
|
||||
"amd": 2
|
||||
"amd": 2,
|
||||
"umd": 3
|
||||
},
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd,
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd,
|
||||
paramType: ts.Diagnostics.KIND,
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
|
@ -24932,7 +24962,7 @@ var ts;
|
|||
type: { "es3": 0, "es5": 1, "es6": 2 },
|
||||
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: ts.Diagnostics.VERSION,
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
|
|
212
bin/tsserver.js
212
bin/tsserver.js
|
@ -275,6 +275,17 @@ var ts;
|
|||
return result;
|
||||
}
|
||||
ts.arrayToMap = arrayToMap;
|
||||
function memoize(callback) {
|
||||
var value;
|
||||
return function () {
|
||||
if (callback) {
|
||||
value = callback();
|
||||
callback = undefined;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
ts.memoize = memoize;
|
||||
function formatStringFromArgs(text, args, baseIndex) {
|
||||
baseIndex = baseIndex || 0;
|
||||
return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; });
|
||||
|
@ -1064,7 +1075,7 @@ var ts;
|
|||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.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: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
|
@ -1366,7 +1377,7 @@ var ts;
|
|||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." },
|
||||
Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." },
|
||||
|
@ -1387,8 +1398,8 @@ var ts;
|
|||
Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
|
@ -1688,7 +1699,7 @@ var ts;
|
|||
function isLineBreak(ch) {
|
||||
// ES5 7.3:
|
||||
// The ECMAScript line terminator characters are listed in Table 3.
|
||||
// Table 3 <20> Line Terminator Characters
|
||||
// Table 3: Line Terminator Characters
|
||||
// Code Unit Value Name Formal Name
|
||||
// \u000A Line Feed <LF>
|
||||
// \u000D Carriage Return <CR>
|
||||
|
@ -2738,11 +2749,12 @@ var ts;
|
|||
shortName: "m",
|
||||
type: {
|
||||
"commonjs": 1,
|
||||
"amd": 2
|
||||
"amd": 2,
|
||||
"umd": 3
|
||||
},
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd,
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd,
|
||||
paramType: ts.Diagnostics.KIND,
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
|
@ -2838,7 +2850,7 @@ var ts;
|
|||
type: { "es3": 0, "es5": 1, "es6": 2 },
|
||||
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: ts.Diagnostics.VERSION,
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
|
@ -3649,7 +3661,7 @@ var ts;
|
|||
var forStatement = parent_1;
|
||||
return (forStatement.initializer === node && forStatement.initializer.kind !== 199) ||
|
||||
forStatement.condition === node ||
|
||||
forStatement.iterator === node;
|
||||
forStatement.incrementor === node;
|
||||
case 187:
|
||||
case 188:
|
||||
var forInStatement = parent_1;
|
||||
|
@ -4746,7 +4758,7 @@ var ts;
|
|||
case 186:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
visitNode(cbNode, node.condition) ||
|
||||
visitNode(cbNode, node.iterator) ||
|
||||
visitNode(cbNode, node.incrementor) ||
|
||||
visitNode(cbNode, node.statement);
|
||||
case 187:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
|
@ -6955,7 +6967,7 @@ var ts;
|
|||
}
|
||||
parseExpected(22);
|
||||
if (token !== 17) {
|
||||
forStatement.iterator = allowInAnd(parseExpression);
|
||||
forStatement.incrementor = allowInAnd(parseExpression);
|
||||
}
|
||||
parseExpected(17);
|
||||
forOrForInOrForOfStatement = forStatement;
|
||||
|
@ -8446,10 +8458,7 @@ var ts;
|
|||
parent = node;
|
||||
if (symbolKind & 262128) {
|
||||
container = node;
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = container;
|
||||
}
|
||||
lastContainer = container;
|
||||
addToContainerChain(container);
|
||||
}
|
||||
if (isBlockScopeContainer) {
|
||||
setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227);
|
||||
|
@ -8459,6 +8468,12 @@ var ts;
|
|||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
function addToContainerChain(node) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = node;
|
||||
}
|
||||
lastContainer = node;
|
||||
}
|
||||
function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) {
|
||||
switch (container.kind) {
|
||||
case 205:
|
||||
|
@ -8587,6 +8602,7 @@ var ts;
|
|||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
addToContainerChain(blockScopeContainer);
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
|
@ -8866,11 +8882,10 @@ var ts;
|
|||
var globalESSymbolType;
|
||||
var globalIterableType;
|
||||
var anyArrayType;
|
||||
var globalTypedPropertyDescriptorType;
|
||||
var globalClassDecoratorType;
|
||||
var globalParameterDecoratorType;
|
||||
var globalPropertyDecoratorType;
|
||||
var globalMethodDecoratorType;
|
||||
var getGlobalClassDecoratorType;
|
||||
var getGlobalParameterDecoratorType;
|
||||
var getGlobalPropertyDecoratorType;
|
||||
var getGlobalMethodDecoratorType;
|
||||
var tupleTypes = {};
|
||||
var unionTypes = {};
|
||||
var stringLiteralTypes = {};
|
||||
|
@ -10792,10 +10807,11 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function getDeclaredTypeOfClass(symbol) {
|
||||
function getDeclaredTypeOfClassOrInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(1024, symbol);
|
||||
var kind = symbol.flags & 32 ? 1024 : 2048;
|
||||
var type = links.declaredType = createObjectType(kind, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096;
|
||||
|
@ -10805,32 +10821,6 @@ var ts;
|
|||
type.target = type;
|
||||
type.typeArguments = type.typeParameters;
|
||||
}
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = emptyArray;
|
||||
type.declaredConstructSignatures = emptyArray;
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
function getDeclaredTypeOfInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(2048, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096;
|
||||
type.typeParameters = typeParameters;
|
||||
type.instantiations = {};
|
||||
type.instantiations[getTypeListId(type.typeParameters)] = type;
|
||||
type.target = type;
|
||||
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, 0);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
|
@ -10881,11 +10871,8 @@ var ts;
|
|||
}
|
||||
function getDeclaredTypeOfSymbol(symbol) {
|
||||
ts.Debug.assert((symbol.flags & 16777216) === 0);
|
||||
if (symbol.flags & 32) {
|
||||
return getDeclaredTypeOfClass(symbol);
|
||||
}
|
||||
if (symbol.flags & 64) {
|
||||
return getDeclaredTypeOfInterface(symbol);
|
||||
if (symbol.flags & (32 | 64)) {
|
||||
return getDeclaredTypeOfClassOrInterface(symbol);
|
||||
}
|
||||
if (symbol.flags & 524288) {
|
||||
return getDeclaredTypeOfTypeAlias(symbol);
|
||||
|
@ -10933,15 +10920,27 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function resolveDeclaredMembers(type) {
|
||||
if (!type.declaredProperties) {
|
||||
var symbol = type.symbol;
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
function resolveClassOrInterfaceMembers(type) {
|
||||
var members = type.symbol.members;
|
||||
var callSignatures = type.declaredCallSignatures;
|
||||
var constructSignatures = type.declaredConstructSignatures;
|
||||
var stringIndexType = type.declaredStringIndexType;
|
||||
var numberIndexType = type.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(type);
|
||||
var target = resolveDeclaredMembers(type);
|
||||
var members = target.symbol.members;
|
||||
var callSignatures = target.declaredCallSignatures;
|
||||
var constructSignatures = target.declaredConstructSignatures;
|
||||
var stringIndexType = target.declaredStringIndexType;
|
||||
var numberIndexType = target.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(target);
|
||||
if (baseTypes.length) {
|
||||
members = createSymbolTable(type.declaredProperties);
|
||||
members = createSymbolTable(target.declaredProperties);
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var baseType = baseTypes[_i];
|
||||
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
||||
|
@ -10954,7 +10953,7 @@ var ts;
|
|||
setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType);
|
||||
}
|
||||
function resolveTypeReferenceMembers(type) {
|
||||
var target = type.target;
|
||||
var target = resolveDeclaredMembers(type.target);
|
||||
var mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
||||
var members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
||||
var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
||||
|
@ -11092,7 +11091,7 @@ var ts;
|
|||
callSignatures = getSignaturesOfSymbol(symbol);
|
||||
}
|
||||
if (symbol.flags & 32) {
|
||||
var classType = getDeclaredTypeOfClass(symbol);
|
||||
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
||||
constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]);
|
||||
if (!constructSignatures.length) {
|
||||
constructSignatures = getDefaultConstructSignatures(classType);
|
||||
|
@ -11193,7 +11192,7 @@ var ts;
|
|||
var type = getApparentType(current);
|
||||
if (type !== unknownType) {
|
||||
var prop = getPropertyOfType(type, name);
|
||||
if (!prop) {
|
||||
if (!prop || getDeclarationFlagsFromSymbol(prop) & (32 | 64)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!props) {
|
||||
|
@ -11303,7 +11302,7 @@ var ts;
|
|||
function getSignatureFromDeclaration(declaration) {
|
||||
var links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
var classType = declaration.kind === 135 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined;
|
||||
var classType = declaration.kind === 135 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined;
|
||||
var typeParameters = classType ? classType.typeParameters :
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
|
||||
var parameters = [];
|
||||
|
@ -15759,21 +15758,21 @@ var ts;
|
|||
case 201:
|
||||
var classSymbol = getSymbolOfNode(node.parent);
|
||||
var classConstructorType = getTypeOfSymbol(classSymbol);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]);
|
||||
checkTypeAssignableTo(exprType, classDecoratorType, node);
|
||||
break;
|
||||
case 132:
|
||||
checkTypeAssignableTo(exprType, globalPropertyDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node);
|
||||
break;
|
||||
case 134:
|
||||
case 136:
|
||||
case 137:
|
||||
var methodType = getTypeOfNode(node.parent);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]);
|
||||
checkTypeAssignableTo(exprType, methodDecoratorType, node);
|
||||
break;
|
||||
case 129:
|
||||
checkTypeAssignableTo(exprType, globalParameterDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -16156,8 +16155,8 @@ var ts;
|
|||
}
|
||||
if (node.condition)
|
||||
checkExpression(node.condition);
|
||||
if (node.iterator)
|
||||
checkExpression(node.iterator);
|
||||
if (node.incrementor)
|
||||
checkExpression(node.incrementor);
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
function checkForOfStatement(node) {
|
||||
|
@ -16737,7 +16736,7 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
var seen = {};
|
||||
ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
var ok = true;
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var base = baseTypes[_i];
|
||||
|
@ -18232,11 +18231,10 @@ var ts;
|
|||
globalNumberType = getGlobalType("Number");
|
||||
globalBooleanType = getGlobalType("Boolean");
|
||||
globalRegExpType = getGlobalType("RegExp");
|
||||
globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
|
||||
globalClassDecoratorType = getGlobalType("ClassDecorator");
|
||||
globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
|
||||
globalMethodDecoratorType = getGlobalType("MethodDecorator");
|
||||
globalParameterDecoratorType = getGlobalType("ParameterDecorator");
|
||||
getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); });
|
||||
getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); });
|
||||
getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); });
|
||||
getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); });
|
||||
if (languageVersion >= 2) {
|
||||
globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray");
|
||||
globalESSymbolType = getGlobalType("Symbol");
|
||||
|
@ -22125,7 +22123,7 @@ var ts;
|
|||
write(";");
|
||||
emitOptional(" ", node.condition);
|
||||
write(";");
|
||||
emitOptional(" ", node.iterator);
|
||||
emitOptional(" ", node.incrementor);
|
||||
write(")");
|
||||
emitEmbeddedStatement(node.statement);
|
||||
}
|
||||
|
@ -24163,8 +24161,18 @@ var ts;
|
|||
write("}");
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
function emitAMDDependencies(node, includeNonAmdDependencies) {
|
||||
// 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
|
||||
// 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" />`
|
||||
// we need to add modules without alias names to the end of the dependencies list
|
||||
var aliasedModuleNames = [];
|
||||
var unaliasedModuleNames = [];
|
||||
var importAliasNames = [];
|
||||
|
@ -24193,7 +24201,7 @@ var ts;
|
|||
else {
|
||||
importAliasName = getGeneratedNameForNode(importNode);
|
||||
}
|
||||
if (importAliasName) {
|
||||
if (includeNonAmdDependencies && importAliasName) {
|
||||
aliasedModuleNames.push(externalModuleName);
|
||||
importAliasNames.push(importAliasName);
|
||||
}
|
||||
|
@ -24201,11 +24209,6 @@ var ts;
|
|||
unaliasedModuleNames.push(externalModuleName);
|
||||
}
|
||||
}
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
write("[\"require\", \"exports\"");
|
||||
if (aliasedModuleNames.length) {
|
||||
write(", ");
|
||||
|
@ -24220,6 +24223,15 @@ var ts;
|
|||
write(", ");
|
||||
write(importAliasNames.join(", "));
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
emitAMDDependencies(node, true);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
|
@ -24239,6 +24251,21 @@ var ts;
|
|||
emitTempDeclarations(true);
|
||||
emitExportEquals(false);
|
||||
}
|
||||
function emitUMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})(");
|
||||
emitAMDDependencies(node, false);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(true);
|
||||
emitExportEquals(true);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
}
|
||||
function emitES6Module(node, startIndex) {
|
||||
externalImports = undefined;
|
||||
exportSpecifiers = undefined;
|
||||
|
@ -24308,6 +24335,9 @@ var ts;
|
|||
else if (compilerOptions.module === 2) {
|
||||
emitAMDModule(node, startIndex);
|
||||
}
|
||||
else if (compilerOptions.module === 3) {
|
||||
emitUMDModule(node, startIndex);
|
||||
}
|
||||
else {
|
||||
emitCommonJSModule(node, startIndex);
|
||||
}
|
||||
|
@ -25103,7 +25133,7 @@ var ts;
|
|||
diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
if (options.module && languageVersion >= 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
if (options.outDir ||
|
||||
options.sourceRoot ||
|
||||
|
@ -25403,8 +25433,8 @@ var ts;
|
|||
if (forStatement.condition) {
|
||||
return textSpan(forStatement.condition);
|
||||
}
|
||||
if (forStatement.iterator) {
|
||||
return textSpan(forStatement.iterator);
|
||||
if (forStatement.incrementor) {
|
||||
return textSpan(forStatement.incrementor);
|
||||
}
|
||||
}
|
||||
function spanInOpenBraceToken(node) {
|
||||
|
@ -28038,6 +28068,8 @@ var ts;
|
|||
case 169:
|
||||
case 170:
|
||||
return true;
|
||||
case 152:
|
||||
case 203:
|
||||
case 208:
|
||||
case 198:
|
||||
case 129:
|
||||
|
@ -28049,8 +28081,6 @@ var ts;
|
|||
return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86;
|
||||
case 188:
|
||||
return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125;
|
||||
case 152:
|
||||
return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
@ -597,7 +597,7 @@ declare module "typescript" {
|
|||
interface ForStatement extends IterationStatement {
|
||||
initializer?: VariableDeclarationList | Expression;
|
||||
condition?: Expression;
|
||||
iterator?: Expression;
|
||||
incrementor?: Expression;
|
||||
}
|
||||
interface ForInStatement extends IterationStatement {
|
||||
initializer: VariableDeclarationList | Expression;
|
||||
|
@ -1005,15 +1005,17 @@ declare module "typescript" {
|
|||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments: Type[];
|
||||
|
@ -1110,6 +1112,7 @@ declare module "typescript" {
|
|||
None = 0,
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
}
|
||||
interface LineAndCharacter {
|
||||
line: number;
|
||||
|
|
|
@ -541,6 +541,7 @@ var ts;
|
|||
ModuleKind[ModuleKind["None"] = 0] = "None";
|
||||
ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS";
|
||||
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
|
||||
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
|
||||
})(ts.ModuleKind || (ts.ModuleKind = {}));
|
||||
var ModuleKind = ts.ModuleKind;
|
||||
(function (ScriptTarget) {
|
||||
|
@ -960,6 +961,17 @@ var ts;
|
|||
return result;
|
||||
}
|
||||
ts.arrayToMap = arrayToMap;
|
||||
function memoize(callback) {
|
||||
var value;
|
||||
return function () {
|
||||
if (callback) {
|
||||
value = callback();
|
||||
callback = undefined;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
ts.memoize = memoize;
|
||||
function formatStringFromArgs(text, args, baseIndex) {
|
||||
baseIndex = baseIndex || 0;
|
||||
return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; });
|
||||
|
@ -1798,7 +1810,7 @@ var ts;
|
|||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.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: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
|
@ -2100,7 +2112,7 @@ var ts;
|
|||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." },
|
||||
Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." },
|
||||
|
@ -2121,8 +2133,8 @@ var ts;
|
|||
Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
|
@ -2478,7 +2490,7 @@ var ts;
|
|||
function isLineBreak(ch) {
|
||||
// ES5 7.3:
|
||||
// The ECMAScript line terminator characters are listed in Table 3.
|
||||
// Table 3 <20> Line Terminator Characters
|
||||
// Table 3: Line Terminator Characters
|
||||
// Code Unit Value Name Formal Name
|
||||
// \u000A Line Feed <LF>
|
||||
// \u000D Carriage Return <CR>
|
||||
|
@ -3766,10 +3778,7 @@ var ts;
|
|||
parent = node;
|
||||
if (symbolKind & 262128 /* IsContainer */) {
|
||||
container = node;
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = container;
|
||||
}
|
||||
lastContainer = container;
|
||||
addToContainerChain(container);
|
||||
}
|
||||
if (isBlockScopeContainer) {
|
||||
// in incremental scenarios we might reuse nodes that already have locals being allocated
|
||||
|
@ -3785,6 +3794,12 @@ var ts;
|
|||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
function addToContainerChain(node) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = node;
|
||||
}
|
||||
lastContainer = node;
|
||||
}
|
||||
function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) {
|
||||
switch (container.kind) {
|
||||
case 205 /* ModuleDeclaration */:
|
||||
|
@ -3918,6 +3933,7 @@ var ts;
|
|||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
addToContainerChain(blockScopeContainer);
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
|
@ -4820,7 +4836,7 @@ var ts;
|
|||
var forStatement = parent_1;
|
||||
return (forStatement.initializer === node && forStatement.initializer.kind !== 199 /* VariableDeclarationList */) ||
|
||||
forStatement.condition === node ||
|
||||
forStatement.iterator === node;
|
||||
forStatement.incrementor === node;
|
||||
case 187 /* ForInStatement */:
|
||||
case 188 /* ForOfStatement */:
|
||||
var forInStatement = parent_1;
|
||||
|
@ -6079,7 +6095,7 @@ var ts;
|
|||
case 186 /* ForStatement */:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
visitNode(cbNode, node.condition) ||
|
||||
visitNode(cbNode, node.iterator) ||
|
||||
visitNode(cbNode, node.incrementor) ||
|
||||
visitNode(cbNode, node.statement);
|
||||
case 187 /* ForInStatement */:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
|
@ -8953,7 +8969,7 @@ var ts;
|
|||
}
|
||||
parseExpected(22 /* SemicolonToken */);
|
||||
if (token !== 17 /* CloseParenToken */) {
|
||||
forStatement.iterator = allowInAnd(parseExpression);
|
||||
forStatement.incrementor = allowInAnd(parseExpression);
|
||||
}
|
||||
parseExpected(17 /* CloseParenToken */);
|
||||
forOrForInOrForOfStatement = forStatement;
|
||||
|
@ -10714,11 +10730,10 @@ var ts;
|
|||
var globalESSymbolType;
|
||||
var globalIterableType;
|
||||
var anyArrayType;
|
||||
var globalTypedPropertyDescriptorType;
|
||||
var globalClassDecoratorType;
|
||||
var globalParameterDecoratorType;
|
||||
var globalPropertyDecoratorType;
|
||||
var globalMethodDecoratorType;
|
||||
var getGlobalClassDecoratorType;
|
||||
var getGlobalParameterDecoratorType;
|
||||
var getGlobalPropertyDecoratorType;
|
||||
var getGlobalMethodDecoratorType;
|
||||
var tupleTypes = {};
|
||||
var unionTypes = {};
|
||||
var stringLiteralTypes = {};
|
||||
|
@ -12929,10 +12944,11 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function getDeclaredTypeOfClass(symbol) {
|
||||
function getDeclaredTypeOfClassOrInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(1024 /* Class */, symbol);
|
||||
var kind = symbol.flags & 32 /* Class */ ? 1024 /* Class */ : 2048 /* Interface */;
|
||||
var type = links.declaredType = createObjectType(kind, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096 /* Reference */;
|
||||
|
@ -12942,32 +12958,6 @@ var ts;
|
|||
type.target = type;
|
||||
type.typeArguments = type.typeParameters;
|
||||
}
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = emptyArray;
|
||||
type.declaredConstructSignatures = emptyArray;
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
function getDeclaredTypeOfInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(2048 /* Interface */, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096 /* Reference */;
|
||||
type.typeParameters = typeParameters;
|
||||
type.instantiations = {};
|
||||
type.instantiations[getTypeListId(type.typeParameters)] = type;
|
||||
type.target = type;
|
||||
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, 0 /* String */);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
|
@ -13018,11 +13008,8 @@ var ts;
|
|||
}
|
||||
function getDeclaredTypeOfSymbol(symbol) {
|
||||
ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0);
|
||||
if (symbol.flags & 32 /* Class */) {
|
||||
return getDeclaredTypeOfClass(symbol);
|
||||
}
|
||||
if (symbol.flags & 64 /* Interface */) {
|
||||
return getDeclaredTypeOfInterface(symbol);
|
||||
if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) {
|
||||
return getDeclaredTypeOfClassOrInterface(symbol);
|
||||
}
|
||||
if (symbol.flags & 524288 /* TypeAlias */) {
|
||||
return getDeclaredTypeOfTypeAlias(symbol);
|
||||
|
@ -13070,15 +13057,27 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function resolveDeclaredMembers(type) {
|
||||
if (!type.declaredProperties) {
|
||||
var symbol = type.symbol;
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
function resolveClassOrInterfaceMembers(type) {
|
||||
var members = type.symbol.members;
|
||||
var callSignatures = type.declaredCallSignatures;
|
||||
var constructSignatures = type.declaredConstructSignatures;
|
||||
var stringIndexType = type.declaredStringIndexType;
|
||||
var numberIndexType = type.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(type);
|
||||
var target = resolveDeclaredMembers(type);
|
||||
var members = target.symbol.members;
|
||||
var callSignatures = target.declaredCallSignatures;
|
||||
var constructSignatures = target.declaredConstructSignatures;
|
||||
var stringIndexType = target.declaredStringIndexType;
|
||||
var numberIndexType = target.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(target);
|
||||
if (baseTypes.length) {
|
||||
members = createSymbolTable(type.declaredProperties);
|
||||
members = createSymbolTable(target.declaredProperties);
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var baseType = baseTypes[_i];
|
||||
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
||||
|
@ -13091,7 +13090,7 @@ var ts;
|
|||
setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType);
|
||||
}
|
||||
function resolveTypeReferenceMembers(type) {
|
||||
var target = type.target;
|
||||
var target = resolveDeclaredMembers(type.target);
|
||||
var mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
||||
var members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
||||
var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
||||
|
@ -13236,7 +13235,7 @@ var ts;
|
|||
callSignatures = getSignaturesOfSymbol(symbol);
|
||||
}
|
||||
if (symbol.flags & 32 /* Class */) {
|
||||
var classType = getDeclaredTypeOfClass(symbol);
|
||||
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
||||
constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]);
|
||||
if (!constructSignatures.length) {
|
||||
constructSignatures = getDefaultConstructSignatures(classType);
|
||||
|
@ -13343,7 +13342,7 @@ var ts;
|
|||
var type = getApparentType(current);
|
||||
if (type !== unknownType) {
|
||||
var prop = getPropertyOfType(type, name);
|
||||
if (!prop) {
|
||||
if (!prop || getDeclarationFlagsFromSymbol(prop) & (32 /* Private */ | 64 /* Protected */)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!props) {
|
||||
|
@ -13462,7 +13461,7 @@ var ts;
|
|||
function getSignatureFromDeclaration(declaration) {
|
||||
var links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
var classType = declaration.kind === 135 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined;
|
||||
var classType = declaration.kind === 135 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined;
|
||||
var typeParameters = classType ? classType.typeParameters :
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
|
||||
var parameters = [];
|
||||
|
@ -18691,21 +18690,21 @@ var ts;
|
|||
case 201 /* ClassDeclaration */:
|
||||
var classSymbol = getSymbolOfNode(node.parent);
|
||||
var classConstructorType = getTypeOfSymbol(classSymbol);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]);
|
||||
checkTypeAssignableTo(exprType, classDecoratorType, node);
|
||||
break;
|
||||
case 132 /* PropertyDeclaration */:
|
||||
checkTypeAssignableTo(exprType, globalPropertyDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node);
|
||||
break;
|
||||
case 134 /* MethodDeclaration */:
|
||||
case 136 /* GetAccessor */:
|
||||
case 137 /* SetAccessor */:
|
||||
var methodType = getTypeOfNode(node.parent);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]);
|
||||
checkTypeAssignableTo(exprType, methodDecoratorType, node);
|
||||
break;
|
||||
case 129 /* Parameter */:
|
||||
checkTypeAssignableTo(exprType, globalParameterDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -19178,8 +19177,8 @@ var ts;
|
|||
}
|
||||
if (node.condition)
|
||||
checkExpression(node.condition);
|
||||
if (node.iterator)
|
||||
checkExpression(node.iterator);
|
||||
if (node.incrementor)
|
||||
checkExpression(node.incrementor);
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
function checkForOfStatement(node) {
|
||||
|
@ -19860,7 +19859,7 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
var seen = {};
|
||||
ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
var ok = true;
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var base = baseTypes[_i];
|
||||
|
@ -21520,11 +21519,10 @@ var ts;
|
|||
globalNumberType = getGlobalType("Number");
|
||||
globalBooleanType = getGlobalType("Boolean");
|
||||
globalRegExpType = getGlobalType("RegExp");
|
||||
globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
|
||||
globalClassDecoratorType = getGlobalType("ClassDecorator");
|
||||
globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
|
||||
globalMethodDecoratorType = getGlobalType("MethodDecorator");
|
||||
globalParameterDecoratorType = getGlobalType("ParameterDecorator");
|
||||
getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); });
|
||||
getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); });
|
||||
getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); });
|
||||
getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); });
|
||||
// If we're in ES6 mode, load the TemplateStringsArray.
|
||||
// Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
|
||||
if (languageVersion >= 2 /* ES6 */) {
|
||||
|
@ -25863,7 +25861,7 @@ var ts;
|
|||
write(";");
|
||||
emitOptional(" ", node.condition);
|
||||
write(";");
|
||||
emitOptional(" ", node.iterator);
|
||||
emitOptional(" ", node.incrementor);
|
||||
write(")");
|
||||
emitEmbeddedStatement(node.statement);
|
||||
}
|
||||
|
@ -28164,25 +28162,24 @@ var ts;
|
|||
write("}");
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
function emitAMDDependencies(node, includeNonAmdDependencies) {
|
||||
// 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
|
||||
var aliasedModuleNames = []; // names of modules with corresponding parameter in the
|
||||
var aliasedModuleNames = []; // names of modules with corresponding parameter in the
|
||||
// factory function.
|
||||
var unaliasedModuleNames = []; // names of modules with no corresponding parameters in
|
||||
// factory function.
|
||||
var importAliasNames = []; // names of the parameters in the factory function; these
|
||||
// paramters need to match the indexes of the corresponding
|
||||
var importAliasNames = []; // 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
|
||||
for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) {
|
||||
|
@ -28203,7 +28200,7 @@ var ts;
|
|||
if (moduleName.kind === 8 /* StringLiteral */) {
|
||||
externalModuleName = getLiteralText(moduleName);
|
||||
}
|
||||
// Find the name of the module alais, if there is one
|
||||
// Find the name of the module alias, if there is one
|
||||
var importAliasName = void 0;
|
||||
var namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
||||
if (namespaceDeclaration && !isDefaultImport(importNode)) {
|
||||
|
@ -28212,7 +28209,7 @@ var ts;
|
|||
else {
|
||||
importAliasName = getGeneratedNameForNode(importNode);
|
||||
}
|
||||
if (importAliasName) {
|
||||
if (includeNonAmdDependencies && importAliasName) {
|
||||
aliasedModuleNames.push(externalModuleName);
|
||||
importAliasNames.push(importAliasName);
|
||||
}
|
||||
|
@ -28220,11 +28217,6 @@ var ts;
|
|||
unaliasedModuleNames.push(externalModuleName);
|
||||
}
|
||||
}
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
write("[\"require\", \"exports\"");
|
||||
if (aliasedModuleNames.length) {
|
||||
write(", ");
|
||||
|
@ -28239,6 +28231,15 @@ var ts;
|
|||
write(", ");
|
||||
write(importAliasNames.join(", "));
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
emitAMDDependencies(node, true);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
|
@ -28258,6 +28259,22 @@ var ts;
|
|||
emitTempDeclarations(true);
|
||||
emitExportEquals(false);
|
||||
}
|
||||
function emitUMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
// Module is detected first to support Browserify users that load into a browser with an AMD loader
|
||||
writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})(");
|
||||
emitAMDDependencies(node, false);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(true);
|
||||
emitExportEquals(true);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
}
|
||||
function emitES6Module(node, startIndex) {
|
||||
externalImports = undefined;
|
||||
exportSpecifiers = undefined;
|
||||
|
@ -28334,6 +28351,9 @@ var ts;
|
|||
else if (compilerOptions.module === 2 /* AMD */) {
|
||||
emitAMDModule(node, startIndex);
|
||||
}
|
||||
else if (compilerOptions.module === 3 /* UMD */) {
|
||||
emitUMDModule(node, startIndex);
|
||||
}
|
||||
else {
|
||||
emitCommonJSModule(node, startIndex);
|
||||
}
|
||||
|
@ -29192,7 +29212,7 @@ var ts;
|
|||
}
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.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
|
||||
// if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted
|
||||
|
@ -29279,11 +29299,12 @@ var ts;
|
|||
shortName: "m",
|
||||
type: {
|
||||
"commonjs": 1 /* CommonJS */,
|
||||
"amd": 2 /* AMD */
|
||||
"amd": 2 /* AMD */,
|
||||
"umd": 3 /* UMD */
|
||||
},
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd,
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd,
|
||||
paramType: ts.Diagnostics.KIND,
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
|
@ -29379,7 +29400,7 @@ var ts;
|
|||
type: { "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES6 */ },
|
||||
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: ts.Diagnostics.VERSION,
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
|
@ -32804,6 +32825,10 @@ var ts;
|
|||
case 169 /* BinaryExpression */:
|
||||
case 170 /* ConditionalExpression */:
|
||||
return true;
|
||||
// equals in binding elements: function foo([[x, y] = [1, 2]])
|
||||
case 152 /* BindingElement */:
|
||||
// equals in type X = ...
|
||||
case 203 /* TypeAliasDeclaration */:
|
||||
// equal in import a = module('a');
|
||||
case 208 /* ImportEqualsDeclaration */:
|
||||
// equal in let a = 0;
|
||||
|
@ -32820,8 +32845,6 @@ var ts;
|
|||
// Technically, "of" is not a binary operator, but format it the same way as "in"
|
||||
case 188 /* ForOfStatement */:
|
||||
return context.currentTokenSpan.kind === 125 /* OfKeyword */ || context.nextTokenSpan.kind === 125 /* OfKeyword */;
|
||||
case 152 /* BindingElement */:
|
||||
return context.currentTokenSpan.kind === 53 /* EqualsToken */ || context.nextTokenSpan.kind === 53 /* EqualsToken */;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
@ -40481,8 +40504,8 @@ var ts;
|
|||
if (forStatement.condition) {
|
||||
return textSpan(forStatement.condition);
|
||||
}
|
||||
if (forStatement.iterator) {
|
||||
return textSpan(forStatement.iterator);
|
||||
if (forStatement.incrementor) {
|
||||
return textSpan(forStatement.incrementor);
|
||||
}
|
||||
}
|
||||
// Tokens:
|
||||
|
|
|
@ -597,7 +597,7 @@ declare module ts {
|
|||
interface ForStatement extends IterationStatement {
|
||||
initializer?: VariableDeclarationList | Expression;
|
||||
condition?: Expression;
|
||||
iterator?: Expression;
|
||||
incrementor?: Expression;
|
||||
}
|
||||
interface ForInStatement extends IterationStatement {
|
||||
initializer: VariableDeclarationList | Expression;
|
||||
|
@ -1005,15 +1005,17 @@ declare module ts {
|
|||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments: Type[];
|
||||
|
@ -1110,6 +1112,7 @@ declare module ts {
|
|||
None = 0,
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
}
|
||||
interface LineAndCharacter {
|
||||
line: number;
|
||||
|
|
|
@ -541,6 +541,7 @@ var ts;
|
|||
ModuleKind[ModuleKind["None"] = 0] = "None";
|
||||
ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS";
|
||||
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
|
||||
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
|
||||
})(ts.ModuleKind || (ts.ModuleKind = {}));
|
||||
var ModuleKind = ts.ModuleKind;
|
||||
(function (ScriptTarget) {
|
||||
|
@ -960,6 +961,17 @@ var ts;
|
|||
return result;
|
||||
}
|
||||
ts.arrayToMap = arrayToMap;
|
||||
function memoize(callback) {
|
||||
var value;
|
||||
return function () {
|
||||
if (callback) {
|
||||
value = callback();
|
||||
callback = undefined;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
ts.memoize = memoize;
|
||||
function formatStringFromArgs(text, args, baseIndex) {
|
||||
baseIndex = baseIndex || 0;
|
||||
return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; });
|
||||
|
@ -1798,7 +1810,7 @@ var ts;
|
|||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.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: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
|
@ -2100,7 +2112,7 @@ var ts;
|
|||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." },
|
||||
Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." },
|
||||
|
@ -2121,8 +2133,8 @@ var ts;
|
|||
Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: ts.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: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
|
@ -2478,7 +2490,7 @@ var ts;
|
|||
function isLineBreak(ch) {
|
||||
// ES5 7.3:
|
||||
// The ECMAScript line terminator characters are listed in Table 3.
|
||||
// Table 3 <20> Line Terminator Characters
|
||||
// Table 3: Line Terminator Characters
|
||||
// Code Unit Value Name Formal Name
|
||||
// \u000A Line Feed <LF>
|
||||
// \u000D Carriage Return <CR>
|
||||
|
@ -3766,10 +3778,7 @@ var ts;
|
|||
parent = node;
|
||||
if (symbolKind & 262128 /* IsContainer */) {
|
||||
container = node;
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = container;
|
||||
}
|
||||
lastContainer = container;
|
||||
addToContainerChain(container);
|
||||
}
|
||||
if (isBlockScopeContainer) {
|
||||
// in incremental scenarios we might reuse nodes that already have locals being allocated
|
||||
|
@ -3785,6 +3794,12 @@ var ts;
|
|||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
function addToContainerChain(node) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = node;
|
||||
}
|
||||
lastContainer = node;
|
||||
}
|
||||
function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) {
|
||||
switch (container.kind) {
|
||||
case 205 /* ModuleDeclaration */:
|
||||
|
@ -3918,6 +3933,7 @@ var ts;
|
|||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
addToContainerChain(blockScopeContainer);
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
|
@ -4820,7 +4836,7 @@ var ts;
|
|||
var forStatement = parent_1;
|
||||
return (forStatement.initializer === node && forStatement.initializer.kind !== 199 /* VariableDeclarationList */) ||
|
||||
forStatement.condition === node ||
|
||||
forStatement.iterator === node;
|
||||
forStatement.incrementor === node;
|
||||
case 187 /* ForInStatement */:
|
||||
case 188 /* ForOfStatement */:
|
||||
var forInStatement = parent_1;
|
||||
|
@ -6079,7 +6095,7 @@ var ts;
|
|||
case 186 /* ForStatement */:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
visitNode(cbNode, node.condition) ||
|
||||
visitNode(cbNode, node.iterator) ||
|
||||
visitNode(cbNode, node.incrementor) ||
|
||||
visitNode(cbNode, node.statement);
|
||||
case 187 /* ForInStatement */:
|
||||
return visitNode(cbNode, node.initializer) ||
|
||||
|
@ -8953,7 +8969,7 @@ var ts;
|
|||
}
|
||||
parseExpected(22 /* SemicolonToken */);
|
||||
if (token !== 17 /* CloseParenToken */) {
|
||||
forStatement.iterator = allowInAnd(parseExpression);
|
||||
forStatement.incrementor = allowInAnd(parseExpression);
|
||||
}
|
||||
parseExpected(17 /* CloseParenToken */);
|
||||
forOrForInOrForOfStatement = forStatement;
|
||||
|
@ -10714,11 +10730,10 @@ var ts;
|
|||
var globalESSymbolType;
|
||||
var globalIterableType;
|
||||
var anyArrayType;
|
||||
var globalTypedPropertyDescriptorType;
|
||||
var globalClassDecoratorType;
|
||||
var globalParameterDecoratorType;
|
||||
var globalPropertyDecoratorType;
|
||||
var globalMethodDecoratorType;
|
||||
var getGlobalClassDecoratorType;
|
||||
var getGlobalParameterDecoratorType;
|
||||
var getGlobalPropertyDecoratorType;
|
||||
var getGlobalMethodDecoratorType;
|
||||
var tupleTypes = {};
|
||||
var unionTypes = {};
|
||||
var stringLiteralTypes = {};
|
||||
|
@ -12929,10 +12944,11 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function getDeclaredTypeOfClass(symbol) {
|
||||
function getDeclaredTypeOfClassOrInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(1024 /* Class */, symbol);
|
||||
var kind = symbol.flags & 32 /* Class */ ? 1024 /* Class */ : 2048 /* Interface */;
|
||||
var type = links.declaredType = createObjectType(kind, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096 /* Reference */;
|
||||
|
@ -12942,32 +12958,6 @@ var ts;
|
|||
type.target = type;
|
||||
type.typeArguments = type.typeParameters;
|
||||
}
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = emptyArray;
|
||||
type.declaredConstructSignatures = emptyArray;
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
function getDeclaredTypeOfInterface(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
var type = links.declaredType = createObjectType(2048 /* Interface */, symbol);
|
||||
var typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= 4096 /* Reference */;
|
||||
type.typeParameters = typeParameters;
|
||||
type.instantiations = {};
|
||||
type.instantiations[getTypeListId(type.typeParameters)] = type;
|
||||
type.target = type;
|
||||
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, 0 /* String */);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */);
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
|
@ -13018,11 +13008,8 @@ var ts;
|
|||
}
|
||||
function getDeclaredTypeOfSymbol(symbol) {
|
||||
ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0);
|
||||
if (symbol.flags & 32 /* Class */) {
|
||||
return getDeclaredTypeOfClass(symbol);
|
||||
}
|
||||
if (symbol.flags & 64 /* Interface */) {
|
||||
return getDeclaredTypeOfInterface(symbol);
|
||||
if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) {
|
||||
return getDeclaredTypeOfClassOrInterface(symbol);
|
||||
}
|
||||
if (symbol.flags & 524288 /* TypeAlias */) {
|
||||
return getDeclaredTypeOfTypeAlias(symbol);
|
||||
|
@ -13070,15 +13057,27 @@ var ts;
|
|||
}
|
||||
}
|
||||
}
|
||||
function resolveDeclaredMembers(type) {
|
||||
if (!type.declaredProperties) {
|
||||
var symbol = type.symbol;
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
function resolveClassOrInterfaceMembers(type) {
|
||||
var members = type.symbol.members;
|
||||
var callSignatures = type.declaredCallSignatures;
|
||||
var constructSignatures = type.declaredConstructSignatures;
|
||||
var stringIndexType = type.declaredStringIndexType;
|
||||
var numberIndexType = type.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(type);
|
||||
var target = resolveDeclaredMembers(type);
|
||||
var members = target.symbol.members;
|
||||
var callSignatures = target.declaredCallSignatures;
|
||||
var constructSignatures = target.declaredConstructSignatures;
|
||||
var stringIndexType = target.declaredStringIndexType;
|
||||
var numberIndexType = target.declaredNumberIndexType;
|
||||
var baseTypes = getBaseTypes(target);
|
||||
if (baseTypes.length) {
|
||||
members = createSymbolTable(type.declaredProperties);
|
||||
members = createSymbolTable(target.declaredProperties);
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var baseType = baseTypes[_i];
|
||||
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
||||
|
@ -13091,7 +13090,7 @@ var ts;
|
|||
setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType);
|
||||
}
|
||||
function resolveTypeReferenceMembers(type) {
|
||||
var target = type.target;
|
||||
var target = resolveDeclaredMembers(type.target);
|
||||
var mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
||||
var members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
||||
var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
||||
|
@ -13236,7 +13235,7 @@ var ts;
|
|||
callSignatures = getSignaturesOfSymbol(symbol);
|
||||
}
|
||||
if (symbol.flags & 32 /* Class */) {
|
||||
var classType = getDeclaredTypeOfClass(symbol);
|
||||
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
||||
constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]);
|
||||
if (!constructSignatures.length) {
|
||||
constructSignatures = getDefaultConstructSignatures(classType);
|
||||
|
@ -13343,7 +13342,7 @@ var ts;
|
|||
var type = getApparentType(current);
|
||||
if (type !== unknownType) {
|
||||
var prop = getPropertyOfType(type, name);
|
||||
if (!prop) {
|
||||
if (!prop || getDeclarationFlagsFromSymbol(prop) & (32 /* Private */ | 64 /* Protected */)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!props) {
|
||||
|
@ -13462,7 +13461,7 @@ var ts;
|
|||
function getSignatureFromDeclaration(declaration) {
|
||||
var links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
var classType = declaration.kind === 135 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined;
|
||||
var classType = declaration.kind === 135 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined;
|
||||
var typeParameters = classType ? classType.typeParameters :
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
|
||||
var parameters = [];
|
||||
|
@ -18691,21 +18690,21 @@ var ts;
|
|||
case 201 /* ClassDeclaration */:
|
||||
var classSymbol = getSymbolOfNode(node.parent);
|
||||
var classConstructorType = getTypeOfSymbol(classSymbol);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]);
|
||||
var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]);
|
||||
checkTypeAssignableTo(exprType, classDecoratorType, node);
|
||||
break;
|
||||
case 132 /* PropertyDeclaration */:
|
||||
checkTypeAssignableTo(exprType, globalPropertyDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node);
|
||||
break;
|
||||
case 134 /* MethodDeclaration */:
|
||||
case 136 /* GetAccessor */:
|
||||
case 137 /* SetAccessor */:
|
||||
var methodType = getTypeOfNode(node.parent);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]);
|
||||
var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]);
|
||||
checkTypeAssignableTo(exprType, methodDecoratorType, node);
|
||||
break;
|
||||
case 129 /* Parameter */:
|
||||
checkTypeAssignableTo(exprType, globalParameterDecoratorType, node);
|
||||
checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -19178,8 +19177,8 @@ var ts;
|
|||
}
|
||||
if (node.condition)
|
||||
checkExpression(node.condition);
|
||||
if (node.iterator)
|
||||
checkExpression(node.iterator);
|
||||
if (node.incrementor)
|
||||
checkExpression(node.incrementor);
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
function checkForOfStatement(node) {
|
||||
|
@ -19860,7 +19859,7 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
var seen = {};
|
||||
ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });
|
||||
var ok = true;
|
||||
for (var _i = 0; _i < baseTypes.length; _i++) {
|
||||
var base = baseTypes[_i];
|
||||
|
@ -21520,11 +21519,10 @@ var ts;
|
|||
globalNumberType = getGlobalType("Number");
|
||||
globalBooleanType = getGlobalType("Boolean");
|
||||
globalRegExpType = getGlobalType("RegExp");
|
||||
globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
|
||||
globalClassDecoratorType = getGlobalType("ClassDecorator");
|
||||
globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
|
||||
globalMethodDecoratorType = getGlobalType("MethodDecorator");
|
||||
globalParameterDecoratorType = getGlobalType("ParameterDecorator");
|
||||
getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); });
|
||||
getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); });
|
||||
getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); });
|
||||
getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); });
|
||||
// If we're in ES6 mode, load the TemplateStringsArray.
|
||||
// Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
|
||||
if (languageVersion >= 2 /* ES6 */) {
|
||||
|
@ -25863,7 +25861,7 @@ var ts;
|
|||
write(";");
|
||||
emitOptional(" ", node.condition);
|
||||
write(";");
|
||||
emitOptional(" ", node.iterator);
|
||||
emitOptional(" ", node.incrementor);
|
||||
write(")");
|
||||
emitEmbeddedStatement(node.statement);
|
||||
}
|
||||
|
@ -28164,25 +28162,24 @@ var ts;
|
|||
write("}");
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
function emitAMDDependencies(node, includeNonAmdDependencies) {
|
||||
// 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
|
||||
var aliasedModuleNames = []; // names of modules with corresponding parameter in the
|
||||
var aliasedModuleNames = []; // names of modules with corresponding parameter in the
|
||||
// factory function.
|
||||
var unaliasedModuleNames = []; // names of modules with no corresponding parameters in
|
||||
// factory function.
|
||||
var importAliasNames = []; // names of the parameters in the factory function; these
|
||||
// paramters need to match the indexes of the corresponding
|
||||
var importAliasNames = []; // 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
|
||||
for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) {
|
||||
|
@ -28203,7 +28200,7 @@ var ts;
|
|||
if (moduleName.kind === 8 /* StringLiteral */) {
|
||||
externalModuleName = getLiteralText(moduleName);
|
||||
}
|
||||
// Find the name of the module alais, if there is one
|
||||
// Find the name of the module alias, if there is one
|
||||
var importAliasName = void 0;
|
||||
var namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
||||
if (namespaceDeclaration && !isDefaultImport(importNode)) {
|
||||
|
@ -28212,7 +28209,7 @@ var ts;
|
|||
else {
|
||||
importAliasName = getGeneratedNameForNode(importNode);
|
||||
}
|
||||
if (importAliasName) {
|
||||
if (includeNonAmdDependencies && importAliasName) {
|
||||
aliasedModuleNames.push(externalModuleName);
|
||||
importAliasNames.push(importAliasName);
|
||||
}
|
||||
|
@ -28220,11 +28217,6 @@ var ts;
|
|||
unaliasedModuleNames.push(externalModuleName);
|
||||
}
|
||||
}
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
write("[\"require\", \"exports\"");
|
||||
if (aliasedModuleNames.length) {
|
||||
write(", ");
|
||||
|
@ -28239,6 +28231,15 @@ var ts;
|
|||
write(", ");
|
||||
write(importAliasNames.join(", "));
|
||||
}
|
||||
}
|
||||
function emitAMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
writeLine();
|
||||
write("define(");
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
emitAMDDependencies(node, true);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
|
@ -28258,6 +28259,22 @@ var ts;
|
|||
emitTempDeclarations(true);
|
||||
emitExportEquals(false);
|
||||
}
|
||||
function emitUMDModule(node, startIndex) {
|
||||
collectExternalModuleInfo(node);
|
||||
// Module is detected first to support Browserify users that load into a browser with an AMD loader
|
||||
writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})(");
|
||||
emitAMDDependencies(node, false);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
emitTempDeclarations(true);
|
||||
emitExportEquals(true);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
}
|
||||
function emitES6Module(node, startIndex) {
|
||||
externalImports = undefined;
|
||||
exportSpecifiers = undefined;
|
||||
|
@ -28334,6 +28351,9 @@ var ts;
|
|||
else if (compilerOptions.module === 2 /* AMD */) {
|
||||
emitAMDModule(node, startIndex);
|
||||
}
|
||||
else if (compilerOptions.module === 3 /* UMD */) {
|
||||
emitUMDModule(node, startIndex);
|
||||
}
|
||||
else {
|
||||
emitCommonJSModule(node, startIndex);
|
||||
}
|
||||
|
@ -29192,7 +29212,7 @@ var ts;
|
|||
}
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.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
|
||||
// if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted
|
||||
|
@ -29279,11 +29299,12 @@ var ts;
|
|||
shortName: "m",
|
||||
type: {
|
||||
"commonjs": 1 /* CommonJS */,
|
||||
"amd": 2 /* AMD */
|
||||
"amd": 2 /* AMD */,
|
||||
"umd": 3 /* UMD */
|
||||
},
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd,
|
||||
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd,
|
||||
paramType: ts.Diagnostics.KIND,
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd
|
||||
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
|
@ -29379,7 +29400,7 @@ var ts;
|
|||
type: { "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES6 */ },
|
||||
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: ts.Diagnostics.VERSION,
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
|
@ -32804,6 +32825,10 @@ var ts;
|
|||
case 169 /* BinaryExpression */:
|
||||
case 170 /* ConditionalExpression */:
|
||||
return true;
|
||||
// equals in binding elements: function foo([[x, y] = [1, 2]])
|
||||
case 152 /* BindingElement */:
|
||||
// equals in type X = ...
|
||||
case 203 /* TypeAliasDeclaration */:
|
||||
// equal in import a = module('a');
|
||||
case 208 /* ImportEqualsDeclaration */:
|
||||
// equal in let a = 0;
|
||||
|
@ -32820,8 +32845,6 @@ var ts;
|
|||
// Technically, "of" is not a binary operator, but format it the same way as "in"
|
||||
case 188 /* ForOfStatement */:
|
||||
return context.currentTokenSpan.kind === 125 /* OfKeyword */ || context.nextTokenSpan.kind === 125 /* OfKeyword */;
|
||||
case 152 /* BindingElement */:
|
||||
return context.currentTokenSpan.kind === 53 /* EqualsToken */ || context.nextTokenSpan.kind === 53 /* EqualsToken */;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
@ -40481,8 +40504,8 @@ var ts;
|
|||
if (forStatement.condition) {
|
||||
return textSpan(forStatement.condition);
|
||||
}
|
||||
if (forStatement.iterator) {
|
||||
return textSpan(forStatement.iterator);
|
||||
if (forStatement.incrementor) {
|
||||
return textSpan(forStatement.incrementor);
|
||||
}
|
||||
}
|
||||
// Tokens:
|
||||
|
|
Загрузка…
Ссылка в новой задаче