mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merge with master
This commit is contained in:
+3
-2
@@ -588,9 +588,10 @@ function deleteTemporaryProjectOutput() {
|
||||
}
|
||||
|
||||
var testTimeout = 20000;
|
||||
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.");
|
||||
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]', debug=true.");
|
||||
task("runtests", ["tests", builtLocalDirectory], function() {
|
||||
cleanTestDirs();
|
||||
var debug = process.env.debug || process.env.d;
|
||||
host = "mocha"
|
||||
tests = process.env.test || process.env.tests || process.env.t;
|
||||
var light = process.env.light || false;
|
||||
@@ -613,7 +614,7 @@ task("runtests", ["tests", builtLocalDirectory], function() {
|
||||
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
|
||||
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
|
||||
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
|
||||
var cmd = host + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
|
||||
var cmd = host + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
|
||||
console.log(cmd);
|
||||
exec(cmd, deleteTemporaryProjectOutput);
|
||||
}, {async: true});
|
||||
|
||||
+55
-87
@@ -1573,6 +1573,7 @@ var ts;
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." },
|
||||
Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
@@ -12680,7 +12681,7 @@ var ts;
|
||||
return members;
|
||||
}
|
||||
function resolveTupleTypeMembers(type) {
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes)));
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, true)));
|
||||
var members = createTupleTypeMemberSymbols(type.elementTypes);
|
||||
addInheritedMembers(members, arrayType.properties);
|
||||
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType);
|
||||
@@ -12972,25 +12973,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896 && type !== globalObjectType) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
return !!(resolved.properties.length === 0 ||
|
||||
resolved.stringIndexType ||
|
||||
resolved.numberIndexType ||
|
||||
getPropertyOfType(type, name));
|
||||
}
|
||||
if (type.flags & 49152) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function getSignaturesOfStructuredType(type, kind) {
|
||||
if (type.flags & 130048) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
@@ -13446,7 +13428,7 @@ var ts;
|
||||
}
|
||||
function createTypedPropertyDescriptorType(propertyType) {
|
||||
var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();
|
||||
return globalTypedPropertyDescriptorType !== emptyObjectType
|
||||
return globalTypedPropertyDescriptorType !== emptyGenericType
|
||||
? createTypeReference(globalTypedPropertyDescriptorType, [propertyType])
|
||||
: emptyObjectType;
|
||||
}
|
||||
@@ -13499,68 +13481,19 @@ var ts;
|
||||
addTypeToSet(typeSet, type, typeSetKind);
|
||||
}
|
||||
}
|
||||
function isObjectLiteralTypeDuplicateOf(source, target) {
|
||||
var sourceProperties = getPropertiesOfObjectType(source);
|
||||
var targetProperties = getPropertiesOfObjectType(target);
|
||||
if (sourceProperties.length !== targetProperties.length) {
|
||||
return false;
|
||||
}
|
||||
for (var _i = 0; _i < sourceProperties.length; _i++) {
|
||||
var sourceProp = sourceProperties[_i];
|
||||
var targetProp = getPropertyOfObjectType(target, sourceProp.name);
|
||||
if (!targetProp ||
|
||||
getDeclarationFlagsFromSymbol(targetProp) & (32 | 64) ||
|
||||
!isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isTupleTypeDuplicateOf(source, target) {
|
||||
var sourceTypes = source.elementTypes;
|
||||
var targetTypes = target.elementTypes;
|
||||
if (sourceTypes.length !== targetTypes.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < sourceTypes.length; i++) {
|
||||
if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isTypeDuplicateOf(source, target) {
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 32 || source.flags & 64 && !(target.flags & 32)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 && target.flags & 80896) {
|
||||
return isObjectLiteralTypeDuplicateOf(source, target);
|
||||
}
|
||||
if (isArrayType(source) && isArrayType(target)) {
|
||||
return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]);
|
||||
}
|
||||
if (isTupleType(source) && isTupleType(target)) {
|
||||
return isTupleTypeDuplicateOf(source, target);
|
||||
}
|
||||
return isTypeIdenticalTo(source, target);
|
||||
}
|
||||
function isTypeDuplicateOfSomeType(candidate, types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
var type = types[_i];
|
||||
if (candidate !== type && isTypeDuplicateOf(candidate, type)) {
|
||||
function isSubtypeOfAny(candidate, types) {
|
||||
for (var i = 0, len = types.length; i < len; i++) {
|
||||
if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function removeDuplicateTypes(types) {
|
||||
function removeSubtypes(types) {
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
if (isTypeDuplicateOfSomeType(types[i], types)) {
|
||||
if (isSubtypeOfAny(types[i], types)) {
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
@@ -13583,7 +13516,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getUnionType(types, noDeduplication) {
|
||||
function getUnionType(types, noSubtypeReduction) {
|
||||
if (types.length === 0) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
@@ -13592,12 +13525,12 @@ var ts;
|
||||
if (containsTypeAny(typeSet)) {
|
||||
return anyType;
|
||||
}
|
||||
if (noDeduplication) {
|
||||
if (noSubtypeReduction) {
|
||||
removeAllButLast(typeSet, undefinedType);
|
||||
removeAllButLast(typeSet, nullType);
|
||||
}
|
||||
else {
|
||||
removeDuplicateTypes(typeSet);
|
||||
removeSubtypes(typeSet);
|
||||
}
|
||||
if (typeSet.length === 1) {
|
||||
return typeSet[0];
|
||||
@@ -14091,6 +14024,26 @@ var ts;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) ||
|
||||
resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (type.flags & 49152) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function hasExcessProperties(source, target, reportErrors) {
|
||||
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
|
||||
var prop = _a[_i];
|
||||
@@ -14763,7 +14716,7 @@ var ts;
|
||||
return getWidenedTypeOfObjectLiteral(type);
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.map(type.types, getWidenedType));
|
||||
return getUnionType(ts.map(type.types, getWidenedType), true);
|
||||
}
|
||||
if (isArrayType(type)) {
|
||||
return createArrayType(getWidenedType(type.typeArguments[0]));
|
||||
@@ -15973,7 +15926,7 @@ var ts;
|
||||
var propertiesTable = {};
|
||||
var propertiesArray = [];
|
||||
var contextualType = getContextualType(node);
|
||||
var typeFlags;
|
||||
var typeFlags = 0;
|
||||
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
||||
var memberDecl = _a[_i];
|
||||
var member = memberDecl.symbol;
|
||||
@@ -16014,7 +15967,8 @@ var ts;
|
||||
var stringIndexType = getIndexType(0);
|
||||
var numberIndexType = getIndexType(1);
|
||||
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType);
|
||||
result.flags |= 524288 | 1048576 | 4194304 | (typeFlags & 14680064);
|
||||
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576;
|
||||
result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064);
|
||||
return result;
|
||||
function getIndexType(kind) {
|
||||
if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) {
|
||||
@@ -17260,7 +17214,7 @@ var ts;
|
||||
}
|
||||
function createPromiseType(promisedType) {
|
||||
var globalPromiseType = getGlobalPromiseType();
|
||||
if (globalPromiseType !== emptyObjectType) {
|
||||
if (globalPromiseType !== emptyGenericType) {
|
||||
promisedType = getAwaitedType(promisedType);
|
||||
return createTypeReference(globalPromiseType, [promisedType]);
|
||||
}
|
||||
@@ -19714,6 +19668,7 @@ var ts;
|
||||
if (baseTypes.length && produceDiagnostics) {
|
||||
var baseType = baseTypes[0];
|
||||
var staticBaseType = getBaseConstructorTypeOfClass(type);
|
||||
checkSourceElement(baseTypeNode.expression);
|
||||
if (baseTypeNode.typeArguments) {
|
||||
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
|
||||
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) {
|
||||
@@ -20613,6 +20568,8 @@ var ts;
|
||||
case 209:
|
||||
case 210:
|
||||
case 212:
|
||||
case 241:
|
||||
case 186:
|
||||
case 215:
|
||||
case 245:
|
||||
case 225:
|
||||
@@ -21338,7 +21295,7 @@ var ts;
|
||||
}
|
||||
function createInstantiatedPromiseLikeType() {
|
||||
var promiseLikeType = getGlobalPromiseLikeType();
|
||||
if (promiseLikeType !== emptyObjectType) {
|
||||
if (promiseLikeType !== emptyGenericType) {
|
||||
return createTypeReference(promiseLikeType, [anyType]);
|
||||
}
|
||||
return emptyObjectType;
|
||||
@@ -24454,8 +24411,12 @@ var ts;
|
||||
}
|
||||
}
|
||||
function emitJsxElement(openingNode, children) {
|
||||
var syntheticReactRef = ts.createSynthesizedNode(67);
|
||||
syntheticReactRef.text = 'React';
|
||||
syntheticReactRef.parent = openingNode;
|
||||
emitLeadingComments(openingNode);
|
||||
write("React.createElement(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".createElement(");
|
||||
emitTagName(openingNode.tagName);
|
||||
write(", ");
|
||||
if (openingNode.attributes.length === 0) {
|
||||
@@ -24464,7 +24425,8 @@ var ts;
|
||||
else {
|
||||
var attrs = openingNode.attributes;
|
||||
if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) {
|
||||
write("React.__spread(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".__spread(");
|
||||
var haveOpenedObjectLiteral = false;
|
||||
for (var i_1 = 0; i_1 < attrs.length; i_1++) {
|
||||
if (attrs[i_1].kind === 237) {
|
||||
@@ -30376,6 +30338,12 @@ var ts;
|
||||
description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
paramType: ts.Diagnostics.LOCATION
|
||||
},
|
||||
{
|
||||
name: "suppressExcessPropertyErrors",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,
|
||||
experimental: true
|
||||
},
|
||||
{
|
||||
name: "suppressImplicitAnyIndexErrors",
|
||||
type: "boolean",
|
||||
@@ -30450,7 +30418,7 @@ var ts;
|
||||
return optionNameMapCache;
|
||||
}
|
||||
ts.getOptionNameMap = getOptionNameMap;
|
||||
function parseCommandLine(commandLine) {
|
||||
function parseCommandLine(commandLine, readFile) {
|
||||
var options = {};
|
||||
var fileNames = [];
|
||||
var errors = [];
|
||||
@@ -30509,7 +30477,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function parseResponseFile(fileName) {
|
||||
var text = ts.sys.readFile(fileName);
|
||||
var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);
|
||||
if (!text) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));
|
||||
return;
|
||||
|
||||
+55
-87
@@ -1573,6 +1573,7 @@ var ts;
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." },
|
||||
Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
@@ -3163,6 +3164,12 @@ var ts;
|
||||
description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
paramType: ts.Diagnostics.LOCATION
|
||||
},
|
||||
{
|
||||
name: "suppressExcessPropertyErrors",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,
|
||||
experimental: true
|
||||
},
|
||||
{
|
||||
name: "suppressImplicitAnyIndexErrors",
|
||||
type: "boolean",
|
||||
@@ -3237,7 +3244,7 @@ var ts;
|
||||
return optionNameMapCache;
|
||||
}
|
||||
ts.getOptionNameMap = getOptionNameMap;
|
||||
function parseCommandLine(commandLine) {
|
||||
function parseCommandLine(commandLine, readFile) {
|
||||
var options = {};
|
||||
var fileNames = [];
|
||||
var errors = [];
|
||||
@@ -3296,7 +3303,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function parseResponseFile(fileName) {
|
||||
var text = ts.sys.readFile(fileName);
|
||||
var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);
|
||||
if (!text) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));
|
||||
return;
|
||||
@@ -13136,7 +13143,7 @@ var ts;
|
||||
return members;
|
||||
}
|
||||
function resolveTupleTypeMembers(type) {
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes)));
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, true)));
|
||||
var members = createTupleTypeMemberSymbols(type.elementTypes);
|
||||
addInheritedMembers(members, arrayType.properties);
|
||||
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType);
|
||||
@@ -13428,25 +13435,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896 && type !== globalObjectType) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
return !!(resolved.properties.length === 0 ||
|
||||
resolved.stringIndexType ||
|
||||
resolved.numberIndexType ||
|
||||
getPropertyOfType(type, name));
|
||||
}
|
||||
if (type.flags & 49152) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function getSignaturesOfStructuredType(type, kind) {
|
||||
if (type.flags & 130048) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
@@ -13902,7 +13890,7 @@ var ts;
|
||||
}
|
||||
function createTypedPropertyDescriptorType(propertyType) {
|
||||
var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();
|
||||
return globalTypedPropertyDescriptorType !== emptyObjectType
|
||||
return globalTypedPropertyDescriptorType !== emptyGenericType
|
||||
? createTypeReference(globalTypedPropertyDescriptorType, [propertyType])
|
||||
: emptyObjectType;
|
||||
}
|
||||
@@ -13955,68 +13943,19 @@ var ts;
|
||||
addTypeToSet(typeSet, type, typeSetKind);
|
||||
}
|
||||
}
|
||||
function isObjectLiteralTypeDuplicateOf(source, target) {
|
||||
var sourceProperties = getPropertiesOfObjectType(source);
|
||||
var targetProperties = getPropertiesOfObjectType(target);
|
||||
if (sourceProperties.length !== targetProperties.length) {
|
||||
return false;
|
||||
}
|
||||
for (var _i = 0; _i < sourceProperties.length; _i++) {
|
||||
var sourceProp = sourceProperties[_i];
|
||||
var targetProp = getPropertyOfObjectType(target, sourceProp.name);
|
||||
if (!targetProp ||
|
||||
getDeclarationFlagsFromSymbol(targetProp) & (32 | 64) ||
|
||||
!isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isTupleTypeDuplicateOf(source, target) {
|
||||
var sourceTypes = source.elementTypes;
|
||||
var targetTypes = target.elementTypes;
|
||||
if (sourceTypes.length !== targetTypes.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < sourceTypes.length; i++) {
|
||||
if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isTypeDuplicateOf(source, target) {
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 32 || source.flags & 64 && !(target.flags & 32)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 && target.flags & 80896) {
|
||||
return isObjectLiteralTypeDuplicateOf(source, target);
|
||||
}
|
||||
if (isArrayType(source) && isArrayType(target)) {
|
||||
return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]);
|
||||
}
|
||||
if (isTupleType(source) && isTupleType(target)) {
|
||||
return isTupleTypeDuplicateOf(source, target);
|
||||
}
|
||||
return isTypeIdenticalTo(source, target);
|
||||
}
|
||||
function isTypeDuplicateOfSomeType(candidate, types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
var type = types[_i];
|
||||
if (candidate !== type && isTypeDuplicateOf(candidate, type)) {
|
||||
function isSubtypeOfAny(candidate, types) {
|
||||
for (var i = 0, len = types.length; i < len; i++) {
|
||||
if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function removeDuplicateTypes(types) {
|
||||
function removeSubtypes(types) {
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
if (isTypeDuplicateOfSomeType(types[i], types)) {
|
||||
if (isSubtypeOfAny(types[i], types)) {
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
@@ -14039,7 +13978,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getUnionType(types, noDeduplication) {
|
||||
function getUnionType(types, noSubtypeReduction) {
|
||||
if (types.length === 0) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
@@ -14048,12 +13987,12 @@ var ts;
|
||||
if (containsTypeAny(typeSet)) {
|
||||
return anyType;
|
||||
}
|
||||
if (noDeduplication) {
|
||||
if (noSubtypeReduction) {
|
||||
removeAllButLast(typeSet, undefinedType);
|
||||
removeAllButLast(typeSet, nullType);
|
||||
}
|
||||
else {
|
||||
removeDuplicateTypes(typeSet);
|
||||
removeSubtypes(typeSet);
|
||||
}
|
||||
if (typeSet.length === 1) {
|
||||
return typeSet[0];
|
||||
@@ -14547,6 +14486,26 @@ var ts;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) ||
|
||||
resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (type.flags & 49152) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function hasExcessProperties(source, target, reportErrors) {
|
||||
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
|
||||
var prop = _a[_i];
|
||||
@@ -15219,7 +15178,7 @@ var ts;
|
||||
return getWidenedTypeOfObjectLiteral(type);
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.map(type.types, getWidenedType));
|
||||
return getUnionType(ts.map(type.types, getWidenedType), true);
|
||||
}
|
||||
if (isArrayType(type)) {
|
||||
return createArrayType(getWidenedType(type.typeArguments[0]));
|
||||
@@ -16429,7 +16388,7 @@ var ts;
|
||||
var propertiesTable = {};
|
||||
var propertiesArray = [];
|
||||
var contextualType = getContextualType(node);
|
||||
var typeFlags;
|
||||
var typeFlags = 0;
|
||||
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
||||
var memberDecl = _a[_i];
|
||||
var member = memberDecl.symbol;
|
||||
@@ -16470,7 +16429,8 @@ var ts;
|
||||
var stringIndexType = getIndexType(0);
|
||||
var numberIndexType = getIndexType(1);
|
||||
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType);
|
||||
result.flags |= 524288 | 1048576 | 4194304 | (typeFlags & 14680064);
|
||||
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576;
|
||||
result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064);
|
||||
return result;
|
||||
function getIndexType(kind) {
|
||||
if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) {
|
||||
@@ -17716,7 +17676,7 @@ var ts;
|
||||
}
|
||||
function createPromiseType(promisedType) {
|
||||
var globalPromiseType = getGlobalPromiseType();
|
||||
if (globalPromiseType !== emptyObjectType) {
|
||||
if (globalPromiseType !== emptyGenericType) {
|
||||
promisedType = getAwaitedType(promisedType);
|
||||
return createTypeReference(globalPromiseType, [promisedType]);
|
||||
}
|
||||
@@ -20170,6 +20130,7 @@ var ts;
|
||||
if (baseTypes.length && produceDiagnostics) {
|
||||
var baseType = baseTypes[0];
|
||||
var staticBaseType = getBaseConstructorTypeOfClass(type);
|
||||
checkSourceElement(baseTypeNode.expression);
|
||||
if (baseTypeNode.typeArguments) {
|
||||
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
|
||||
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) {
|
||||
@@ -21069,6 +21030,8 @@ var ts;
|
||||
case 209:
|
||||
case 210:
|
||||
case 212:
|
||||
case 241:
|
||||
case 186:
|
||||
case 215:
|
||||
case 245:
|
||||
case 225:
|
||||
@@ -21794,7 +21757,7 @@ var ts;
|
||||
}
|
||||
function createInstantiatedPromiseLikeType() {
|
||||
var promiseLikeType = getGlobalPromiseLikeType();
|
||||
if (promiseLikeType !== emptyObjectType) {
|
||||
if (promiseLikeType !== emptyGenericType) {
|
||||
return createTypeReference(promiseLikeType, [anyType]);
|
||||
}
|
||||
return emptyObjectType;
|
||||
@@ -24910,8 +24873,12 @@ var ts;
|
||||
}
|
||||
}
|
||||
function emitJsxElement(openingNode, children) {
|
||||
var syntheticReactRef = ts.createSynthesizedNode(67);
|
||||
syntheticReactRef.text = 'React';
|
||||
syntheticReactRef.parent = openingNode;
|
||||
emitLeadingComments(openingNode);
|
||||
write("React.createElement(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".createElement(");
|
||||
emitTagName(openingNode.tagName);
|
||||
write(", ");
|
||||
if (openingNode.attributes.length === 0) {
|
||||
@@ -24920,7 +24887,8 @@ var ts;
|
||||
else {
|
||||
var attrs = openingNode.attributes;
|
||||
if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) {
|
||||
write("React.__spread(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".__spread(");
|
||||
var haveOpenedObjectLiteral = false;
|
||||
for (var i_1 = 0; i_1 < attrs.length; i_1++) {
|
||||
if (attrs[i_1].kind === 237) {
|
||||
|
||||
Vendored
+2
-1
@@ -1329,6 +1329,7 @@ declare module "typescript" {
|
||||
rootDir?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
@@ -1524,7 +1525,7 @@ declare module "typescript" {
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
|
||||
+68
-101
@@ -2442,6 +2442,7 @@ var ts;
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." },
|
||||
Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
@@ -15702,7 +15703,7 @@ var ts;
|
||||
return members;
|
||||
}
|
||||
function resolveTupleTypeMembers(type) {
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes)));
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true)));
|
||||
var members = createTupleTypeMemberSymbols(type.elementTypes);
|
||||
addInheritedMembers(members, arrayType.properties);
|
||||
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType);
|
||||
@@ -16023,29 +16024,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
// Check if a property with the given name is known anywhere in the given type. In an object
|
||||
// type, a property is considered known if the object type is empty, if it has any index
|
||||
// signatures, or if the property is actually declared in the type. In a union or intersection
|
||||
// type, a property is considered known if it is known in any constituent type.
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896 /* ObjectType */ && type !== globalObjectType) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
return !!(resolved.properties.length === 0 ||
|
||||
resolved.stringIndexType ||
|
||||
resolved.numberIndexType ||
|
||||
getPropertyOfType(type, name));
|
||||
}
|
||||
if (type.flags & 49152 /* UnionOrIntersection */) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function getSignaturesOfStructuredType(type, kind) {
|
||||
if (type.flags & 130048 /* StructuredType */) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
@@ -16559,7 +16537,7 @@ var ts;
|
||||
*/
|
||||
function createTypedPropertyDescriptorType(propertyType) {
|
||||
var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();
|
||||
return globalTypedPropertyDescriptorType !== emptyObjectType
|
||||
return globalTypedPropertyDescriptorType !== emptyGenericType
|
||||
? createTypeReference(globalTypedPropertyDescriptorType, [propertyType])
|
||||
: emptyObjectType;
|
||||
}
|
||||
@@ -16617,71 +16595,19 @@ var ts;
|
||||
addTypeToSet(typeSet, type, typeSetKind);
|
||||
}
|
||||
}
|
||||
function isObjectLiteralTypeDuplicateOf(source, target) {
|
||||
var sourceProperties = getPropertiesOfObjectType(source);
|
||||
var targetProperties = getPropertiesOfObjectType(target);
|
||||
if (sourceProperties.length !== targetProperties.length) {
|
||||
return false;
|
||||
}
|
||||
for (var _i = 0; _i < sourceProperties.length; _i++) {
|
||||
var sourceProp = sourceProperties[_i];
|
||||
var targetProp = getPropertyOfObjectType(target, sourceProp.name);
|
||||
if (!targetProp ||
|
||||
getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */) ||
|
||||
!isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isTupleTypeDuplicateOf(source, target) {
|
||||
var sourceTypes = source.elementTypes;
|
||||
var targetTypes = target.elementTypes;
|
||||
if (sourceTypes.length !== targetTypes.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < sourceTypes.length; i++) {
|
||||
if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Returns true if the source type is a duplicate of the target type. A source type is a duplicate of
|
||||
// a target type if the the two are identical, with the exception that the source type may have null or
|
||||
// undefined in places where the target type doesn't. This is by design an asymmetric relationship.
|
||||
function isTypeDuplicateOf(source, target) {
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 32 /* Undefined */ || source.flags & 64 /* Null */ && !(target.flags & 32 /* Undefined */)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 /* ObjectLiteral */ && target.flags & 80896 /* ObjectType */) {
|
||||
return isObjectLiteralTypeDuplicateOf(source, target);
|
||||
}
|
||||
if (isArrayType(source) && isArrayType(target)) {
|
||||
return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]);
|
||||
}
|
||||
if (isTupleType(source) && isTupleType(target)) {
|
||||
return isTupleTypeDuplicateOf(source, target);
|
||||
}
|
||||
return isTypeIdenticalTo(source, target);
|
||||
}
|
||||
function isTypeDuplicateOfSomeType(candidate, types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
var type = types[_i];
|
||||
if (candidate !== type && isTypeDuplicateOf(candidate, type)) {
|
||||
function isSubtypeOfAny(candidate, types) {
|
||||
for (var i = 0, len = types.length; i < len; i++) {
|
||||
if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function removeDuplicateTypes(types) {
|
||||
function removeSubtypes(types) {
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
if (isTypeDuplicateOfSomeType(types[i], types)) {
|
||||
if (isSubtypeOfAny(types[i], types)) {
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
@@ -16704,12 +16630,14 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
// We always deduplicate the constituent type set based on object identity, but we'll also deduplicate
|
||||
// based on the structure of the types unless the noDeduplication flag is true, which is the case when
|
||||
// creating a union type from a type node and when instantiating a union type. In both of those cases,
|
||||
// structural deduplication has to be deferred to properly support recursive union types. For example,
|
||||
// a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration.
|
||||
function getUnionType(types, noDeduplication) {
|
||||
// We reduce the constituent type set to only include types that aren't subtypes of other types, unless
|
||||
// the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on
|
||||
// object identity. Subtype reduction is possible only when union types are known not to circularly
|
||||
// reference themselves (as is the case with union types created by expression constructs such as array
|
||||
// literals and the || and ?: operators). Named types can circularly reference themselves and therefore
|
||||
// cannot be deduplicated during their declaration. For example, "type Item = string | (() => Item" is
|
||||
// a named type that circularly references itself.
|
||||
function getUnionType(types, noSubtypeReduction) {
|
||||
if (types.length === 0) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
@@ -16718,12 +16646,12 @@ var ts;
|
||||
if (containsTypeAny(typeSet)) {
|
||||
return anyType;
|
||||
}
|
||||
if (noDeduplication) {
|
||||
if (noSubtypeReduction) {
|
||||
removeAllButLast(typeSet, undefinedType);
|
||||
removeAllButLast(typeSet, nullType);
|
||||
}
|
||||
else {
|
||||
removeDuplicateTypes(typeSet);
|
||||
removeSubtypes(typeSet);
|
||||
}
|
||||
if (typeSet.length === 1) {
|
||||
return typeSet[0];
|
||||
@@ -16739,7 +16667,7 @@ var ts;
|
||||
function getTypeFromUnionTypeNode(node) {
|
||||
var links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true);
|
||||
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true);
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -17010,7 +16938,7 @@ var ts;
|
||||
return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType));
|
||||
}
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noDeduplication*/ true);
|
||||
return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noSubtypeReduction*/ true);
|
||||
}
|
||||
if (type.flags & 32768 /* Intersection */) {
|
||||
return getIntersectionType(instantiateList(type.types, mapper, instantiateType));
|
||||
@@ -17271,6 +17199,30 @@ var ts;
|
||||
}
|
||||
return 0 /* False */;
|
||||
}
|
||||
// Check if a property with the given name is known anywhere in the given type. In an object type, a property
|
||||
// is considered known if the object type is empty and the check is for assignability, if the object type has
|
||||
// index signatures, or if the property is actually declared in the object type. In a union or intersection
|
||||
// type, a property is considered known if it is known in any constituent type.
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896 /* ObjectType */) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) ||
|
||||
resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (type.flags & 49152 /* UnionOrIntersection */) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function hasExcessProperties(source, target, reportErrors) {
|
||||
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
|
||||
var prop = _a[_i];
|
||||
@@ -17999,7 +17951,7 @@ var ts;
|
||||
return getWidenedTypeOfObjectLiteral(type);
|
||||
}
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.map(type.types, getWidenedType));
|
||||
return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true);
|
||||
}
|
||||
if (isArrayType(type)) {
|
||||
return createArrayType(getWidenedType(type.typeArguments[0]));
|
||||
@@ -19438,7 +19390,7 @@ var ts;
|
||||
var propertiesTable = {};
|
||||
var propertiesArray = [];
|
||||
var contextualType = getContextualType(node);
|
||||
var typeFlags;
|
||||
var typeFlags = 0;
|
||||
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
||||
var memberDecl = _a[_i];
|
||||
var member = memberDecl.symbol;
|
||||
@@ -19484,7 +19436,8 @@ var ts;
|
||||
var stringIndexType = getIndexType(0 /* String */);
|
||||
var numberIndexType = getIndexType(1 /* Number */);
|
||||
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType);
|
||||
result.flags |= 524288 /* ObjectLiteral */ | 1048576 /* FreshObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | (typeFlags & 14680064 /* PropagatingFlags */);
|
||||
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */;
|
||||
result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */);
|
||||
return result;
|
||||
function getIndexType(kind) {
|
||||
if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) {
|
||||
@@ -21216,7 +21169,7 @@ var ts;
|
||||
function createPromiseType(promisedType) {
|
||||
// creates a `Promise<T>` type where `T` is the promisedType argument
|
||||
var globalPromiseType = getGlobalPromiseType();
|
||||
if (globalPromiseType !== emptyObjectType) {
|
||||
if (globalPromiseType !== emptyGenericType) {
|
||||
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
|
||||
promisedType = getAwaitedType(promisedType);
|
||||
return createTypeReference(globalPromiseType, [promisedType]);
|
||||
@@ -24248,6 +24201,7 @@ var ts;
|
||||
if (baseTypes.length && produceDiagnostics) {
|
||||
var baseType = baseTypes[0];
|
||||
var staticBaseType = getBaseConstructorTypeOfClass(type);
|
||||
checkSourceElement(baseTypeNode.expression);
|
||||
if (baseTypeNode.typeArguments) {
|
||||
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
|
||||
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) {
|
||||
@@ -25227,6 +25181,8 @@ var ts;
|
||||
case 209 /* VariableDeclaration */:
|
||||
case 210 /* VariableDeclarationList */:
|
||||
case 212 /* ClassDeclaration */:
|
||||
case 241 /* HeritageClause */:
|
||||
case 186 /* ExpressionWithTypeArguments */:
|
||||
case 215 /* EnumDeclaration */:
|
||||
case 245 /* EnumMember */:
|
||||
case 225 /* ExportAssignment */:
|
||||
@@ -26049,7 +26005,7 @@ var ts;
|
||||
}
|
||||
function createInstantiatedPromiseLikeType() {
|
||||
var promiseLikeType = getGlobalPromiseLikeType();
|
||||
if (promiseLikeType !== emptyObjectType) {
|
||||
if (promiseLikeType !== emptyGenericType) {
|
||||
return createTypeReference(promiseLikeType, [anyType]);
|
||||
}
|
||||
return emptyObjectType;
|
||||
@@ -29500,9 +29456,13 @@ var ts;
|
||||
}
|
||||
}
|
||||
function emitJsxElement(openingNode, children) {
|
||||
var syntheticReactRef = ts.createSynthesizedNode(67 /* Identifier */);
|
||||
syntheticReactRef.text = 'React';
|
||||
syntheticReactRef.parent = openingNode;
|
||||
// Call React.createElement(tag, ...
|
||||
emitLeadingComments(openingNode);
|
||||
write("React.createElement(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".createElement(");
|
||||
emitTagName(openingNode.tagName);
|
||||
write(", ");
|
||||
// Attribute list
|
||||
@@ -29515,7 +29475,8 @@ var ts;
|
||||
// a call to React.__spread
|
||||
var attrs = openingNode.attributes;
|
||||
if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) {
|
||||
write("React.__spread(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".__spread(");
|
||||
var haveOpenedObjectLiteral = false;
|
||||
for (var i_1 = 0; i_1 < attrs.length; i_1++) {
|
||||
if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) {
|
||||
@@ -36231,6 +36192,12 @@ var ts;
|
||||
description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
paramType: ts.Diagnostics.LOCATION
|
||||
},
|
||||
{
|
||||
name: "suppressExcessPropertyErrors",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,
|
||||
experimental: true
|
||||
},
|
||||
{
|
||||
name: "suppressImplicitAnyIndexErrors",
|
||||
type: "boolean",
|
||||
@@ -36306,7 +36273,7 @@ var ts;
|
||||
return optionNameMapCache;
|
||||
}
|
||||
ts.getOptionNameMap = getOptionNameMap;
|
||||
function parseCommandLine(commandLine) {
|
||||
function parseCommandLine(commandLine, readFile) {
|
||||
var options = {};
|
||||
var fileNames = [];
|
||||
var errors = [];
|
||||
@@ -36368,7 +36335,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function parseResponseFile(fileName) {
|
||||
var text = ts.sys.readFile(fileName);
|
||||
var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);
|
||||
if (!text) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));
|
||||
return;
|
||||
|
||||
Vendored
+2
-1
@@ -1329,6 +1329,7 @@ declare namespace ts {
|
||||
rootDir?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
@@ -1524,7 +1525,7 @@ declare namespace ts {
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
}
|
||||
declare namespace ts {
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
|
||||
+68
-101
@@ -2442,6 +2442,7 @@ var ts;
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." },
|
||||
Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
@@ -15702,7 +15703,7 @@ var ts;
|
||||
return members;
|
||||
}
|
||||
function resolveTupleTypeMembers(type) {
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes)));
|
||||
var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true)));
|
||||
var members = createTupleTypeMemberSymbols(type.elementTypes);
|
||||
addInheritedMembers(members, arrayType.properties);
|
||||
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType);
|
||||
@@ -16023,29 +16024,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
// Check if a property with the given name is known anywhere in the given type. In an object
|
||||
// type, a property is considered known if the object type is empty, if it has any index
|
||||
// signatures, or if the property is actually declared in the type. In a union or intersection
|
||||
// type, a property is considered known if it is known in any constituent type.
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896 /* ObjectType */ && type !== globalObjectType) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
return !!(resolved.properties.length === 0 ||
|
||||
resolved.stringIndexType ||
|
||||
resolved.numberIndexType ||
|
||||
getPropertyOfType(type, name));
|
||||
}
|
||||
if (type.flags & 49152 /* UnionOrIntersection */) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function getSignaturesOfStructuredType(type, kind) {
|
||||
if (type.flags & 130048 /* StructuredType */) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
@@ -16559,7 +16537,7 @@ var ts;
|
||||
*/
|
||||
function createTypedPropertyDescriptorType(propertyType) {
|
||||
var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();
|
||||
return globalTypedPropertyDescriptorType !== emptyObjectType
|
||||
return globalTypedPropertyDescriptorType !== emptyGenericType
|
||||
? createTypeReference(globalTypedPropertyDescriptorType, [propertyType])
|
||||
: emptyObjectType;
|
||||
}
|
||||
@@ -16617,71 +16595,19 @@ var ts;
|
||||
addTypeToSet(typeSet, type, typeSetKind);
|
||||
}
|
||||
}
|
||||
function isObjectLiteralTypeDuplicateOf(source, target) {
|
||||
var sourceProperties = getPropertiesOfObjectType(source);
|
||||
var targetProperties = getPropertiesOfObjectType(target);
|
||||
if (sourceProperties.length !== targetProperties.length) {
|
||||
return false;
|
||||
}
|
||||
for (var _i = 0; _i < sourceProperties.length; _i++) {
|
||||
var sourceProp = sourceProperties[_i];
|
||||
var targetProp = getPropertyOfObjectType(target, sourceProp.name);
|
||||
if (!targetProp ||
|
||||
getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */) ||
|
||||
!isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isTupleTypeDuplicateOf(source, target) {
|
||||
var sourceTypes = source.elementTypes;
|
||||
var targetTypes = target.elementTypes;
|
||||
if (sourceTypes.length !== targetTypes.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < sourceTypes.length; i++) {
|
||||
if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Returns true if the source type is a duplicate of the target type. A source type is a duplicate of
|
||||
// a target type if the the two are identical, with the exception that the source type may have null or
|
||||
// undefined in places where the target type doesn't. This is by design an asymmetric relationship.
|
||||
function isTypeDuplicateOf(source, target) {
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 32 /* Undefined */ || source.flags & 64 /* Null */ && !(target.flags & 32 /* Undefined */)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 /* ObjectLiteral */ && target.flags & 80896 /* ObjectType */) {
|
||||
return isObjectLiteralTypeDuplicateOf(source, target);
|
||||
}
|
||||
if (isArrayType(source) && isArrayType(target)) {
|
||||
return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]);
|
||||
}
|
||||
if (isTupleType(source) && isTupleType(target)) {
|
||||
return isTupleTypeDuplicateOf(source, target);
|
||||
}
|
||||
return isTypeIdenticalTo(source, target);
|
||||
}
|
||||
function isTypeDuplicateOfSomeType(candidate, types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
var type = types[_i];
|
||||
if (candidate !== type && isTypeDuplicateOf(candidate, type)) {
|
||||
function isSubtypeOfAny(candidate, types) {
|
||||
for (var i = 0, len = types.length; i < len; i++) {
|
||||
if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function removeDuplicateTypes(types) {
|
||||
function removeSubtypes(types) {
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
if (isTypeDuplicateOfSomeType(types[i], types)) {
|
||||
if (isSubtypeOfAny(types[i], types)) {
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
@@ -16704,12 +16630,14 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
// We always deduplicate the constituent type set based on object identity, but we'll also deduplicate
|
||||
// based on the structure of the types unless the noDeduplication flag is true, which is the case when
|
||||
// creating a union type from a type node and when instantiating a union type. In both of those cases,
|
||||
// structural deduplication has to be deferred to properly support recursive union types. For example,
|
||||
// a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration.
|
||||
function getUnionType(types, noDeduplication) {
|
||||
// We reduce the constituent type set to only include types that aren't subtypes of other types, unless
|
||||
// the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on
|
||||
// object identity. Subtype reduction is possible only when union types are known not to circularly
|
||||
// reference themselves (as is the case with union types created by expression constructs such as array
|
||||
// literals and the || and ?: operators). Named types can circularly reference themselves and therefore
|
||||
// cannot be deduplicated during their declaration. For example, "type Item = string | (() => Item" is
|
||||
// a named type that circularly references itself.
|
||||
function getUnionType(types, noSubtypeReduction) {
|
||||
if (types.length === 0) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
@@ -16718,12 +16646,12 @@ var ts;
|
||||
if (containsTypeAny(typeSet)) {
|
||||
return anyType;
|
||||
}
|
||||
if (noDeduplication) {
|
||||
if (noSubtypeReduction) {
|
||||
removeAllButLast(typeSet, undefinedType);
|
||||
removeAllButLast(typeSet, nullType);
|
||||
}
|
||||
else {
|
||||
removeDuplicateTypes(typeSet);
|
||||
removeSubtypes(typeSet);
|
||||
}
|
||||
if (typeSet.length === 1) {
|
||||
return typeSet[0];
|
||||
@@ -16739,7 +16667,7 @@ var ts;
|
||||
function getTypeFromUnionTypeNode(node) {
|
||||
var links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true);
|
||||
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true);
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -17010,7 +16938,7 @@ var ts;
|
||||
return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType));
|
||||
}
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noDeduplication*/ true);
|
||||
return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noSubtypeReduction*/ true);
|
||||
}
|
||||
if (type.flags & 32768 /* Intersection */) {
|
||||
return getIntersectionType(instantiateList(type.types, mapper, instantiateType));
|
||||
@@ -17271,6 +17199,30 @@ var ts;
|
||||
}
|
||||
return 0 /* False */;
|
||||
}
|
||||
// Check if a property with the given name is known anywhere in the given type. In an object type, a property
|
||||
// is considered known if the object type is empty and the check is for assignability, if the object type has
|
||||
// index signatures, or if the property is actually declared in the object type. In a union or intersection
|
||||
// type, a property is considered known if it is known in any constituent type.
|
||||
function isKnownProperty(type, name) {
|
||||
if (type.flags & 80896 /* ObjectType */) {
|
||||
var resolved = resolveStructuredTypeMembers(type);
|
||||
if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) ||
|
||||
resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (type.flags & 49152 /* UnionOrIntersection */) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (isKnownProperty(t, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function hasExcessProperties(source, target, reportErrors) {
|
||||
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
|
||||
var prop = _a[_i];
|
||||
@@ -17999,7 +17951,7 @@ var ts;
|
||||
return getWidenedTypeOfObjectLiteral(type);
|
||||
}
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.map(type.types, getWidenedType));
|
||||
return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true);
|
||||
}
|
||||
if (isArrayType(type)) {
|
||||
return createArrayType(getWidenedType(type.typeArguments[0]));
|
||||
@@ -19438,7 +19390,7 @@ var ts;
|
||||
var propertiesTable = {};
|
||||
var propertiesArray = [];
|
||||
var contextualType = getContextualType(node);
|
||||
var typeFlags;
|
||||
var typeFlags = 0;
|
||||
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
||||
var memberDecl = _a[_i];
|
||||
var member = memberDecl.symbol;
|
||||
@@ -19484,7 +19436,8 @@ var ts;
|
||||
var stringIndexType = getIndexType(0 /* String */);
|
||||
var numberIndexType = getIndexType(1 /* Number */);
|
||||
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType);
|
||||
result.flags |= 524288 /* ObjectLiteral */ | 1048576 /* FreshObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | (typeFlags & 14680064 /* PropagatingFlags */);
|
||||
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */;
|
||||
result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */);
|
||||
return result;
|
||||
function getIndexType(kind) {
|
||||
if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) {
|
||||
@@ -21216,7 +21169,7 @@ var ts;
|
||||
function createPromiseType(promisedType) {
|
||||
// creates a `Promise<T>` type where `T` is the promisedType argument
|
||||
var globalPromiseType = getGlobalPromiseType();
|
||||
if (globalPromiseType !== emptyObjectType) {
|
||||
if (globalPromiseType !== emptyGenericType) {
|
||||
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
|
||||
promisedType = getAwaitedType(promisedType);
|
||||
return createTypeReference(globalPromiseType, [promisedType]);
|
||||
@@ -24248,6 +24201,7 @@ var ts;
|
||||
if (baseTypes.length && produceDiagnostics) {
|
||||
var baseType = baseTypes[0];
|
||||
var staticBaseType = getBaseConstructorTypeOfClass(type);
|
||||
checkSourceElement(baseTypeNode.expression);
|
||||
if (baseTypeNode.typeArguments) {
|
||||
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
|
||||
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) {
|
||||
@@ -25227,6 +25181,8 @@ var ts;
|
||||
case 209 /* VariableDeclaration */:
|
||||
case 210 /* VariableDeclarationList */:
|
||||
case 212 /* ClassDeclaration */:
|
||||
case 241 /* HeritageClause */:
|
||||
case 186 /* ExpressionWithTypeArguments */:
|
||||
case 215 /* EnumDeclaration */:
|
||||
case 245 /* EnumMember */:
|
||||
case 225 /* ExportAssignment */:
|
||||
@@ -26049,7 +26005,7 @@ var ts;
|
||||
}
|
||||
function createInstantiatedPromiseLikeType() {
|
||||
var promiseLikeType = getGlobalPromiseLikeType();
|
||||
if (promiseLikeType !== emptyObjectType) {
|
||||
if (promiseLikeType !== emptyGenericType) {
|
||||
return createTypeReference(promiseLikeType, [anyType]);
|
||||
}
|
||||
return emptyObjectType;
|
||||
@@ -29500,9 +29456,13 @@ var ts;
|
||||
}
|
||||
}
|
||||
function emitJsxElement(openingNode, children) {
|
||||
var syntheticReactRef = ts.createSynthesizedNode(67 /* Identifier */);
|
||||
syntheticReactRef.text = 'React';
|
||||
syntheticReactRef.parent = openingNode;
|
||||
// Call React.createElement(tag, ...
|
||||
emitLeadingComments(openingNode);
|
||||
write("React.createElement(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".createElement(");
|
||||
emitTagName(openingNode.tagName);
|
||||
write(", ");
|
||||
// Attribute list
|
||||
@@ -29515,7 +29475,8 @@ var ts;
|
||||
// a call to React.__spread
|
||||
var attrs = openingNode.attributes;
|
||||
if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) {
|
||||
write("React.__spread(");
|
||||
emitExpressionIdentifier(syntheticReactRef);
|
||||
write(".__spread(");
|
||||
var haveOpenedObjectLiteral = false;
|
||||
for (var i_1 = 0; i_1 < attrs.length; i_1++) {
|
||||
if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) {
|
||||
@@ -36231,6 +36192,12 @@ var ts;
|
||||
description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
paramType: ts.Diagnostics.LOCATION
|
||||
},
|
||||
{
|
||||
name: "suppressExcessPropertyErrors",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,
|
||||
experimental: true
|
||||
},
|
||||
{
|
||||
name: "suppressImplicitAnyIndexErrors",
|
||||
type: "boolean",
|
||||
@@ -36306,7 +36273,7 @@ var ts;
|
||||
return optionNameMapCache;
|
||||
}
|
||||
ts.getOptionNameMap = getOptionNameMap;
|
||||
function parseCommandLine(commandLine) {
|
||||
function parseCommandLine(commandLine, readFile) {
|
||||
var options = {};
|
||||
var fileNames = [];
|
||||
var errors = [];
|
||||
@@ -36368,7 +36335,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function parseResponseFile(fileName) {
|
||||
var text = ts.sys.readFile(fileName);
|
||||
var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);
|
||||
if (!text) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));
|
||||
return;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.7.0",
|
||||
"version": "1.6.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
||||
+137
-55
@@ -967,7 +967,7 @@ namespace ts {
|
||||
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
|
||||
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
|
||||
|
||||
if (!moduleName) {
|
||||
if (moduleName === undefined) {
|
||||
return;
|
||||
}
|
||||
let isRelative = isExternalModuleNameRelative(moduleName);
|
||||
@@ -978,8 +978,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
let sourceFile = fileName && host.getSourceFile(fileName);
|
||||
let resolvedModule = getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
let sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
@@ -2320,8 +2320,8 @@ namespace ts {
|
||||
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
|
||||
// or otherwise the type of the string index signature.
|
||||
type = getTypeOfPropertyOfType(parentType, name.text) ||
|
||||
isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
|
||||
getIndexTypeOfType(parentType, IndexKind.String);
|
||||
isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
|
||||
getIndexTypeOfType(parentType, IndexKind.String);
|
||||
if (!type) {
|
||||
error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), declarationNameToString(name));
|
||||
return unknownType;
|
||||
@@ -2408,7 +2408,7 @@ namespace ts {
|
||||
|
||||
// If the declaration specifies a binding pattern, use the type implied by the binding pattern
|
||||
if (isBindingPattern(declaration.name)) {
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name, /*includePatternInType*/ false);
|
||||
}
|
||||
|
||||
// No type specified and nothing can be inferred
|
||||
@@ -2418,48 +2418,47 @@ namespace ts {
|
||||
// Return the type implied by a binding pattern element. This is the type of the initializer of the element if
|
||||
// one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding
|
||||
// pattern. Otherwise, it is the type any.
|
||||
function getTypeFromBindingElement(element: BindingElement): Type {
|
||||
function getTypeFromBindingElement(element: BindingElement, includePatternInType?: boolean): Type {
|
||||
if (element.initializer) {
|
||||
return getWidenedType(checkExpressionCached(element.initializer));
|
||||
}
|
||||
if (isBindingPattern(element.name)) {
|
||||
return getTypeFromBindingPattern(<BindingPattern>element.name);
|
||||
return getTypeFromBindingPattern(<BindingPattern>element.name, includePatternInType);
|
||||
}
|
||||
return anyType;
|
||||
}
|
||||
|
||||
// Return the type implied by an object binding pattern
|
||||
function getTypeFromObjectBindingPattern(pattern: BindingPattern): Type {
|
||||
function getTypeFromObjectBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type {
|
||||
let members: SymbolTable = {};
|
||||
forEach(pattern.elements, e => {
|
||||
let flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0);
|
||||
let name = e.propertyName || <Identifier>e.name;
|
||||
let symbol = <TransientSymbol>createSymbol(flags, name.text);
|
||||
symbol.type = getTypeFromBindingElement(e);
|
||||
symbol.type = getTypeFromBindingElement(e, includePatternInType);
|
||||
symbol.bindingElement = e;
|
||||
members[symbol.name] = symbol;
|
||||
});
|
||||
return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined);
|
||||
let result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined);
|
||||
if (includePatternInType) {
|
||||
result.pattern = pattern;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Return the type implied by an array binding pattern
|
||||
function getTypeFromArrayBindingPattern(pattern: BindingPattern): Type {
|
||||
let hasSpreadElement: boolean = false;
|
||||
let elementTypes: Type[] = [];
|
||||
forEach(pattern.elements, e => {
|
||||
elementTypes.push(e.kind === SyntaxKind.OmittedExpression || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e));
|
||||
if (e.dotDotDotToken) {
|
||||
hasSpreadElement = true;
|
||||
}
|
||||
});
|
||||
if (!elementTypes.length) {
|
||||
function getTypeFromArrayBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type {
|
||||
let elements = pattern.elements;
|
||||
if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) {
|
||||
return languageVersion >= ScriptTarget.ES6 ? createIterableType(anyType) : anyArrayType;
|
||||
}
|
||||
else if (hasSpreadElement) {
|
||||
let unionOfElements = getUnionType(elementTypes);
|
||||
return languageVersion >= ScriptTarget.ES6 ? createIterableType(unionOfElements) : createArrayType(unionOfElements);
|
||||
}
|
||||
|
||||
// If the pattern has at least one element, and no rest element, then it should imply a tuple type.
|
||||
let elementTypes = map(elements, e => e.kind === SyntaxKind.OmittedExpression ? anyType : getTypeFromBindingElement(e, includePatternInType));
|
||||
if (includePatternInType) {
|
||||
let result = createNewTupleType(elementTypes);
|
||||
result.pattern = pattern;
|
||||
return result;
|
||||
}
|
||||
return createTupleType(elementTypes);
|
||||
}
|
||||
|
||||
@@ -2470,10 +2469,10 @@ namespace ts {
|
||||
// used as the contextual type of an initializer associated with the binding pattern. Also, for a destructuring
|
||||
// parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of
|
||||
// the parameter.
|
||||
function getTypeFromBindingPattern(pattern: BindingPattern): Type {
|
||||
function getTypeFromBindingPattern(pattern: BindingPattern, includePatternInType?: boolean): Type {
|
||||
return pattern.kind === SyntaxKind.ObjectBindingPattern
|
||||
? getTypeFromObjectBindingPattern(pattern)
|
||||
: getTypeFromArrayBindingPattern(pattern);
|
||||
? getTypeFromObjectBindingPattern(pattern, includePatternInType)
|
||||
: getTypeFromArrayBindingPattern(pattern, includePatternInType);
|
||||
}
|
||||
|
||||
// Return the type associated with a variable, parameter, or property declaration. In the simple case this is the type
|
||||
@@ -3128,7 +3127,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature {
|
||||
for (let s of signatureList) {
|
||||
for (let s of signatureList) {
|
||||
if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) {
|
||||
return s;
|
||||
}
|
||||
@@ -4015,7 +4014,7 @@ namespace ts {
|
||||
*/
|
||||
function createTypedPropertyDescriptorType(propertyType: Type): Type {
|
||||
let globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();
|
||||
return globalTypedPropertyDescriptorType !== emptyObjectType
|
||||
return globalTypedPropertyDescriptorType !== emptyGenericType
|
||||
? createTypeReference(<GenericType>globalTypedPropertyDescriptorType, [propertyType])
|
||||
: emptyObjectType;
|
||||
}
|
||||
@@ -4049,11 +4048,12 @@ namespace ts {
|
||||
|
||||
function createTupleType(elementTypes: Type[]) {
|
||||
let id = getTypeListId(elementTypes);
|
||||
let type = tupleTypes[id];
|
||||
if (!type) {
|
||||
type = tupleTypes[id] = <TupleType>createObjectType(TypeFlags.Tuple | getPropagatingFlagsOfTypes(elementTypes));
|
||||
type.elementTypes = elementTypes;
|
||||
}
|
||||
return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes));
|
||||
}
|
||||
|
||||
function createNewTupleType(elementTypes: Type[]) {
|
||||
let type = <TupleType>createObjectType(TypeFlags.Tuple | getPropagatingFlagsOfTypes(elementTypes));
|
||||
type.elementTypes = elementTypes;
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -4642,7 +4642,9 @@ namespace ts {
|
||||
// and intersection types are further deconstructed on the target side, we don't want to
|
||||
// make the check again (as it might fail for a partial target type). Therefore we obtain
|
||||
// the regular source type and proceed with that.
|
||||
source = getRegularTypeOfObjectLiteral(source);
|
||||
if (target.flags & TypeFlags.UnionOrIntersection) {
|
||||
source = getRegularTypeOfObjectLiteral(source);
|
||||
}
|
||||
}
|
||||
|
||||
let saveErrorInfo = errorInfo;
|
||||
@@ -5113,8 +5115,8 @@ namespace ts {
|
||||
function abstractSignatureRelatedTo(source: Type, sourceSig: Signature, target: Type, targetSig: Signature) {
|
||||
if (sourceSig && targetSig) {
|
||||
|
||||
let sourceDecl = source.symbol && getDeclarationOfKind(source.symbol, SyntaxKind.ClassDeclaration);
|
||||
let targetDecl = target.symbol && getDeclarationOfKind(target.symbol, SyntaxKind.ClassDeclaration);
|
||||
let sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol);
|
||||
let targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol);
|
||||
|
||||
if (!sourceDecl) {
|
||||
// If the source object isn't itself a class declaration, it can be freely assigned, regardless
|
||||
@@ -5128,8 +5130,8 @@ namespace ts {
|
||||
let sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
|
||||
let targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
|
||||
|
||||
let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration);
|
||||
let targetReturnDecl = targetReturnType && targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
|
||||
let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol);
|
||||
let targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol);
|
||||
let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract;
|
||||
let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract;
|
||||
|
||||
@@ -5513,6 +5515,7 @@ namespace ts {
|
||||
regularType.constructSignatures = (<ResolvedType>type).constructSignatures;
|
||||
regularType.stringIndexType = (<ResolvedType>type).stringIndexType;
|
||||
regularType.numberIndexType = (<ResolvedType>type).numberIndexType;
|
||||
(<FreshObjectLiteralType>type).regularType = regularType;
|
||||
}
|
||||
return regularType;
|
||||
}
|
||||
@@ -6615,7 +6618,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
if (isBindingPattern(declaration.name)) {
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name, /*includePatternInType*/ true);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -7011,11 +7014,13 @@ namespace ts {
|
||||
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false);
|
||||
}
|
||||
|
||||
function hasDefaultValue(node: BindingElement | Expression): boolean {
|
||||
return (node.kind === SyntaxKind.BindingElement && !!(<BindingElement>node).initializer) ||
|
||||
(node.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node).operatorToken.kind === SyntaxKind.EqualsToken);
|
||||
}
|
||||
|
||||
function checkArrayLiteral(node: ArrayLiteralExpression, contextualMapper?: TypeMapper): Type {
|
||||
let elements = node.elements;
|
||||
if (!elements.length) {
|
||||
return createArrayType(undefinedType);
|
||||
}
|
||||
let hasSpreadElement = false;
|
||||
let elementTypes: Type[] = [];
|
||||
let inDestructuringPattern = isAssignmentTarget(node);
|
||||
@@ -7047,12 +7052,39 @@ namespace ts {
|
||||
hasSpreadElement = hasSpreadElement || e.kind === SyntaxKind.SpreadElementExpression;
|
||||
}
|
||||
if (!hasSpreadElement) {
|
||||
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
|
||||
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
|
||||
if (inDestructuringPattern && elementTypes.length) {
|
||||
let type = createNewTupleType(elementTypes);
|
||||
type.pattern = node;
|
||||
return type;
|
||||
}
|
||||
let contextualType = getContextualType(node);
|
||||
if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) {
|
||||
return createTupleType(elementTypes);
|
||||
if (contextualType && contextualTypeIsTupleLikeType(contextualType)) {
|
||||
let pattern = contextualType.pattern;
|
||||
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
|
||||
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
|
||||
if (pattern && (pattern.kind === SyntaxKind.ArrayBindingPattern || pattern.kind === SyntaxKind.ArrayLiteralExpression)) {
|
||||
let patternElements = (<BindingPattern | ArrayLiteralExpression>pattern).elements;
|
||||
for (let i = elementTypes.length; i < patternElements.length; i++) {
|
||||
let patternElement = patternElements[i];
|
||||
if (hasDefaultValue(patternElement)) {
|
||||
elementTypes.push((<TupleType>contextualType).elementTypes[i]);
|
||||
}
|
||||
else {
|
||||
if (patternElement.kind !== SyntaxKind.OmittedExpression) {
|
||||
error(patternElement, Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
|
||||
}
|
||||
elementTypes.push(unknownType);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (elementTypes.length) {
|
||||
return createTupleType(elementTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
return createArrayType(getUnionType(elementTypes));
|
||||
return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType)
|
||||
}
|
||||
|
||||
function isNumericName(name: DeclarationName): boolean {
|
||||
@@ -7119,6 +7151,9 @@ namespace ts {
|
||||
let propertiesTable: SymbolTable = {};
|
||||
let propertiesArray: Symbol[] = [];
|
||||
let contextualType = getContextualType(node);
|
||||
let contextualTypeHasPattern = contextualType && contextualType.pattern &&
|
||||
(contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression);
|
||||
let inDestructuringPattern = isAssignmentTarget(node);
|
||||
let typeFlags: TypeFlags = 0;
|
||||
|
||||
for (let memberDecl of node.properties) {
|
||||
@@ -7139,6 +7174,25 @@ namespace ts {
|
||||
}
|
||||
typeFlags |= type.flags;
|
||||
let prop = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name);
|
||||
if (inDestructuringPattern) {
|
||||
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
|
||||
// for the property, make the property optional.
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment && hasDefaultValue((<PropertyAssignment>memberDecl).initializer)) {
|
||||
prop.flags |= SymbolFlags.Optional;
|
||||
}
|
||||
}
|
||||
else if (contextualTypeHasPattern) {
|
||||
// If object literal is contextually typed by the implied type of a binding pattern, and if the
|
||||
// binding pattern specifies a default value for the property, make the property optional.
|
||||
let impliedProp = getPropertyOfType(contextualType, member.name);
|
||||
if (impliedProp) {
|
||||
prop.flags |= impliedProp.flags & SymbolFlags.Optional;
|
||||
}
|
||||
else if (!compilerOptions.suppressExcessPropertyErrors) {
|
||||
error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
||||
symbolToString(member), typeToString(contextualType));
|
||||
}
|
||||
}
|
||||
prop.declarations = member.declarations;
|
||||
prop.parent = member.parent;
|
||||
if (member.valueDeclaration) {
|
||||
@@ -7165,11 +7219,29 @@ namespace ts {
|
||||
propertiesArray.push(member);
|
||||
}
|
||||
|
||||
// If object literal is contextually typed by the implied type of a binding pattern, augment the result
|
||||
// type with those properties for which the binding pattern specifies a default value.
|
||||
if (contextualTypeHasPattern) {
|
||||
for (let prop of getPropertiesOfType(contextualType)) {
|
||||
if (!hasProperty(propertiesTable, prop.name)) {
|
||||
if (!(prop.flags & SymbolFlags.Optional)) {
|
||||
error(prop.valueDeclaration || (<TransientSymbol>prop).bindingElement,
|
||||
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
|
||||
}
|
||||
propertiesTable[prop.name] = prop;
|
||||
propertiesArray.push(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let stringIndexType = getIndexType(IndexKind.String);
|
||||
let numberIndexType = getIndexType(IndexKind.Number);
|
||||
let result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType);
|
||||
let freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshObjectLiteral;
|
||||
result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
|
||||
if (inDestructuringPattern) {
|
||||
result.pattern = node;
|
||||
}
|
||||
return result;
|
||||
|
||||
function getIndexType(kind: IndexKind) {
|
||||
@@ -8880,7 +8952,7 @@ namespace ts {
|
||||
// Note, only class declarations can be declared abstract.
|
||||
// In the case of a merged class-module or class-interface declaration,
|
||||
// only the class declaration node will have the Abstract flag set.
|
||||
let valueDecl = expressionType.symbol && getDeclarationOfKind(expressionType.symbol, SyntaxKind.ClassDeclaration);
|
||||
let valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
||||
if (valueDecl && valueDecl.flags & NodeFlags.Abstract) {
|
||||
error(node, Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, declarationNameToString(valueDecl.name));
|
||||
return resolveErrorCall(node);
|
||||
@@ -9133,7 +9205,7 @@ namespace ts {
|
||||
function createPromiseType(promisedType: Type): Type {
|
||||
// creates a `Promise<T>` type where `T` is the promisedType argument
|
||||
let globalPromiseType = getGlobalPromiseType();
|
||||
if (globalPromiseType !== emptyObjectType) {
|
||||
if (globalPromiseType !== emptyGenericType) {
|
||||
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
|
||||
promisedType = getAwaitedType(promisedType);
|
||||
return createTypeReference(<GenericType>globalPromiseType, [promisedType]);
|
||||
@@ -12623,6 +12695,10 @@ namespace ts {
|
||||
return s.flags & SymbolFlags.Instantiated ? getSymbolLinks(s).target : s;
|
||||
}
|
||||
|
||||
function getClassLikeDeclarationOfSymbol(symbol: Symbol): Declaration {
|
||||
return forEach(symbol.declarations, d => isClassLike(d) ? d : undefined);
|
||||
}
|
||||
|
||||
function checkKindsOfPropertyMemberOverrides(type: InterfaceType, baseType: ObjectType): void {
|
||||
|
||||
// TypeScript 1.0 spec (April 2014): 8.2.3
|
||||
@@ -12660,14 +12736,20 @@ namespace ts {
|
||||
if (derived === base) {
|
||||
// derived class inherits base without override/redeclaration
|
||||
|
||||
let derivedClassDecl = getDeclarationOfKind(type.symbol, SyntaxKind.ClassDeclaration);
|
||||
let derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);
|
||||
|
||||
// It is an error to inherit an abstract member without implementing it or being declared abstract.
|
||||
// If there is no declaration for the derived class (as in the case of class expressions),
|
||||
// then the class cannot be declared abstract.
|
||||
if ( baseDeclarationFlags & NodeFlags.Abstract && (!derivedClassDecl || !(derivedClassDecl.flags & NodeFlags.Abstract))) {
|
||||
error(derivedClassDecl, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,
|
||||
typeToString(type), symbolToString(baseProperty), typeToString(baseType));
|
||||
if (baseDeclarationFlags & NodeFlags.Abstract && (!derivedClassDecl || !(derivedClassDecl.flags & NodeFlags.Abstract))) {
|
||||
if (derivedClassDecl.kind === SyntaxKind.ClassExpression) {
|
||||
error(derivedClassDecl, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,
|
||||
symbolToString(baseProperty), typeToString(baseType));
|
||||
}
|
||||
else {
|
||||
error(derivedClassDecl, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,
|
||||
typeToString(type), symbolToString(baseProperty), typeToString(baseType));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -14581,7 +14663,7 @@ namespace ts {
|
||||
|
||||
function createInstantiatedPromiseLikeType(): ObjectType {
|
||||
let promiseLikeType = getGlobalPromiseLikeType();
|
||||
if (promiseLikeType !== emptyObjectType) {
|
||||
if (promiseLikeType !== emptyGenericType) {
|
||||
return createTypeReference(<GenericType>promiseLikeType, [anyType]);
|
||||
}
|
||||
|
||||
|
||||
@@ -399,10 +399,10 @@ namespace ts {
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
|
||||
export function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic } {
|
||||
let text = "";
|
||||
try {
|
||||
text = sys.readFile(fileName);
|
||||
text = readFile(fileName);
|
||||
}
|
||||
catch (e) {
|
||||
return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace ts {
|
||||
Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." },
|
||||
Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." },
|
||||
Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." },
|
||||
An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." },
|
||||
An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." },
|
||||
Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." },
|
||||
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." },
|
||||
Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." },
|
||||
@@ -415,6 +415,7 @@ namespace ts {
|
||||
The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." },
|
||||
yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." },
|
||||
await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." },
|
||||
Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." },
|
||||
JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." },
|
||||
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." },
|
||||
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." },
|
||||
@@ -427,6 +428,10 @@ namespace ts {
|
||||
Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" },
|
||||
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." },
|
||||
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
|
||||
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." },
|
||||
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
|
||||
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
|
||||
Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
||||
@@ -965,7 +965,7 @@
|
||||
"category": "Error",
|
||||
"code": 2341
|
||||
},
|
||||
"An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.": {
|
||||
"An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.": {
|
||||
"category": "Error",
|
||||
"code": 2342
|
||||
},
|
||||
@@ -1649,6 +1649,10 @@
|
||||
"category": "Error",
|
||||
"code": 2524
|
||||
},
|
||||
"Initializer provides no value for this binding element and the binding element has no default value.": {
|
||||
"category": "Error",
|
||||
"code": 2525
|
||||
},
|
||||
"JSX element attributes type '{0}' must be an object type.": {
|
||||
"category": "Error",
|
||||
"code": 2600
|
||||
@@ -1692,11 +1696,27 @@
|
||||
"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.": {
|
||||
"category": "Error",
|
||||
"code": 2651
|
||||
},
|
||||
},
|
||||
"Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": {
|
||||
"category": "Error",
|
||||
"code": 2652
|
||||
},
|
||||
"Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2653
|
||||
},
|
||||
"Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2654
|
||||
},
|
||||
"Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2655
|
||||
},
|
||||
"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2656
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
|
||||
+156
-109
@@ -186,6 +186,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
/** Sourcemap data that will get encoded */
|
||||
let sourceMapData: SourceMapData;
|
||||
|
||||
/** If removeComments is true, no leading-comments needed to be emitted **/
|
||||
let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker;
|
||||
|
||||
if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) {
|
||||
initializeEmitterWithSourceMaps();
|
||||
}
|
||||
@@ -1292,8 +1295,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function jsxEmitPreserve(node: JsxElement|JsxSelfClosingElement) {
|
||||
function emitJsxAttribute(node: JsxAttribute) {
|
||||
emit(node.name);
|
||||
write("=");
|
||||
emit(node.initializer);
|
||||
if (node.initializer) {
|
||||
write("=");
|
||||
emit(node.initializer);
|
||||
}
|
||||
}
|
||||
|
||||
function emitJsxSpreadAttribute(node: JsxSpreadAttribute) {
|
||||
@@ -2352,7 +2357,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
operand.kind !== SyntaxKind.PostfixUnaryExpression &&
|
||||
operand.kind !== SyntaxKind.NewExpression &&
|
||||
!(operand.kind === SyntaxKind.CallExpression && node.parent.kind === SyntaxKind.NewExpression) &&
|
||||
!(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression)) {
|
||||
!(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression) &&
|
||||
!(operand.kind === SyntaxKind.NumericLiteral && node.parent.kind === SyntaxKind.PropertyAccessExpression)) {
|
||||
emit(operand);
|
||||
return;
|
||||
}
|
||||
@@ -3142,6 +3148,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void {
|
||||
Debug.assert(compilerOptions.module === ModuleKind.System);
|
||||
|
||||
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
@@ -3666,7 +3676,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
function emitFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
if (nodeIsMissing(node.body)) {
|
||||
return emitOnlyPinnedOrTripleSlashComments(node);
|
||||
return emitCommentsOnNotEmittedNode(node);
|
||||
}
|
||||
|
||||
// TODO (yuisu) : we should not have special cases to condition emitting comments
|
||||
@@ -4143,7 +4153,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
|
||||
if (!(<MethodDeclaration>member).body) {
|
||||
return emitOnlyPinnedOrTripleSlashComments(member);
|
||||
return emitCommentsOnNotEmittedNode(member);
|
||||
}
|
||||
|
||||
writeLine();
|
||||
@@ -4210,7 +4220,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function emitMemberFunctionsForES6AndHigher(node: ClassLikeDeclaration) {
|
||||
for (let member of node.members) {
|
||||
if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(<MethodDeclaration>member).body) {
|
||||
emitOnlyPinnedOrTripleSlashComments(member);
|
||||
emitCommentsOnNotEmittedNode(member);
|
||||
}
|
||||
else if (member.kind === SyntaxKind.MethodDeclaration ||
|
||||
member.kind === SyntaxKind.GetAccessor ||
|
||||
@@ -4267,7 +4277,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// Emit the constructor overload pinned comments
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Constructor && !(<ConstructorDeclaration>member).body) {
|
||||
emitOnlyPinnedOrTripleSlashComments(member);
|
||||
emitCommentsOnNotEmittedNode(member);
|
||||
}
|
||||
// Check if there is any non-static property assignment
|
||||
if (member.kind === SyntaxKind.PropertyDeclaration && (<PropertyDeclaration>member).initializer && (member.flags & NodeFlags.Static) === 0) {
|
||||
@@ -4939,63 +4949,61 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitSerializedTypeNode(node: TypeNode) {
|
||||
if (!node) {
|
||||
return;
|
||||
if (node) {
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
write("void 0");
|
||||
return;
|
||||
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
emitSerializedTypeNode((<ParenthesizedTypeNode>node).type);
|
||||
return;
|
||||
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
write("Function");
|
||||
return;
|
||||
|
||||
case SyntaxKind.ArrayType:
|
||||
case SyntaxKind.TupleType:
|
||||
write("Array");
|
||||
return;
|
||||
|
||||
case SyntaxKind.TypePredicate:
|
||||
case SyntaxKind.BooleanKeyword:
|
||||
write("Boolean");
|
||||
return;
|
||||
|
||||
case SyntaxKind.StringKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
write("String");
|
||||
return;
|
||||
|
||||
case SyntaxKind.NumberKeyword:
|
||||
write("Number");
|
||||
return;
|
||||
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
write("Symbol");
|
||||
return;
|
||||
|
||||
case SyntaxKind.TypeReference:
|
||||
emitSerializedTypeReferenceNode(<TypeReferenceNode>node);
|
||||
return;
|
||||
|
||||
case SyntaxKind.TypeQuery:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.IntersectionType:
|
||||
case SyntaxKind.AnyKeyword:
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.fail("Cannot serialize unexpected type node.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
write("void 0");
|
||||
return;
|
||||
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
emitSerializedTypeNode((<ParenthesizedTypeNode>node).type);
|
||||
return;
|
||||
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
write("Function");
|
||||
return;
|
||||
|
||||
case SyntaxKind.ArrayType:
|
||||
case SyntaxKind.TupleType:
|
||||
write("Array");
|
||||
return;
|
||||
|
||||
case SyntaxKind.TypePredicate:
|
||||
case SyntaxKind.BooleanKeyword:
|
||||
write("Boolean");
|
||||
return;
|
||||
|
||||
case SyntaxKind.StringKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
write("String");
|
||||
return;
|
||||
|
||||
case SyntaxKind.NumberKeyword:
|
||||
write("Number");
|
||||
return;
|
||||
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
write("Symbol");
|
||||
return;
|
||||
|
||||
case SyntaxKind.TypeReference:
|
||||
emitSerializedTypeReferenceNode(<TypeReferenceNode>node);
|
||||
return;
|
||||
|
||||
case SyntaxKind.TypeQuery:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.IntersectionType:
|
||||
case SyntaxKind.AnyKeyword:
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.fail("Cannot serialize unexpected type node.");
|
||||
break;
|
||||
}
|
||||
|
||||
write("Object");
|
||||
}
|
||||
|
||||
@@ -5168,7 +5176,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
|
||||
emitOnlyPinnedOrTripleSlashComments(node);
|
||||
emitCommentsOnNotEmittedNode(node);
|
||||
}
|
||||
|
||||
function shouldEmitEnumDeclaration(node: EnumDeclaration) {
|
||||
@@ -5290,7 +5298,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
let shouldEmit = shouldEmitModuleDeclaration(node);
|
||||
|
||||
if (!shouldEmit) {
|
||||
return emitOnlyPinnedOrTripleSlashComments(node);
|
||||
return emitCommentsOnNotEmittedNode(node);
|
||||
}
|
||||
let hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node);
|
||||
let emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node);
|
||||
@@ -6091,7 +6099,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInternalModuleImportEqualsDeclaration(node)) {
|
||||
if (isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
@@ -6720,7 +6728,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function emitNodeConsideringCommentsOption(node: Node, emitNodeConsideringSourcemap: (node: Node) => void): void {
|
||||
if (node) {
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return emitOnlyPinnedOrTripleSlashComments(node);
|
||||
return emitCommentsOnNotEmittedNode(node);
|
||||
}
|
||||
|
||||
if (isSpecializedCommentHandling(node)) {
|
||||
@@ -6987,22 +6995,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return leadingComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all but the pinned or triple slash comments.
|
||||
* @param ranges The array to be filtered
|
||||
* @param onlyPinnedOrTripleSlashComments whether the filtering should be performed.
|
||||
*/
|
||||
function filterComments(ranges: CommentRange[], onlyPinnedOrTripleSlashComments: boolean): CommentRange[] {
|
||||
// If we're removing comments, then we want to strip out all but the pinned or
|
||||
// triple slash comments.
|
||||
if (ranges && onlyPinnedOrTripleSlashComments) {
|
||||
ranges = filter(ranges, isPinnedOrTripleSlashComment);
|
||||
if (ranges.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function isPinnedComments(comment: CommentRange) {
|
||||
return currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk &&
|
||||
currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation;
|
||||
}
|
||||
|
||||
return ranges;
|
||||
/**
|
||||
* Determine if the given comment is a triple-slash
|
||||
*
|
||||
* @return true if the comment is a triple-slash comment else false
|
||||
**/
|
||||
function isTripleSlashComment(comment: CommentRange) {
|
||||
// Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text
|
||||
// so that we don't end up computing comment string and doing match for all // comments
|
||||
if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash &&
|
||||
comment.pos + 2 < comment.end &&
|
||||
currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash) {
|
||||
let textSubStr = currentSourceFile.text.substring(comment.pos, comment.end);
|
||||
return textSubStr.match(fullTripleSlashReferencePathRegEx) ||
|
||||
textSubStr.match(fullTripleSlashAMDReferencePathRegEx) ?
|
||||
true : false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getLeadingCommentsToEmit(node: Node) {
|
||||
@@ -7030,28 +7044,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function emitOnlyPinnedOrTripleSlashComments(node: Node) {
|
||||
emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ true);
|
||||
/**
|
||||
* Emit comments associated with node that will not be emitted into JS file
|
||||
*/
|
||||
function emitCommentsOnNotEmittedNode(node: Node) {
|
||||
emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false);
|
||||
}
|
||||
|
||||
function emitLeadingComments(node: Node) {
|
||||
return emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments);
|
||||
return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true);
|
||||
}
|
||||
|
||||
function emitLeadingCommentsWorker(node: Node, onlyPinnedOrTripleSlashComments: boolean) {
|
||||
// If the caller only wants pinned or triple slash comments, then always filter
|
||||
// down to that set. Otherwise, filter based on the current compiler options.
|
||||
let leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments);
|
||||
function emitLeadingCommentsWorker(node: Node, isEmittedNode: boolean) {
|
||||
if (compilerOptions.removeComments) {
|
||||
return;
|
||||
}
|
||||
|
||||
let leadingComments: CommentRange[];
|
||||
if (isEmittedNode) {
|
||||
leadingComments = getLeadingCommentsToEmit(node);
|
||||
}
|
||||
else {
|
||||
// If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node,
|
||||
// unless it is a triple slash comment at the top of the file.
|
||||
// For Example:
|
||||
// /// <reference-path ...>
|
||||
// declare var x;
|
||||
// /// <reference-path ...>
|
||||
// interface F {}
|
||||
// The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted
|
||||
if (node.pos === 0) {
|
||||
leadingComments = filter(getLeadingCommentsToEmit(node), isTripleSlashComment);
|
||||
}
|
||||
}
|
||||
|
||||
emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments);
|
||||
|
||||
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
|
||||
emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment);
|
||||
emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment);
|
||||
}
|
||||
|
||||
function emitTrailingComments(node: Node) {
|
||||
if (compilerOptions.removeComments) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Emit the trailing comments only if the parent's end doesn't match
|
||||
let trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments);
|
||||
let trailingComments = getTrailingCommentsToEmit(node);
|
||||
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
|
||||
@@ -7063,13 +7102,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
* ^ => pos; the function will emit "comment1" in the emitJS
|
||||
*/
|
||||
function emitTrailingCommentsOfPosition(pos: number) {
|
||||
let trailingComments = filterComments(getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments);
|
||||
if (compilerOptions.removeComments) {
|
||||
return;
|
||||
}
|
||||
|
||||
let trailingComments = getTrailingCommentRanges(currentSourceFile.text, pos);
|
||||
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment);
|
||||
}
|
||||
|
||||
function emitLeadingCommentsOfPosition(pos: number) {
|
||||
function emitLeadingCommentsOfPositionWorker(pos: number) {
|
||||
if (compilerOptions.removeComments) {
|
||||
return;
|
||||
}
|
||||
|
||||
let leadingComments: CommentRange[];
|
||||
if (hasDetachedComments(pos)) {
|
||||
// get comments without detached comments
|
||||
@@ -7080,7 +7127,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
leadingComments = getLeadingCommentRanges(currentSourceFile.text, pos);
|
||||
}
|
||||
|
||||
leadingComments = filterComments(leadingComments, compilerOptions.removeComments);
|
||||
emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments);
|
||||
|
||||
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
|
||||
@@ -7088,7 +7134,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitDetachedComments(node: TextRange) {
|
||||
let leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos);
|
||||
let leadingComments: CommentRange[];
|
||||
if (compilerOptions.removeComments) {
|
||||
// removeComments is true, only reserve pinned comment at the top of file
|
||||
// For example:
|
||||
// /*! Pinned Comment */
|
||||
//
|
||||
// var x = 10;
|
||||
if (node.pos === 0) {
|
||||
leadingComments = filter(getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// removeComments is false, just get detached as normal and bypass the process to filter comment
|
||||
leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos);
|
||||
}
|
||||
|
||||
if (leadingComments) {
|
||||
let detachedComments: CommentRange[] = [];
|
||||
let lastComment: CommentRange;
|
||||
@@ -7138,20 +7199,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(shebang);
|
||||
}
|
||||
}
|
||||
|
||||
function isPinnedOrTripleSlashComment(comment: CommentRange) {
|
||||
if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) {
|
||||
return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation;
|
||||
}
|
||||
// Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text
|
||||
// so that we don't end up computing comment string and doing match for all // comments
|
||||
else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash &&
|
||||
comment.pos + 2 < comment.end &&
|
||||
currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash &&
|
||||
currentSourceFile.text.substring(comment.pos, comment.end).match(fullTripleSlashReferencePathRegEx)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitFile(jsFilePath: string, sourceFile?: SourceFile) {
|
||||
|
||||
+13
-17
@@ -1058,11 +1058,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseIdentifierName(): Identifier {
|
||||
return createIdentifier(isIdentifierOrKeyword());
|
||||
return createIdentifier(tokenIsIdentifierOrKeyword(token));
|
||||
}
|
||||
|
||||
function isLiteralPropertyName(): boolean {
|
||||
return isIdentifierOrKeyword() ||
|
||||
return tokenIsIdentifierOrKeyword(token) ||
|
||||
token === SyntaxKind.StringLiteral ||
|
||||
token === SyntaxKind.NumericLiteral;
|
||||
}
|
||||
@@ -1086,7 +1086,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isSimplePropertyName() {
|
||||
return token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || isIdentifierOrKeyword();
|
||||
return token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || tokenIsIdentifierOrKeyword(token);
|
||||
}
|
||||
|
||||
function parseComputedPropertyName(): ComputedPropertyName {
|
||||
@@ -1213,9 +1213,9 @@ namespace ts {
|
||||
case ParsingContext.HeritageClauses:
|
||||
return isHeritageClause();
|
||||
case ParsingContext.ImportOrExportSpecifiers:
|
||||
return isIdentifierOrKeyword();
|
||||
return tokenIsIdentifierOrKeyword(token);
|
||||
case ParsingContext.JsxAttributes:
|
||||
return isIdentifierOrKeyword() || token === SyntaxKind.OpenBraceToken;
|
||||
return tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.OpenBraceToken;
|
||||
case ParsingContext.JsxChildren:
|
||||
return true;
|
||||
case ParsingContext.JSDocFunctionParameters:
|
||||
@@ -1254,7 +1254,7 @@ namespace ts {
|
||||
|
||||
function nextTokenIsIdentifierOrKeyword() {
|
||||
nextToken();
|
||||
return isIdentifierOrKeyword();
|
||||
return tokenIsIdentifierOrKeyword(token);
|
||||
}
|
||||
|
||||
function isHeritageClauseExtendsOrImplementsKeyword(): boolean {
|
||||
@@ -1824,7 +1824,7 @@ namespace ts {
|
||||
// the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword".
|
||||
// In the first case though, ASI will not take effect because there is not a
|
||||
// line terminator after the identifier or keyword.
|
||||
if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) {
|
||||
if (scanner.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token)) {
|
||||
let matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
|
||||
|
||||
if (matchesPattern) {
|
||||
@@ -2282,7 +2282,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (isIdentifierOrKeyword()) {
|
||||
if (tokenIsIdentifierOrKeyword(token)) {
|
||||
return parsePropertyOrMethodSignature();
|
||||
}
|
||||
}
|
||||
@@ -4101,13 +4101,9 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isIdentifierOrKeyword() {
|
||||
return token >= SyntaxKind.Identifier;
|
||||
}
|
||||
|
||||
function nextTokenIsIdentifierOrKeywordOnSameLine() {
|
||||
nextToken();
|
||||
return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak();
|
||||
return tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
function nextTokenIsFunctionKeywordOnSameLine() {
|
||||
@@ -4117,7 +4113,7 @@ namespace ts {
|
||||
|
||||
function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {
|
||||
nextToken();
|
||||
return (isIdentifierOrKeyword() || token === SyntaxKind.NumericLiteral) && !scanner.hasPrecedingLineBreak();
|
||||
return (tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.NumericLiteral) && !scanner.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
function isDeclaration(): boolean {
|
||||
@@ -4170,7 +4166,7 @@ namespace ts {
|
||||
case SyntaxKind.ImportKeyword:
|
||||
nextToken();
|
||||
return token === SyntaxKind.StringLiteral || token === SyntaxKind.AsteriskToken ||
|
||||
token === SyntaxKind.OpenBraceToken || isIdentifierOrKeyword();
|
||||
token === SyntaxKind.OpenBraceToken || tokenIsIdentifierOrKeyword(token);
|
||||
case SyntaxKind.ExportKeyword:
|
||||
nextToken();
|
||||
if (token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
|
||||
@@ -4777,7 +4773,7 @@ namespace ts {
|
||||
|
||||
// It is very important that we check this *after* checking indexers because
|
||||
// the [ token can start an index signature or a computed property name
|
||||
if (isIdentifierOrKeyword() ||
|
||||
if (tokenIsIdentifierOrKeyword(token) ||
|
||||
token === SyntaxKind.StringLiteral ||
|
||||
token === SyntaxKind.NumericLiteral ||
|
||||
token === SyntaxKind.AsteriskToken ||
|
||||
@@ -5320,7 +5316,7 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
|
||||
return isIdentifierOrKeyword();
|
||||
return tokenIsIdentifierOrKeyword(token);
|
||||
}
|
||||
|
||||
export function parseJSDocTypeExpressionForTests(content: string, start: number, length: number) {
|
||||
|
||||
+89
-82
@@ -12,7 +12,7 @@ namespace ts {
|
||||
|
||||
let emptyArray: any[] = [];
|
||||
|
||||
export const version = "1.7.0";
|
||||
export const version = "1.6.0";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
let fileName = "tsconfig.json";
|
||||
@@ -36,7 +36,7 @@ namespace ts {
|
||||
return normalizePath(referencedFileName);
|
||||
}
|
||||
|
||||
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
|
||||
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
let moduleResolution = compilerOptions.moduleResolution !== undefined
|
||||
? compilerOptions.moduleResolution
|
||||
: compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
|
||||
@@ -47,7 +47,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule {
|
||||
export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
let containingDirectory = getDirectoryPath(containingFile);
|
||||
|
||||
if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) {
|
||||
@@ -56,11 +56,13 @@ namespace ts {
|
||||
let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
|
||||
if (resolvedFileName) {
|
||||
return { resolvedFileName, failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName }, failedLookupLocations };
|
||||
}
|
||||
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
return { resolvedFileName, failedLookupLocations };
|
||||
return resolvedFileName
|
||||
? { resolvedModule: { resolvedFileName }, failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
|
||||
@@ -117,7 +119,7 @@ namespace ts {
|
||||
return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host);
|
||||
}
|
||||
|
||||
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModule {
|
||||
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
let failedLookupLocations: string[] = [];
|
||||
directory = normalizeSlashes(directory);
|
||||
while (true) {
|
||||
@@ -127,12 +129,12 @@ namespace ts {
|
||||
let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName));
|
||||
let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
|
||||
}
|
||||
|
||||
result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,47 +146,19 @@ namespace ts {
|
||||
directory = parentPath;
|
||||
}
|
||||
|
||||
return { resolvedFileName: undefined, failedLookupLocations };
|
||||
}
|
||||
|
||||
export function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule {
|
||||
Debug.assert(baseUrl !== undefined);
|
||||
|
||||
let normalizedModuleName = normalizeSlashes(moduleName);
|
||||
let basePart = useBaseUrl(moduleName) ? baseUrl : getDirectoryPath(containingFile);
|
||||
let candidate = normalizePath(combinePaths(basePart, moduleName));
|
||||
|
||||
let failedLookupLocations: string[] = [];
|
||||
|
||||
return forEach(supportedExtensions, ext => tryLoadFile(candidate + ext)) || { resolvedFileName: undefined, failedLookupLocations };
|
||||
|
||||
function tryLoadFile(location: string): ResolvedModule {
|
||||
if (host.fileExists(location)) {
|
||||
return { resolvedFileName: location, failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(location);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return { resolvedModule: undefined, failedLookupLocations };
|
||||
}
|
||||
|
||||
function nameStartsWithDotSlashOrDotDotSlash(name: string) {
|
||||
let i = name.lastIndexOf("./", 1);
|
||||
return i === 0 || (i === 1 && name.charCodeAt(0) === CharacterCodes.dot);
|
||||
}
|
||||
|
||||
function useBaseUrl(moduleName: string): boolean {
|
||||
// path is not rooted
|
||||
// module name does not start with './' or '../'
|
||||
return getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName);
|
||||
}
|
||||
|
||||
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
|
||||
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
|
||||
// module names that contain '!' are used to reference resources and are not resolved to actual files on disk
|
||||
if (moduleName.indexOf('!') != -1) {
|
||||
return { resolvedFileName: undefined, failedLookupLocations: [] };
|
||||
return { resolvedModule: undefined, failedLookupLocations: [] };
|
||||
}
|
||||
|
||||
let searchPath = getDirectoryPath(containingFile);
|
||||
@@ -222,7 +196,9 @@ namespace ts {
|
||||
searchPath = parentPath;
|
||||
}
|
||||
|
||||
return { resolvedFileName: referencedSourceFile, failedLookupLocations };
|
||||
return referencedSourceFile
|
||||
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations };
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -358,7 +334,8 @@ namespace ts {
|
||||
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program {
|
||||
let program: Program;
|
||||
let files: SourceFile[] = [];
|
||||
let diagnostics = createDiagnosticCollection();
|
||||
let fileProcessingDiagnostics = createDiagnosticCollection();
|
||||
let programDiagnostics = createDiagnosticCollection();
|
||||
|
||||
let commonSourceDirectory: string;
|
||||
let diagnosticsProducingTypeChecker: TypeChecker;
|
||||
@@ -371,9 +348,9 @@ namespace ts {
|
||||
|
||||
host = host || createCompilerHost(options);
|
||||
|
||||
const resolveModuleNamesWorker =
|
||||
host.resolveModuleNames ||
|
||||
((moduleNames, containingFile) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedFileName));
|
||||
const resolveModuleNamesWorker = host.resolveModuleNames
|
||||
? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile))
|
||||
: ((moduleNames: string[], containingFile: string) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedModule));
|
||||
|
||||
let filesByName = createFileMap<SourceFile>(fileName => host.getCanonicalFileName(fileName));
|
||||
|
||||
@@ -428,6 +405,7 @@ namespace ts {
|
||||
getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(),
|
||||
getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(),
|
||||
getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(),
|
||||
getFileProcessingDiagnostics: () => fileProcessingDiagnostics
|
||||
};
|
||||
return program;
|
||||
|
||||
@@ -460,6 +438,7 @@ namespace ts {
|
||||
|
||||
// check if program source files has changed in the way that can affect structure of the program
|
||||
let newSourceFiles: SourceFile[] = [];
|
||||
let modifiedSourceFiles: SourceFile[] = [];
|
||||
for (let oldSourceFile of oldProgram.getSourceFiles()) {
|
||||
let newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target);
|
||||
if (!newSourceFile) {
|
||||
@@ -491,14 +470,22 @@ namespace ts {
|
||||
let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
|
||||
// ensure that module resolution results are still correct
|
||||
for (let i = 0; i < moduleNames.length; ++i) {
|
||||
let oldResolution = getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
|
||||
if (oldResolution !== resolutions[i]) {
|
||||
let newResolution = resolutions[i];
|
||||
let oldResolution = getResolvedModule(oldSourceFile, moduleNames[i]);
|
||||
let resolutionChanged = oldResolution
|
||||
? !newResolution ||
|
||||
oldResolution.resolvedFileName !== newResolution.resolvedFileName ||
|
||||
!!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport
|
||||
: newResolution;
|
||||
|
||||
if (resolutionChanged) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// pass the cache of module resolutions from the old source file
|
||||
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
||||
modifiedSourceFiles.push(newSourceFile);
|
||||
}
|
||||
else {
|
||||
// file has no changes - use it as is
|
||||
@@ -515,7 +502,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
files = newSourceFiles;
|
||||
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
||||
|
||||
for (let modifiedFile of modifiedSourceFiles) {
|
||||
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile);
|
||||
}
|
||||
oldProgram.structureIsReused = true;
|
||||
|
||||
return true;
|
||||
@@ -645,9 +636,10 @@ namespace ts {
|
||||
Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
let bindDiagnostics = sourceFile.bindDiagnostics;
|
||||
let checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken);
|
||||
let programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
||||
let fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
let programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -664,7 +656,8 @@ namespace ts {
|
||||
|
||||
function getOptionsDiagnostics(): Diagnostic[] {
|
||||
let allDiagnostics: Diagnostic[] = [];
|
||||
addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics())
|
||||
addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
|
||||
return sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
|
||||
@@ -772,10 +765,10 @@ namespace ts {
|
||||
|
||||
if (diagnostic) {
|
||||
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument));
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument));
|
||||
fileProcessingDiagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -797,11 +790,11 @@ namespace ts {
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
let file = host.getSourceFile(fileName, options.target, hostErrorMessage => {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
filesByName.set(canonicalName, file);
|
||||
@@ -837,11 +830,11 @@ namespace ts {
|
||||
let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -864,9 +857,23 @@ namespace ts {
|
||||
let resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
|
||||
for (let i = 0; i < file.imports.length; ++i) {
|
||||
let resolution = resolutions[i];
|
||||
setResolvedModuleName(file, moduleNames[i], resolution);
|
||||
setResolvedModule(file, moduleNames[i], resolution);
|
||||
if (resolution && !options.noResolve) {
|
||||
findModuleSourceFile(resolution, file.imports[i]);
|
||||
const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
if (!isExternalModule(importedFile)) {
|
||||
let start = getTokenPosOfNode(file.imports[i], file)
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
|
||||
}
|
||||
else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) {
|
||||
let start = getTokenPosOfNode(file.imports[i], file)
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
else if (importedFile.referencedFiles.length) {
|
||||
let firstRef = importedFile.referencedFiles[0];
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -877,7 +884,7 @@ namespace ts {
|
||||
return;
|
||||
|
||||
function findModuleSourceFile(fileName: string, nameLiteral: Expression) {
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end);
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, skipTrivia(file.text, nameLiteral.pos), nameLiteral.end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,7 +909,7 @@ namespace ts {
|
||||
for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {
|
||||
if (commonPathComponents[i] !== sourcePathComponents[i]) {
|
||||
if (i === 0) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -931,7 +938,7 @@ namespace ts {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
let absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
||||
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
allFilesBelongToPath = false;
|
||||
}
|
||||
}
|
||||
@@ -944,52 +951,52 @@ namespace ts {
|
||||
function verifyCompilerOptions() {
|
||||
if (options.isolatedModules) {
|
||||
if (options.declaration) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
}
|
||||
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
}
|
||||
|
||||
if (options.out) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
}
|
||||
|
||||
if (options.outFile) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (options.inlineSources) {
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.out && options.outFile) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
}
|
||||
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1000,24 +1007,24 @@ namespace ts {
|
||||
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
|
||||
if (options.isolatedModules) {
|
||||
if (!options.module && languageVersion < ScriptTarget.ES6) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
}
|
||||
|
||||
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= ScriptTarget.ES6) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
|
||||
// there has to be common source directory if user specified --outdir || --sourceRoot
|
||||
@@ -1046,30 +1053,30 @@ namespace ts {
|
||||
|
||||
if (options.noEmit) {
|
||||
if (options.out) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
}
|
||||
|
||||
if (options.outFile) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
}
|
||||
|
||||
if (options.outDir) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
}
|
||||
|
||||
if (options.declaration) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== ScriptTarget.ES6) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace ts {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean {
|
||||
return token >= SyntaxKind.Identifier;
|
||||
}
|
||||
|
||||
export interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
@@ -1590,7 +1595,7 @@ namespace ts {
|
||||
// Scans a JSX identifier; these differ from normal identifiers in that
|
||||
// they allow dashes
|
||||
function scanJsxIdentifier(): SyntaxKind {
|
||||
if (token === SyntaxKind.Identifier) {
|
||||
if (tokenIsIdentifierOrKeyword(token)) {
|
||||
let firstCharPosition = pos;
|
||||
while (pos < end) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ namespace ts {
|
||||
if (!cachedProgram) {
|
||||
if (configFileName) {
|
||||
|
||||
let result = readConfigFile(configFileName);
|
||||
let result = readConfigFile(configFileName, sys.readFile);
|
||||
if (result.error) {
|
||||
reportDiagnostic(result.error);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
|
||||
+24
-9
@@ -1286,7 +1286,7 @@ namespace ts {
|
||||
// Stores a mapping 'external module reference text' -> 'resolved file name' | undefined
|
||||
// It is used to resolve module names in the checker.
|
||||
// Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
|
||||
/* @internal */ resolvedModules: Map<string>;
|
||||
/* @internal */ resolvedModules: Map<ResolvedModule>;
|
||||
/* @internal */ imports: LiteralExpression[];
|
||||
}
|
||||
|
||||
@@ -1361,6 +1361,7 @@ namespace ts {
|
||||
/* @internal */ getSymbolCount(): number;
|
||||
/* @internal */ getTypeCount(): number;
|
||||
|
||||
/* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection;
|
||||
// For testing purposes only.
|
||||
/* @internal */ structureIsReused?: boolean;
|
||||
}
|
||||
@@ -1716,6 +1717,7 @@ namespace ts {
|
||||
resolvedExports?: SymbolTable; // Resolved exports of module
|
||||
exportsChecked?: boolean; // True if exports of external module have been checked
|
||||
isNestedRedeclaration?: boolean; // True if symbol is block scoped redeclaration
|
||||
bindingElement?: BindingElement; // Binding element associated with property symbol
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -1813,11 +1815,14 @@ namespace ts {
|
||||
PropagatingFlags = ContainsUndefinedOrNull | ContainsObjectLiteral | ContainsAnyFunctionType
|
||||
}
|
||||
|
||||
export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
|
||||
// Properties common to all types
|
||||
export interface Type {
|
||||
flags: TypeFlags; // Flags
|
||||
/* @internal */ id: number; // Unique ID
|
||||
symbol?: Symbol; // Symbol associated with type (if any)
|
||||
flags: TypeFlags; // Flags
|
||||
/* @internal */ id: number; // Unique ID
|
||||
symbol?: Symbol; // Symbol associated with type (if any)
|
||||
pattern?: DestructuringPattern; // Destructuring pattern represented by type (if any)
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -1866,8 +1871,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface TupleType extends ObjectType {
|
||||
elementTypes: Type[]; // Element types
|
||||
baseArrayType: TypeReference; // Array<T> where T is best common type of element types
|
||||
elementTypes: Type[]; // Element types
|
||||
}
|
||||
|
||||
export interface UnionOrIntersectionType extends Type {
|
||||
@@ -2275,11 +2279,20 @@ namespace ts {
|
||||
|
||||
export interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
/*
|
||||
* Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be proper external module:
|
||||
* - be a .d.ts file
|
||||
* - use top level imports\exports
|
||||
* - don't use tripleslash references
|
||||
*/
|
||||
isExternalLibraryImport?: boolean;
|
||||
}
|
||||
|
||||
export interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModule;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
|
||||
export type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
|
||||
export interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
@@ -2297,7 +2310,7 @@ namespace ts {
|
||||
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
|
||||
* 'throw new Error("NotImplemented")'
|
||||
*/
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
|
||||
export interface TextSpan {
|
||||
@@ -2328,5 +2341,7 @@ namespace ts {
|
||||
// operation caused diagnostics to be returned by storing and comparing the return value
|
||||
// of this method before/after the operation is performed.
|
||||
getModificationCount(): number;
|
||||
|
||||
/* @internal */ reattachFileDiagnostics(newFile: SourceFile): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,20 +99,20 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function hasResolvedModuleName(sourceFile: SourceFile, moduleNameText: string): boolean {
|
||||
export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean {
|
||||
return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
|
||||
export function getResolvedModuleFileName(sourceFile: SourceFile, moduleNameText: string): string {
|
||||
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
export function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule {
|
||||
return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
}
|
||||
|
||||
export function setResolvedModuleName(sourceFile: SourceFile, moduleNameText: string, resolvedFileName: string): void {
|
||||
export function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModule): void {
|
||||
if (!sourceFile.resolvedModules) {
|
||||
sourceFile.resolvedModules = {};
|
||||
}
|
||||
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedModule;
|
||||
}
|
||||
|
||||
// Returns true if this node contains a parse error anywhere underneath it.
|
||||
@@ -435,6 +435,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
|
||||
export let fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
|
||||
|
||||
export function isTypeNode(node: Node): boolean {
|
||||
if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) {
|
||||
@@ -1507,12 +1508,23 @@ namespace ts {
|
||||
add,
|
||||
getGlobalDiagnostics,
|
||||
getDiagnostics,
|
||||
getModificationCount
|
||||
getModificationCount,
|
||||
reattachFileDiagnostics
|
||||
};
|
||||
|
||||
function getModificationCount() {
|
||||
return modificationCount;
|
||||
}
|
||||
|
||||
function reattachFileDiagnostics(newFile: SourceFile): void {
|
||||
if (!hasProperty(fileDiagnostics, newFile.fileName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let diagnostic of fileDiagnostics[newFile.fileName]) {
|
||||
diagnostic.file = newFile;
|
||||
}
|
||||
}
|
||||
|
||||
function add(diagnostic: Diagnostic): void {
|
||||
let diagnostics: Diagnostic[];
|
||||
|
||||
@@ -44,10 +44,10 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
// Everything declared here should be cleared out in the "after" callback.
|
||||
let justName: string;
|
||||
let content: string;
|
||||
let testCaseContent: { settings: Harness.TestCaseParser.CompilerSetting[]; testUnitData: Harness.TestCaseParser.TestUnitData[]; };
|
||||
let testCaseContent: { settings: Harness.TestCaseParser.CompilerSettings; testUnitData: Harness.TestCaseParser.TestUnitData[]; };
|
||||
|
||||
let units: Harness.TestCaseParser.TestUnitData[];
|
||||
let tcSettings: Harness.TestCaseParser.CompilerSetting[];
|
||||
let tcSettings: Harness.TestCaseParser.CompilerSettings;
|
||||
|
||||
let lastUnit: Harness.TestCaseParser.TestUnitData;
|
||||
let rootDir: string;
|
||||
@@ -61,15 +61,12 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
let otherFiles: { unitName: string; content: string }[];
|
||||
let harnessCompiler: Harness.Compiler.HarnessCompiler;
|
||||
|
||||
let createNewInstance = false;
|
||||
|
||||
before(() => {
|
||||
justName = fileName.replace(/^.*[\\\/]/, ""); // strips the fileName from the path.
|
||||
content = Harness.IO.readFile(fileName);
|
||||
testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName);
|
||||
units = testCaseContent.testUnitData;
|
||||
tcSettings = testCaseContent.settings;
|
||||
createNewInstance = false;
|
||||
lastUnit = units[units.length - 1];
|
||||
rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/";
|
||||
harnessCompiler = Harness.Compiler.getCompiler();
|
||||
@@ -100,27 +97,6 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
/* The compiler doesn't handle certain flags flipping during a single compilation setting. Tests on these flags will need
|
||||
a fresh compiler instance for themselves and then create a fresh one for the next test. Would be nice to get dev fixes
|
||||
eventually to remove this limitation. */
|
||||
for (let i = 0; i < tcSettings.length; ++i) {
|
||||
// noImplicitAny is passed to getCompiler, but target is just passed in the settings blob to setCompilerSettings
|
||||
if (!createNewInstance && (tcSettings[i].flag == "noimplicitany" || tcSettings[i].flag === "target")) {
|
||||
harnessCompiler = Harness.Compiler.getCompiler();
|
||||
harnessCompiler.setCompilerSettings(tcSettings);
|
||||
createNewInstance = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (createNewInstance) {
|
||||
harnessCompiler = Harness.Compiler.getCompiler();
|
||||
createNewInstance = false;
|
||||
}
|
||||
});
|
||||
|
||||
after(() => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
// Therefore we have to clean out large objects after the test is done.
|
||||
@@ -402,10 +378,6 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
else {
|
||||
this.tests.forEach(test => this.checkTestCodeOutput(test));
|
||||
}
|
||||
|
||||
describe("Cleanup after compiler baselines", () => {
|
||||
let harnessCompiler = Harness.Compiler.getCompiler();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+13
-87
@@ -29,13 +29,13 @@ module FourSlash {
|
||||
fileName: string;
|
||||
version: number;
|
||||
// File-specific options (name/value pairs)
|
||||
fileOptions: { [index: string]: string; };
|
||||
fileOptions: Harness.TestCaseParser.CompilerSettings;
|
||||
}
|
||||
|
||||
// Represents a set of parsed source files and options
|
||||
export interface FourSlashData {
|
||||
// Global options (name/value pairs)
|
||||
globalOptions: { [index: string]: string; };
|
||||
globalOptions: Harness.TestCaseParser.CompilerSettings;
|
||||
|
||||
files: FourSlashFile[];
|
||||
|
||||
@@ -117,89 +117,17 @@ module FourSlash {
|
||||
// Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data
|
||||
let metadataOptionNames = {
|
||||
baselineFile: "BaselineFile",
|
||||
declaration: "declaration",
|
||||
emitThisFile: "emitThisFile", // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project
|
||||
fileName: "Filename",
|
||||
mapRoot: "mapRoot",
|
||||
module: "module",
|
||||
out: "out",
|
||||
outFile: "outFile",
|
||||
outDir: "outDir",
|
||||
sourceMap: "sourceMap",
|
||||
sourceRoot: "sourceRoot",
|
||||
allowNonTsExtensions: "allowNonTsExtensions",
|
||||
resolveReference: "ResolveReference", // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file
|
||||
jsx: "jsx",
|
||||
};
|
||||
|
||||
// List of allowed metadata names
|
||||
let fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference];
|
||||
let globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration,
|
||||
metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out,metadataOptionNames.outFile,
|
||||
metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot, metadataOptionNames.jsx];
|
||||
|
||||
function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions {
|
||||
function convertGlobalOptionsToCompilerOptions(globalOptions: Harness.TestCaseParser.CompilerSettings): ts.CompilerOptions {
|
||||
let settings: ts.CompilerOptions = { target: ts.ScriptTarget.ES5 };
|
||||
// Convert all property in globalOptions into ts.CompilationSettings
|
||||
for (let prop in globalOptions) {
|
||||
if (globalOptions.hasOwnProperty(prop)) {
|
||||
switch (prop) {
|
||||
case metadataOptionNames.allowNonTsExtensions:
|
||||
settings.allowNonTsExtensions = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.declaration:
|
||||
settings.declaration = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.mapRoot:
|
||||
settings.mapRoot = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.module:
|
||||
// create appropriate external module target for CompilationSettings
|
||||
switch (globalOptions[prop]) {
|
||||
case "AMD":
|
||||
settings.module = ts.ModuleKind.AMD;
|
||||
break;
|
||||
case "CommonJS":
|
||||
settings.module = ts.ModuleKind.CommonJS;
|
||||
break;
|
||||
default:
|
||||
ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None");
|
||||
settings.module = ts.ModuleKind.None;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case metadataOptionNames.out:
|
||||
settings.out = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.outFile:
|
||||
settings.outFile = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.outDir:
|
||||
settings.outDir = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.sourceMap:
|
||||
settings.sourceMap = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.sourceRoot:
|
||||
settings.sourceRoot = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.jsx:
|
||||
switch (globalOptions[prop].toLowerCase()) {
|
||||
case "react":
|
||||
settings.jsx = ts.JsxEmit.React;
|
||||
break;
|
||||
case "preserve":
|
||||
settings.jsx = ts.JsxEmit.Preserve;
|
||||
break;
|
||||
default:
|
||||
ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None");
|
||||
settings.jsx = ts.JsxEmit.None;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Harness.Compiler.setCompilerOptionsFromHarnessSetting(globalOptions, settings);
|
||||
return settings;
|
||||
}
|
||||
|
||||
@@ -2514,12 +2442,16 @@ module FourSlash {
|
||||
// Comment line, check for global/file @options and record them
|
||||
let match = optionRegex.exec(line.substr(2));
|
||||
if (match) {
|
||||
let globalMetadataNamesIndex = globalMetadataNames.indexOf(match[1]);
|
||||
let fileMetadataNamesIndex = fileMetadataNames.indexOf(match[1]);
|
||||
if (globalMetadataNamesIndex === -1) {
|
||||
if (fileMetadataNamesIndex === -1) {
|
||||
throw new Error(`Unrecognized metadata name "${match[1]}". Available global metadata names are: ${globalMetadataNames.join(", ")}; file metadata names are: ${fileMetadataNames.join(", ")}`);
|
||||
} else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) {
|
||||
if (fileMetadataNamesIndex === -1) {
|
||||
// Check if the match is already existed in the global options
|
||||
if (globalOptions[match[1]] !== undefined) {
|
||||
throw new Error("Global Option : '" + match[1] + "' is already existed");
|
||||
}
|
||||
globalOptions[match[1]] = match[2];
|
||||
}
|
||||
else {
|
||||
if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) {
|
||||
// Found an @FileName directive, if this is not the first then create a new subfile
|
||||
if (currentFileContent) {
|
||||
let file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges);
|
||||
@@ -2540,12 +2472,6 @@ module FourSlash {
|
||||
// Add other fileMetadata flag
|
||||
currentFileOptions[match[1]] = match[2];
|
||||
}
|
||||
} else {
|
||||
// Check if the match is already existed in the global options
|
||||
if (globalOptions[match[1]] !== undefined) {
|
||||
throw new Error("Global Option : '" + match[1] + "' is already existed");
|
||||
}
|
||||
globalOptions[match[1]] = match[2];
|
||||
}
|
||||
}
|
||||
// TODO: should be '==='?
|
||||
|
||||
+94
-251
@@ -851,9 +851,9 @@ module Harness {
|
||||
}
|
||||
|
||||
export function createSourceFileAndAssertInvariants(
|
||||
fileName: string,
|
||||
sourceText: string,
|
||||
languageVersion: ts.ScriptTarget) {
|
||||
fileName: string,
|
||||
sourceText: string,
|
||||
languageVersion: ts.ScriptTarget) {
|
||||
// We'll only assert inletiants outside of light mode.
|
||||
const shouldAssertInvariants = !Harness.lightMode;
|
||||
|
||||
@@ -883,13 +883,13 @@ module Harness {
|
||||
}
|
||||
|
||||
export function createCompilerHost(
|
||||
inputFiles: { unitName: string; content: string; }[],
|
||||
writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void,
|
||||
scriptTarget: ts.ScriptTarget,
|
||||
useCaseSensitiveFileNames: boolean,
|
||||
// the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host
|
||||
currentDirectory?: string,
|
||||
newLineKind?: ts.NewLineKind): ts.CompilerHost {
|
||||
inputFiles: { unitName: string; content: string; }[],
|
||||
writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void,
|
||||
scriptTarget: ts.ScriptTarget,
|
||||
useCaseSensitiveFileNames: boolean,
|
||||
// the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host
|
||||
currentDirectory?: string,
|
||||
newLineKind?: ts.NewLineKind): ts.CompilerHost {
|
||||
|
||||
// Local get canonical file name function, that depends on passed in parameter for useCaseSensitiveFileNames
|
||||
function getCanonicalFileName(fileName: string): string {
|
||||
@@ -907,7 +907,7 @@ module Harness {
|
||||
}
|
||||
};
|
||||
inputFiles.forEach(register);
|
||||
|
||||
|
||||
function getSourceFile(fn: string, languageVersion: ts.ScriptTarget) {
|
||||
fn = ts.normalizePath(fn);
|
||||
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
|
||||
@@ -949,16 +949,79 @@ module Harness {
|
||||
};
|
||||
}
|
||||
|
||||
interface HarnessOptions {
|
||||
useCaseSensitiveFileNames?: boolean;
|
||||
includeBuiltFile?: string;
|
||||
baselineFile?: string;
|
||||
}
|
||||
|
||||
// Additional options not already in ts.optionDeclarations
|
||||
const harnessOptionDeclarations: ts.CommandLineOption[] = [
|
||||
{ name: "allowNonTsExtensions", type: "boolean" },
|
||||
{ name: "useCaseSensitiveFileNames", type: "boolean" },
|
||||
{ name: "baselineFile", type: "string" },
|
||||
{ name: "includeBuiltFile", type: "string" },
|
||||
{ name: "fileName", type: "string" },
|
||||
{ name: "noErrorTruncation", type: "boolean" }
|
||||
];
|
||||
|
||||
let optionsIndex: ts.Map<ts.CommandLineOption>;
|
||||
function getCommandLineOption(name: string): ts.CommandLineOption {
|
||||
if (!optionsIndex) {
|
||||
optionsIndex = {};
|
||||
let optionDeclarations = harnessOptionDeclarations.concat(ts.optionDeclarations);
|
||||
for (let option of optionDeclarations) {
|
||||
optionsIndex[option.name.toLowerCase()] = option;
|
||||
}
|
||||
}
|
||||
return ts.lookUp(optionsIndex, name.toLowerCase());
|
||||
}
|
||||
|
||||
export function setCompilerOptionsFromHarnessSetting(settings: Harness.TestCaseParser.CompilerSettings, options: ts.CompilerOptions & HarnessOptions): void {
|
||||
for (let name in settings) {
|
||||
if (settings.hasOwnProperty(name)) {
|
||||
let value = settings[name];
|
||||
if (value === undefined) {
|
||||
throw new Error(`Cannot have undefined value for compiler option '${name}'.`);
|
||||
}
|
||||
let option = getCommandLineOption(name);
|
||||
if (option) {
|
||||
switch (option.type) {
|
||||
case "boolean":
|
||||
options[option.name] = value.toLowerCase() === "true";
|
||||
break;
|
||||
case "string":
|
||||
options[option.name] = value;
|
||||
break;
|
||||
// If not a primitive, the possible types are specified in what is effectively a map of options.
|
||||
default:
|
||||
let map = <ts.Map<number>>option.type;
|
||||
let key = value.toLowerCase();
|
||||
if (ts.hasProperty(map, key)) {
|
||||
options[option.name] = map[key];
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown value '${value}' for compiler option '${name}'.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown compiler option '${name}'.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class HarnessCompiler {
|
||||
private inputFiles: { unitName: string; content: string }[] = [];
|
||||
private compileOptions: ts.CompilerOptions;
|
||||
private settings: Harness.TestCaseParser.CompilerSetting[] = [];
|
||||
private settings: Harness.TestCaseParser.CompilerSettings = {};
|
||||
|
||||
private lastErrors: ts.Diagnostic[];
|
||||
|
||||
public reset() {
|
||||
this.inputFiles = [];
|
||||
this.settings = [];
|
||||
this.settings = {};
|
||||
this.lastErrors = [];
|
||||
}
|
||||
|
||||
@@ -966,11 +1029,7 @@ module Harness {
|
||||
return this.lastErrors;
|
||||
}
|
||||
|
||||
public setCompilerSettingsFromOptions(tcSettings: ts.CompilerOptions) {
|
||||
this.settings = Object.keys(tcSettings).map(k => ({ flag: k, value: (<any>tcSettings)[k] }));
|
||||
}
|
||||
|
||||
public setCompilerSettings(tcSettings: Harness.TestCaseParser.CompilerSetting[]) {
|
||||
public setCompilerSettings(tcSettings: Harness.TestCaseParser.CompilerSettings) {
|
||||
this.settings = tcSettings;
|
||||
}
|
||||
|
||||
@@ -1006,7 +1065,7 @@ module Harness {
|
||||
otherFiles: { unitName: string; content: string }[],
|
||||
onComplete: (result: CompilerResult, program: ts.Program) => void,
|
||||
settingsCallback?: (settings: ts.CompilerOptions) => void,
|
||||
options?: ts.CompilerOptions,
|
||||
options?: ts.CompilerOptions & HarnessOptions,
|
||||
// Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file
|
||||
currentDirectory?: string) {
|
||||
|
||||
@@ -1015,21 +1074,27 @@ module Harness {
|
||||
options.module = options.module || ts.ModuleKind.None;
|
||||
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
|
||||
options.noErrorTruncation = true;
|
||||
options.skipDefaultLibCheck = true;
|
||||
|
||||
if (settingsCallback) {
|
||||
settingsCallback(null);
|
||||
}
|
||||
|
||||
let newLine = "\r\n";
|
||||
options.skipDefaultLibCheck = true;
|
||||
|
||||
// Parse settings
|
||||
setCompilerOptionsFromHarnessSetting(this.settings, options);
|
||||
|
||||
// Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
|
||||
// Treat them as library files, so include them in build, but not in baselines.
|
||||
let includeBuiltFiles: { unitName: string; content: string }[] = [];
|
||||
if (options.includeBuiltFile) {
|
||||
let builtFileName = libFolder + options.includeBuiltFile;
|
||||
includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) });
|
||||
}
|
||||
|
||||
let useCaseSensitiveFileNames = Harness.IO.useCaseSensitiveFileNames();
|
||||
this.settings.forEach(setCompilerOptionForSetting);
|
||||
|
||||
let useCaseSensitiveFileNames = options.useCaseSensitiveFileNames !== undefined ? options.useCaseSensitiveFileNames : Harness.IO.useCaseSensitiveFileNames();
|
||||
|
||||
let fileOutputs: GeneratedFile[] = [];
|
||||
|
||||
let programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
||||
@@ -1049,216 +1114,6 @@ module Harness {
|
||||
onComplete(result, program);
|
||||
|
||||
return options;
|
||||
|
||||
function setCompilerOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) {
|
||||
switch (setting.flag.toLowerCase()) {
|
||||
// "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve"
|
||||
case "module":
|
||||
case "modulegentarget":
|
||||
if (typeof setting.value === "string") {
|
||||
if (setting.value.toLowerCase() === "amd") {
|
||||
options.module = ts.ModuleKind.AMD;
|
||||
} else if (setting.value.toLowerCase() === "umd") {
|
||||
options.module = ts.ModuleKind.UMD;
|
||||
} else if (setting.value.toLowerCase() === "commonjs") {
|
||||
options.module = ts.ModuleKind.CommonJS;
|
||||
if (options.moduleResolution === undefined) {
|
||||
// TODO: currently we have relative module names pretty much in all tests that use CommonJS module target.
|
||||
// Such names could never be resolved in Node however classic resolution strategy still can handle them.
|
||||
// Changing all module names to relative will be a major overhaul in code (but we'll do this anyway) so as a temporary measure
|
||||
// we'll use ts.ModuleResolutionKind.Classic for CommonJS modules.
|
||||
options.moduleResolution = ts.ModuleResolutionKind.Classic;
|
||||
}
|
||||
} else if (setting.value.toLowerCase() === "system") {
|
||||
options.module = ts.ModuleKind.System;
|
||||
} else if (setting.value.toLowerCase() === "unspecified") {
|
||||
options.module = ts.ModuleKind.None;
|
||||
} else {
|
||||
throw new Error("Unknown module type " + setting.value);
|
||||
}
|
||||
} else {
|
||||
options.module = <any>setting.value;
|
||||
}
|
||||
break;
|
||||
case "moduleresolution":
|
||||
switch((setting.value || "").toLowerCase()) {
|
||||
case "classic":
|
||||
options.moduleResolution = ts.ModuleResolutionKind.Classic;
|
||||
break;
|
||||
case "node":
|
||||
options.moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "target":
|
||||
case "codegentarget":
|
||||
if (typeof setting.value === "string") {
|
||||
if (setting.value.toLowerCase() === "es3") {
|
||||
options.target = ts.ScriptTarget.ES3;
|
||||
} else if (setting.value.toLowerCase() === "es5") {
|
||||
options.target = ts.ScriptTarget.ES5;
|
||||
} else if (setting.value.toLowerCase() === "es6") {
|
||||
options.target = ts.ScriptTarget.ES6;
|
||||
} else {
|
||||
throw new Error("Unknown compile target " + setting.value);
|
||||
}
|
||||
} else {
|
||||
options.target = <any>setting.value;
|
||||
}
|
||||
break;
|
||||
|
||||
case "experimentaldecorators":
|
||||
options.experimentalDecorators = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "emitdecoratormetadata":
|
||||
options.emitDecoratorMetadata = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "experimentalasyncfunctions":
|
||||
options.experimentalAsyncFunctions = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "noemithelpers":
|
||||
options.noEmitHelpers = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "noemitonerror":
|
||||
options.noEmitOnError = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "noresolve":
|
||||
options.noResolve = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "noimplicitany":
|
||||
options.noImplicitAny = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "nolib":
|
||||
options.noLib = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "out":
|
||||
case "outfileoption":
|
||||
options.out = setting.value;
|
||||
break;
|
||||
|
||||
case "outfile":
|
||||
options.outFile = setting.value;
|
||||
break;
|
||||
|
||||
case "outdiroption":
|
||||
case "outdir":
|
||||
options.outDir = setting.value;
|
||||
break;
|
||||
|
||||
case "skipdefaultlibcheck":
|
||||
options.skipDefaultLibCheck = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "sourceroot":
|
||||
options.sourceRoot = setting.value;
|
||||
break;
|
||||
|
||||
case "maproot":
|
||||
options.mapRoot = setting.value;
|
||||
break;
|
||||
|
||||
case "sourcemap":
|
||||
options.sourceMap = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "declaration":
|
||||
options.declaration = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "newline":
|
||||
if (setting.value.toLowerCase() === "crlf") {
|
||||
options.newLine = ts.NewLineKind.CarriageReturnLineFeed;
|
||||
}
|
||||
else if (setting.value.toLowerCase() === "lf") {
|
||||
options.newLine = ts.NewLineKind.LineFeed;
|
||||
}
|
||||
else {
|
||||
throw new Error("Unknown option for newLine: " + setting.value);
|
||||
}
|
||||
break;
|
||||
|
||||
case "comments":
|
||||
options.removeComments = setting.value === "false";
|
||||
break;
|
||||
|
||||
case "stripinternal":
|
||||
options.stripInternal = setting.value === "true";
|
||||
|
||||
case "usecasesensitivefilenames":
|
||||
useCaseSensitiveFileNames = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "filename":
|
||||
// Not supported yet
|
||||
break;
|
||||
|
||||
case "emitbom":
|
||||
options.emitBOM = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "errortruncation":
|
||||
options.noErrorTruncation = setting.value === "false";
|
||||
break;
|
||||
|
||||
case "preserveconstenums":
|
||||
options.preserveConstEnums = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "isolatedmodules":
|
||||
options.isolatedModules = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "suppressexcesspropertyerrors":
|
||||
options.suppressExcessPropertyErrors = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "suppressimplicitanyindexerrors":
|
||||
options.suppressImplicitAnyIndexErrors = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "includebuiltfile":
|
||||
let builtFileName = libFolder + setting.value;
|
||||
includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) });
|
||||
break;
|
||||
|
||||
case "inlinesourcemap":
|
||||
options.inlineSourceMap = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "inlinesources":
|
||||
options.inlineSources = setting.value === "true";
|
||||
break;
|
||||
|
||||
case "jsx":
|
||||
options.jsx = setting.value.toLowerCase() === "react" ? ts.JsxEmit.React :
|
||||
setting.value.toLowerCase() === "preserve" ? ts.JsxEmit.Preserve :
|
||||
ts.JsxEmit.None;
|
||||
break;
|
||||
case "nounusedlabels":
|
||||
options.noUnusedLabels = setting.value === "true"
|
||||
break;
|
||||
case "noimplicitreturns":
|
||||
options.noImplicitReturns = setting.value === "true"
|
||||
break;
|
||||
case "nofallthroughcasesinswitch":
|
||||
options.noFallthroughCasesInSwitch = setting.value === "true"
|
||||
break;
|
||||
case "nounreachablecode":
|
||||
options.noUnreachableCode = setting.value === "true"
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error("Unsupported compiler setting " + setting.flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public compileDeclarationFiles(inputFiles: { unitName: string; content: string; }[],
|
||||
@@ -1583,9 +1438,8 @@ module Harness {
|
||||
|
||||
export module TestCaseParser {
|
||||
/** all the necessary information to set the right compiler settings */
|
||||
export interface CompilerSetting {
|
||||
flag: string;
|
||||
value: string;
|
||||
export interface CompilerSettings {
|
||||
[name: string]: string;
|
||||
}
|
||||
|
||||
/** All the necessary information to turn a multi file test into useful units for later compilation */
|
||||
@@ -1600,30 +1454,19 @@ module Harness {
|
||||
// Regex for parsing options in the format "@Alpha: Value of any sort"
|
||||
let optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
|
||||
|
||||
// List of allowed metadata names
|
||||
let fileMetadataNames = ["filename", "comments", "declaration", "module",
|
||||
"nolib", "sourcemap", "target", "out", "outdir", "noemithelpers", "noemitonerror",
|
||||
"noimplicitany", "noresolve", "newline", "normalizenewline", "emitbom",
|
||||
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
|
||||
"includebuiltfile", "suppressexcesspropertyerrors", "suppressimplicitanyindexerrors", "stripinternal",
|
||||
"isolatedmodules", "inlinesourcemap", "maproot", "sourceroot",
|
||||
"inlinesources", "emitdecoratormetadata", "experimentaldecorators",
|
||||
"skipdefaultlibcheck", "jsx"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
let opts: CompilerSetting[] = [];
|
||||
function extractCompilerSettings(content: string): CompilerSettings {
|
||||
let opts: CompilerSettings = {};
|
||||
|
||||
let match: RegExpExecArray;
|
||||
while ((match = optionRegex.exec(content)) != null) {
|
||||
opts.push({ flag: match[1], value: match[2] });
|
||||
opts[match[1]] = match[2];
|
||||
}
|
||||
|
||||
return opts;
|
||||
}
|
||||
|
||||
/** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */
|
||||
export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSetting[]; testUnitData: TestUnitData[]; } {
|
||||
export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSettings; testUnitData: TestUnitData[]; } {
|
||||
let settings = extractCompilerSettings(code);
|
||||
|
||||
// List of all the subfiles we've parsed out
|
||||
|
||||
@@ -225,8 +225,8 @@ module Harness.LanguageService {
|
||||
let imports: ts.Map<string> = {};
|
||||
for (let module of preprocessInfo.importedFiles) {
|
||||
let resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost);
|
||||
if (resolutionInfo.resolvedFileName) {
|
||||
imports[module.fileName] = resolutionInfo.resolvedFileName;
|
||||
if (resolutionInfo.resolvedModule) {
|
||||
imports[module.fileName] = resolutionInfo.resolvedModule.resolvedFileName;
|
||||
}
|
||||
}
|
||||
return JSON.stringify(imports);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
interface TimestampedResolvedModule extends ResolvedModule {
|
||||
interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations {
|
||||
lastCheckTime: number;
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
resolveModuleNames(moduleNames: string[], containingFile: string): string[] {
|
||||
resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] {
|
||||
let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile);
|
||||
|
||||
let newResolutions: Map<TimestampedResolvedModule> = {};
|
||||
let resolvedFileNames: string[] = [];
|
||||
let resolvedModules: ResolvedModule[] = [];
|
||||
|
||||
let compilerOptions = this.getCompilationSettings();
|
||||
|
||||
@@ -119,25 +119,25 @@ namespace ts.server {
|
||||
else {
|
||||
resolution = <TimestampedResolvedModule>resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost);
|
||||
resolution.lastCheckTime = Date.now();
|
||||
newResolutions[moduleName] = resolution;
|
||||
newResolutions[moduleName] = resolution;
|
||||
}
|
||||
}
|
||||
|
||||
ts.Debug.assert(resolution !== undefined);
|
||||
|
||||
resolvedFileNames.push(resolution.resolvedFileName);
|
||||
resolvedModules.push(resolution.resolvedModule);
|
||||
}
|
||||
|
||||
// replace old results with a new one
|
||||
this.resolvedModuleNames.set(containingFile, newResolutions);
|
||||
return resolvedFileNames;
|
||||
return resolvedModules;
|
||||
|
||||
function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean {
|
||||
if (!resolution) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resolution.resolvedFileName) {
|
||||
if (resolution.resolvedModule) {
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
return true;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace ts.formatting {
|
||||
*/
|
||||
interface DynamicIndentation {
|
||||
getIndentationForToken(tokenLine: number, tokenKind: SyntaxKind): number;
|
||||
getIndentationForComment(owningToken: SyntaxKind): number;
|
||||
getIndentationForComment(owningToken: SyntaxKind, tokenIndentation: number): number;
|
||||
/**
|
||||
* Indentation for open and close tokens of the node if it is block or another node that needs special indentation
|
||||
* ... {
|
||||
@@ -455,7 +455,7 @@ namespace ts.formatting {
|
||||
|
||||
function getDynamicIndentation(node: Node, nodeStartLine: number, indentation: number, delta: number): DynamicIndentation {
|
||||
return {
|
||||
getIndentationForComment: kind => {
|
||||
getIndentationForComment: (kind, tokenIndentation) => {
|
||||
switch (kind) {
|
||||
// preceding comment to the token that closes the indentation scope inherits the indentation from the scope
|
||||
// .. {
|
||||
@@ -463,9 +463,10 @@ namespace ts.formatting {
|
||||
// }
|
||||
case SyntaxKind.CloseBraceToken:
|
||||
case SyntaxKind.CloseBracketToken:
|
||||
case SyntaxKind.CloseParenToken:
|
||||
return indentation + delta;
|
||||
}
|
||||
return indentation;
|
||||
return tokenIndentation !== Constants.Unknown ? tokenIndentation : indentation;
|
||||
},
|
||||
getIndentationForToken: (line, kind) => {
|
||||
if (nodeStartLine !== line && node.decorators) {
|
||||
@@ -716,8 +717,14 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
if (indentToken) {
|
||||
let indentNextTokenOrTrivia = true;
|
||||
let tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ?
|
||||
dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) :
|
||||
Constants.Unknown;
|
||||
|
||||
if (currentTokenInfo.leadingTrivia) {
|
||||
let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation);
|
||||
let indentNextTokenOrTrivia = true;
|
||||
|
||||
for (let triviaItem of currentTokenInfo.leadingTrivia) {
|
||||
if (!rangeContainsRange(originalRange, triviaItem)) {
|
||||
continue;
|
||||
@@ -725,13 +732,11 @@ namespace ts.formatting {
|
||||
|
||||
switch (triviaItem.kind) {
|
||||
case SyntaxKind.MultiLineCommentTrivia:
|
||||
let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
|
||||
indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia);
|
||||
indentNextTokenOrTrivia = false;
|
||||
break;
|
||||
case SyntaxKind.SingleLineCommentTrivia:
|
||||
if (indentNextTokenOrTrivia) {
|
||||
let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
|
||||
insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false);
|
||||
indentNextTokenOrTrivia = false;
|
||||
}
|
||||
@@ -744,8 +749,7 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
// indent token only if is it is in target range and does not overlap with any error ranges
|
||||
if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) {
|
||||
let tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind);
|
||||
if (tokenIndentation !== Constants.Unknown) {
|
||||
insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
|
||||
|
||||
lastIndentedLine = tokenStart.line;
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace ts.formatting {
|
||||
Scan,
|
||||
RescanGreaterThanToken,
|
||||
RescanSlashToken,
|
||||
RescanTemplateToken
|
||||
RescanTemplateToken,
|
||||
RescanJsxIdentifier
|
||||
}
|
||||
|
||||
export function getFormattingScanner(sourceFile: SourceFile, startPos: number, endPos: number): FormattingScanner {
|
||||
@@ -108,6 +109,20 @@ namespace ts.formatting {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function shouldRescanJsxIdentifier(node: Node): boolean {
|
||||
if (node.parent) {
|
||||
switch(node.parent.kind) {
|
||||
case SyntaxKind.JsxAttribute:
|
||||
case SyntaxKind.JsxOpeningElement:
|
||||
case SyntaxKind.JsxClosingElement:
|
||||
case SyntaxKind.JsxSelfClosingElement:
|
||||
return node.kind === SyntaxKind.Identifier;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function shouldRescanSlashToken(container: Node): boolean {
|
||||
return container.kind === SyntaxKind.RegularExpressionLiteral;
|
||||
@@ -141,7 +156,9 @@ namespace ts.formatting {
|
||||
? ScanAction.RescanSlashToken
|
||||
: shouldRescanTemplateToken(n)
|
||||
? ScanAction.RescanTemplateToken
|
||||
: ScanAction.Scan
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? ScanAction.RescanJsxIdentifier
|
||||
: ScanAction.Scan
|
||||
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
// readTokenInfo was called before with the same expected scan action.
|
||||
@@ -176,6 +193,10 @@ namespace ts.formatting {
|
||||
currentToken = scanner.reScanTemplateToken();
|
||||
lastScanAction = ScanAction.RescanTemplateToken;
|
||||
}
|
||||
else if (expectedScanAction === ScanAction.RescanJsxIdentifier && currentToken === SyntaxKind.Identifier) {
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = ScanAction.RescanJsxIdentifier;
|
||||
}
|
||||
else {
|
||||
lastScanAction = ScanAction.Scan;
|
||||
}
|
||||
|
||||
@@ -213,25 +213,11 @@ namespace ts.formatting {
|
||||
public NoSpaceBetweenYieldKeywordAndStar: Rule;
|
||||
public SpaceBetweenYieldOrYieldStarAndOperand: Rule;
|
||||
|
||||
// Async-await
|
||||
// Async functions
|
||||
public SpaceBetweenAsyncAndFunctionKeyword: Rule;
|
||||
public NoSpaceBetweenAsyncAndFunctionKeyword: Rule;
|
||||
public SpaceAfterAwaitKeyword: Rule;
|
||||
public NoSpaceAfterAwaitKeyword: Rule;
|
||||
|
||||
// Type alias declaration
|
||||
public SpaceAfterTypeKeyword: Rule;
|
||||
public NoSpaceAfterTypeKeyword: Rule;
|
||||
|
||||
// Tagged template string
|
||||
public SpaceBetweenTagAndTemplateString: Rule;
|
||||
public NoSpaceBetweenTagAndTemplateString: Rule;
|
||||
|
||||
// Union type
|
||||
public SpaceBeforeBar: Rule;
|
||||
public NoSpaceBeforeBar: Rule;
|
||||
public SpaceAfterBar: Rule;
|
||||
public NoSpaceAfterBar: Rule;
|
||||
|
||||
constructor() {
|
||||
///
|
||||
@@ -272,7 +258,7 @@ namespace ts.formatting {
|
||||
this.SpaceBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
|
||||
this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia]);
|
||||
this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword]);
|
||||
this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Place a space before open brace in a control flow construct
|
||||
@@ -313,7 +299,7 @@ namespace ts.formatting {
|
||||
|
||||
this.NoSpaceBeforeComma = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CommaToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword, SyntaxKind.AwaitKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete));
|
||||
this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
@@ -346,7 +332,7 @@ namespace ts.formatting {
|
||||
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Add a space around certain TypeScript keywords
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
|
||||
@@ -382,24 +368,9 @@ namespace ts.formatting {
|
||||
|
||||
// Async-await
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterAwaitKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.AwaitKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAwaitKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.AwaitKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Type alias declaration
|
||||
this.SpaceAfterTypeKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.TypeKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterTypeKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.TypeKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// template string
|
||||
this.SpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// union type
|
||||
this.SpaceBeforeBar = new Rule(RuleDescriptor.create3(SyntaxKind.BarToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeBar = new Rule(RuleDescriptor.create3(SyntaxKind.BarToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterBar = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.BarToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterBar = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.BarToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
|
||||
// These rules are higher in priority than user-configurable rules.
|
||||
this.HighPriorityCommonRules =
|
||||
@@ -427,11 +398,8 @@ namespace ts.formatting {
|
||||
this.NoSpaceBeforeOpenParenInFuncCall,
|
||||
this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator,
|
||||
this.SpaceAfterVoidOperator,
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword, this.NoSpaceBetweenAsyncAndFunctionKeyword,
|
||||
this.SpaceAfterAwaitKeyword, this.NoSpaceAfterAwaitKeyword,
|
||||
this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword,
|
||||
this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString,
|
||||
this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar,
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword,
|
||||
this.SpaceBetweenTagAndTemplateString,
|
||||
|
||||
// TypeScript-specific rules
|
||||
this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,
|
||||
@@ -535,6 +503,8 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.AsExpression:
|
||||
case SyntaxKind.TypePredicate:
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.IntersectionType:
|
||||
return true;
|
||||
|
||||
// equals in binding elements: function foo([[x, y] = [1, 2]])
|
||||
@@ -663,6 +633,7 @@ namespace ts.formatting {
|
||||
static NodeIsTypeScriptDeclWithBlockContext(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
|
||||
@@ -405,6 +405,7 @@ namespace ts.formatting {
|
||||
function nodeContentIsAlwaysIndented(kind: SyntaxKind): boolean {
|
||||
switch (kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
@@ -429,13 +430,13 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.JsxElement:
|
||||
case SyntaxKind.JsxSelfClosingElement:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.AwaitExpression:
|
||||
|
||||
@@ -802,7 +802,7 @@ namespace ts {
|
||||
public languageVariant: LanguageVariant;
|
||||
public identifiers: Map<string>;
|
||||
public nameTable: Map<string>;
|
||||
public resolvedModules: Map<string>;
|
||||
public resolvedModules: Map<ResolvedModule>;
|
||||
public imports: LiteralExpression[];
|
||||
private namedDeclarations: Map<Declaration[]>;
|
||||
|
||||
@@ -1022,7 +1022,7 @@ namespace ts {
|
||||
* if implementation is omitted then language service will use built-in module resolution logic and get answers to
|
||||
* host specific questions using 'getScriptSnapshot'.
|
||||
*/
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1866,7 +1866,7 @@ namespace ts {
|
||||
let sourceMapText: string;
|
||||
// Create a compilerHost object to allow the compiler to read and write files
|
||||
let compilerHost: CompilerHost = {
|
||||
getSourceFile: (fileName, target) => fileName === inputFileName ? sourceFile : undefined,
|
||||
getSourceFile: (fileName, target) => fileName === normalizeSlashes(inputFileName) ? sourceFile : undefined,
|
||||
writeFile: (name, text, writeByteOrderMark) => {
|
||||
if (fileExtensionIs(name, ".map")) {
|
||||
Debug.assert(sourceMapText === undefined, `Unexpected multiple source map outputs for the file '${name}'`);
|
||||
|
||||
+10
-3
@@ -273,7 +273,7 @@ namespace ts {
|
||||
private loggingEnabled = false;
|
||||
private tracingEnabled = false;
|
||||
|
||||
public resolveModuleNames: (moduleName: string[], containingFile: string) => string[];
|
||||
public resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[];
|
||||
|
||||
constructor(private shimHost: LanguageServiceShimHost) {
|
||||
// if shimHost is a COM object then property check will become method call with no arguments.
|
||||
@@ -281,7 +281,10 @@ namespace ts {
|
||||
if ("getModuleResolutionsForFile" in this.shimHost) {
|
||||
this.resolveModuleNames = (moduleNames: string[], containingFile: string) => {
|
||||
let resolutionsInFile = <Map<string>>JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile));
|
||||
return map(moduleNames, name => lookUp(resolutionsInFile, name));
|
||||
return map(moduleNames, name => {
|
||||
const result = lookUp(resolutionsInFile, name);
|
||||
return result ? { resolvedFileName: result } : undefined;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -941,7 +944,11 @@ namespace ts {
|
||||
public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string {
|
||||
return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => {
|
||||
let compilerOptions = <CompilerOptions>JSON.parse(compilerOptionsJson);
|
||||
return resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
|
||||
const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
|
||||
return {
|
||||
resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName: undefined,
|
||||
failedLookupLocations: result.failedLookupLocations
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+25
-14
@@ -360,7 +360,7 @@ namespace ts {
|
||||
return find(startNode || sourceFile);
|
||||
|
||||
function findRightmostToken(n: Node): Node {
|
||||
if (isToken(n)) {
|
||||
if (isToken(n) || n.kind === SyntaxKind.JsxText) {
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -371,24 +371,35 @@ namespace ts {
|
||||
}
|
||||
|
||||
function find(n: Node): Node {
|
||||
if (isToken(n)) {
|
||||
if (isToken(n) || n.kind === SyntaxKind.JsxText) {
|
||||
return n;
|
||||
}
|
||||
|
||||
let children = n.getChildren();
|
||||
const children = n.getChildren();
|
||||
for (let i = 0, len = children.length; i < len; i++) {
|
||||
let child = children[i];
|
||||
if (nodeHasTokens(child)) {
|
||||
if (position <= child.end) {
|
||||
if (child.getStart(sourceFile) >= position) {
|
||||
// actual start of the node is past the position - previous token should be at the end of previous child
|
||||
let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i);
|
||||
return candidate && findRightmostToken(candidate)
|
||||
}
|
||||
else {
|
||||
// candidate should be in this node
|
||||
return find(child);
|
||||
}
|
||||
// condition 'position < child.end' checks if child node end after the position
|
||||
// in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc'
|
||||
// aaaa___bbbb___$__ccc
|
||||
// after we found child node with end after the position we check if start of the node is after the position.
|
||||
// if yes - then position is in the trivia and we need to look into the previous child to find the token in question.
|
||||
// if no - position is in the node itself so we should recurse in it.
|
||||
// NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia).
|
||||
// if this is the case - then we should assume that token in question is located in previous child.
|
||||
if (position < child.end && (nodeHasTokens(child) || child.kind === SyntaxKind.JsxText)) {
|
||||
const start = child.getStart(sourceFile);
|
||||
const lookInPreviousChild =
|
||||
(start >= position) || // cursor in the leading trivia
|
||||
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
|
||||
|
||||
if (lookInPreviousChild) {
|
||||
// actual start of the node is past the position - previous token should be at the end of previous child
|
||||
let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i);
|
||||
return candidate && findRightmostToken(candidate)
|
||||
}
|
||||
else {
|
||||
// candidate should be in this node
|
||||
return find(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tes
|
||||
|
||||
|
||||
==== tests/cases/compiler/aliasAssignments_1.ts (2 errors) ====
|
||||
import moduleA = require("aliasAssignments_moduleA");
|
||||
import moduleA = require("./aliasAssignments_moduleA");
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
~
|
||||
|
||||
@@ -6,7 +6,7 @@ export class someClass {
|
||||
}
|
||||
|
||||
//// [aliasAssignments_1.ts]
|
||||
import moduleA = require("aliasAssignments_moduleA");
|
||||
import moduleA = require("./aliasAssignments_moduleA");
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
var y = 1;
|
||||
@@ -21,7 +21,7 @@ var someClass = (function () {
|
||||
})();
|
||||
exports.someClass = someClass;
|
||||
//// [aliasAssignments_1.js]
|
||||
var moduleA = require("aliasAssignments_moduleA");
|
||||
var moduleA = require("./aliasAssignments_moduleA");
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
var y = 1;
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsage1_moduleA.ts]
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsage1_main.ts]
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import moduleA = require("aliasUsage1_moduleA");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
import moduleA = require("./aliasUsage1_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsage1_backbone");
|
||||
var Backbone = require("./aliasUsage1_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -50,7 +50,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsage1_main.js]
|
||||
var moduleA = require("aliasUsage1_moduleA");
|
||||
var moduleA = require("./aliasUsage1_moduleA");
|
||||
var C2 = (function () {
|
||||
function C2() {
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsage1_main.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsage1_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsage1_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50))
|
||||
import moduleA = require("./aliasUsage1_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_main.ts, 2, 34))
|
||||
@@ -19,7 +19,7 @@ class C2 {
|
||||
|
||||
x: IHasVisualizationModel;
|
||||
>x : Symbol(x, Decl(aliasUsage1_main.ts, 5, 10))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50))
|
||||
|
||||
get A() {
|
||||
>A : Symbol(A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5))
|
||||
@@ -35,7 +35,7 @@ class C2 {
|
||||
|
||||
x = moduleA;
|
||||
>x : Symbol(x, Decl(aliasUsage1_main.ts, 10, 10))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52))
|
||||
}
|
||||
}
|
||||
=== tests/cases/compiler/aliasUsage1_backbone.ts ===
|
||||
@@ -47,11 +47,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsage1_moduleA.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 50))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 52))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsage1_main.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsage1_moduleA");
|
||||
import moduleA = require("./aliasUsage1_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -48,7 +48,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsage1_moduleA.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInArray_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInArray_main.ts]
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import moduleA = require("aliasUsageInArray_moduleA");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
import moduleA = require("./aliasUsageInArray_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInArray_backbone");
|
||||
var Backbone = require("./aliasUsageInArray_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -44,6 +44,6 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInArray_main.js]
|
||||
var moduleA = require("aliasUsageInArray_moduleA");
|
||||
var moduleA = require("./aliasUsageInArray_moduleA");
|
||||
var xs = [moduleA];
|
||||
var xs2 = [moduleA];
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInArray_main.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInArray_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
import moduleA = require("./aliasUsageInArray_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_main.ts, 2, 34))
|
||||
@@ -17,13 +17,13 @@ interface IHasVisualizationModel {
|
||||
|
||||
var xs: IHasVisualizationModel[] = [moduleA];
|
||||
>xs : Symbol(xs, Decl(aliasUsageInArray_main.ts, 6, 3))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
|
||||
var xs2: typeof moduleA[] = [moduleA];
|
||||
>xs2 : Symbol(xs2, Decl(aliasUsageInArray_main.ts, 7, 3))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInArray_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -34,11 +34,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInArray_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 56))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 58))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInArray_main.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInArray_moduleA");
|
||||
import moduleA = require("./aliasUsageInArray_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -36,7 +36,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInArray_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInFunctionExpression_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInFunctionExpression_main.ts]
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import moduleA = require("aliasUsageInFunctionExpression_moduleA");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
import moduleA = require("./aliasUsageInFunctionExpression_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
var Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -43,6 +43,6 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInFunctionExpression_main.js]
|
||||
var moduleA = require("aliasUsageInFunctionExpression_moduleA");
|
||||
var moduleA = require("./aliasUsageInFunctionExpression_moduleA");
|
||||
var f = function (x) { return x; };
|
||||
f = function (x) { return moduleA; };
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInFunctionExpression_main.ts ===
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInFunctionExpression_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 69))
|
||||
import moduleA = require("./aliasUsageInFunctionExpression_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 71))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 67))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 69))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 2, 34))
|
||||
@@ -17,13 +17,13 @@ interface IHasVisualizationModel {
|
||||
var f = (x: IHasVisualizationModel) => x;
|
||||
>f : Symbol(f, Decl(aliasUsageInFunctionExpression_main.ts, 5, 3))
|
||||
>x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 5, 9))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 67))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 69))
|
||||
>x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 5, 9))
|
||||
|
||||
f = (x) => moduleA;
|
||||
>f : Symbol(f, Decl(aliasUsageInFunctionExpression_main.ts, 5, 3))
|
||||
>x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 6, 5))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 69))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 71))
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInFunctionExpression_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -34,11 +34,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 69))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 71))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInFunctionExpression_main.ts ===
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInFunctionExpression_moduleA");
|
||||
import moduleA = require("./aliasUsageInFunctionExpression_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -37,7 +37,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInGenericFunction_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
import Backbone = require("./aliasUsageInGenericFunction_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInGenericFunction_main.ts]
|
||||
import Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
import moduleA = require("aliasUsageInGenericFunction_moduleA");
|
||||
import Backbone = require("./aliasUsageInGenericFunction_backbone");
|
||||
import moduleA = require("./aliasUsageInGenericFunction_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
var Backbone = require("./aliasUsageInGenericFunction_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -47,7 +47,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInGenericFunction_main.js]
|
||||
var moduleA = require("aliasUsageInGenericFunction_moduleA");
|
||||
var moduleA = require("./aliasUsageInGenericFunction_moduleA");
|
||||
function foo(x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInGenericFunction_main.ts ===
|
||||
import Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
import Backbone = require("./aliasUsageInGenericFunction_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInGenericFunction_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 66))
|
||||
import moduleA = require("./aliasUsageInGenericFunction_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 68))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 2, 34))
|
||||
@@ -18,7 +18,7 @@ function foo<T extends { a: IHasVisualizationModel }>(x: T) {
|
||||
>foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1))
|
||||
>T : Symbol(T, Decl(aliasUsageInGenericFunction_main.ts, 5, 13))
|
||||
>a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 5, 24))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66))
|
||||
>x : Symbol(x, Decl(aliasUsageInGenericFunction_main.ts, 5, 54))
|
||||
>T : Symbol(T, Decl(aliasUsageInGenericFunction_main.ts, 5, 13))
|
||||
|
||||
@@ -29,13 +29,13 @@ var r = foo({ a: moduleA });
|
||||
>r : Symbol(r, Decl(aliasUsageInGenericFunction_main.ts, 8, 3))
|
||||
>foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1))
|
||||
>a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 8, 13))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 66))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 68))
|
||||
|
||||
var r2 = foo({ a: <IHasVisualizationModel>null });
|
||||
>r2 : Symbol(r2, Decl(aliasUsageInGenericFunction_main.ts, 9, 3))
|
||||
>foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1))
|
||||
>a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 9, 14))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66))
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInGenericFunction_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -46,11 +46,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
import Backbone = require("./aliasUsageInGenericFunction_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 66))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 68))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInGenericFunction_main.ts ===
|
||||
import Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
import Backbone = require("./aliasUsageInGenericFunction_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInGenericFunction_moduleA");
|
||||
import moduleA = require("./aliasUsageInGenericFunction_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -52,7 +52,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
import Backbone = require("./aliasUsageInGenericFunction_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInIndexerOfClass_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInIndexerOfClass_main.ts]
|
||||
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
import moduleA = require("aliasUsageInIndexerOfClass_moduleA");
|
||||
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
|
||||
import moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
var Backbone = require("./aliasUsageInIndexerOfClass_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -49,7 +49,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInIndexerOfClass_main.js]
|
||||
var moduleA = require("aliasUsageInIndexerOfClass_moduleA");
|
||||
var moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
|
||||
var N = (function () {
|
||||
function N() {
|
||||
this.x = moduleA;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInIndexerOfClass_main.ts ===
|
||||
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInIndexerOfClass_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65))
|
||||
import moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 2, 34))
|
||||
@@ -19,22 +19,22 @@ class N {
|
||||
|
||||
[idx: string]: IHasVisualizationModel
|
||||
>idx : Symbol(idx, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 5))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65))
|
||||
|
||||
x = moduleA;
|
||||
>x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 41))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67))
|
||||
}
|
||||
class N2 {
|
||||
>N2 : Symbol(N2, Decl(aliasUsageInIndexerOfClass_main.ts, 8, 1))
|
||||
|
||||
[idx: string]: typeof moduleA
|
||||
>idx : Symbol(idx, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 5))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67))
|
||||
|
||||
x: IHasVisualizationModel;
|
||||
>x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 33))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65))
|
||||
}
|
||||
=== tests/cases/compiler/aliasUsageInIndexerOfClass_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -45,11 +45,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 65))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 67))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInIndexerOfClass_main.ts ===
|
||||
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInIndexerOfClass_moduleA");
|
||||
import moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -45,7 +45,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInObjectLiteral_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInObjectLiteral_main.ts]
|
||||
import Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
import moduleA = require("aliasUsageInObjectLiteral_moduleA");
|
||||
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
|
||||
import moduleA = require("./aliasUsageInObjectLiteral_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
var Backbone = require("./aliasUsageInObjectLiteral_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -44,7 +44,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInObjectLiteral_main.js]
|
||||
var moduleA = require("aliasUsageInObjectLiteral_moduleA");
|
||||
var moduleA = require("./aliasUsageInObjectLiteral_moduleA");
|
||||
var a = { x: moduleA };
|
||||
var b = { x: moduleA };
|
||||
var c = { y: { z: moduleA } };
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInObjectLiteral_main.ts ===
|
||||
import Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInObjectLiteral_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
|
||||
import moduleA = require("./aliasUsageInObjectLiteral_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 2, 34))
|
||||
@@ -17,25 +17,25 @@ interface IHasVisualizationModel {
|
||||
var a: { x: typeof moduleA } = { x: moduleA };
|
||||
>a : Symbol(a, Decl(aliasUsageInObjectLiteral_main.ts, 5, 3))
|
||||
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 5, 8))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
|
||||
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 5, 32))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
|
||||
|
||||
var b: { x: IHasVisualizationModel } = { x: moduleA };
|
||||
>b : Symbol(b, Decl(aliasUsageInObjectLiteral_main.ts, 6, 3))
|
||||
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 6, 8))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64))
|
||||
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 6, 40))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
|
||||
|
||||
var c: { y: { z: IHasVisualizationModel } } = { y: { z: moduleA } };
|
||||
>c : Symbol(c, Decl(aliasUsageInObjectLiteral_main.ts, 7, 3))
|
||||
>y : Symbol(y, Decl(aliasUsageInObjectLiteral_main.ts, 7, 8))
|
||||
>z : Symbol(z, Decl(aliasUsageInObjectLiteral_main.ts, 7, 13))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64))
|
||||
>y : Symbol(y, Decl(aliasUsageInObjectLiteral_main.ts, 7, 47))
|
||||
>z : Symbol(z, Decl(aliasUsageInObjectLiteral_main.ts, 7, 52))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInObjectLiteral_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -46,11 +46,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 64))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 66))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInObjectLiteral_main.ts ===
|
||||
import Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInObjectLiteral_moduleA");
|
||||
import moduleA = require("./aliasUsageInObjectLiteral_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -50,7 +50,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInOrExpression_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInOrExpression_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInOrExpression_main.ts]
|
||||
import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
import moduleA = require("aliasUsageInOrExpression_moduleA");
|
||||
import Backbone = require("./aliasUsageInOrExpression_backbone");
|
||||
import moduleA = require("./aliasUsageInOrExpression_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
var Backbone = require("./aliasUsageInOrExpression_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -47,7 +47,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInOrExpression_main.js]
|
||||
var moduleA = require("aliasUsageInOrExpression_moduleA");
|
||||
var moduleA = require("./aliasUsageInOrExpression_moduleA");
|
||||
var i;
|
||||
var d1 = i || moduleA;
|
||||
var d2 = i || moduleA;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInOrExpression_main.ts ===
|
||||
import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInOrExpression_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInOrExpression_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
|
||||
import moduleA = require("./aliasUsageInOrExpression_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 2, 34))
|
||||
@@ -16,42 +16,42 @@ interface IHasVisualizationModel {
|
||||
}
|
||||
var i: IHasVisualizationModel;
|
||||
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
|
||||
var d1 = i || moduleA;
|
||||
>d1 : Symbol(d1, Decl(aliasUsageInOrExpression_main.ts, 6, 3))
|
||||
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
|
||||
|
||||
var d2: IHasVisualizationModel = i || moduleA;
|
||||
>d2 : Symbol(d2, Decl(aliasUsageInOrExpression_main.ts, 7, 3), Decl(aliasUsageInOrExpression_main.ts, 8, 3))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
|
||||
|
||||
var d2: IHasVisualizationModel = moduleA || i;
|
||||
>d2 : Symbol(d2, Decl(aliasUsageInOrExpression_main.ts, 7, 3), Decl(aliasUsageInOrExpression_main.ts, 8, 3))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
|
||||
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
|
||||
|
||||
var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || { x: moduleA };
|
||||
>e : Symbol(e, Decl(aliasUsageInOrExpression_main.ts, 9, 3))
|
||||
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 8))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 41))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 79))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
|
||||
|
||||
var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x: moduleA } : null;
|
||||
>f : Symbol(f, Decl(aliasUsageInOrExpression_main.ts, 10, 3))
|
||||
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 8))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 41))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
|
||||
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 78))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInOrExpression_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -62,11 +62,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInOrExpression_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 63))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 65))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInOrExpression_main.ts ===
|
||||
import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInOrExpression_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInOrExpression_moduleA");
|
||||
import moduleA = require("./aliasUsageInOrExpression_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -74,7 +74,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInOrExpression_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInTypeArgumentOfExtendsClause_main.ts]
|
||||
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -52,7 +52,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
var moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_main.ts ===
|
||||
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 78))
|
||||
import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 80))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 2, 34))
|
||||
@@ -17,7 +17,7 @@ interface IHasVisualizationModel {
|
||||
class C<T extends IHasVisualizationModel> {
|
||||
>C : Symbol(C, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 4, 1))
|
||||
>T : Symbol(T, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 8))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78))
|
||||
|
||||
x: T;
|
||||
>x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 43))
|
||||
@@ -26,11 +26,11 @@ class C<T extends IHasVisualizationModel> {
|
||||
class D extends C<IHasVisualizationModel> {
|
||||
>D : Symbol(D, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 7, 1))
|
||||
>C : Symbol(C, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 4, 1))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78))
|
||||
|
||||
x = moduleA;
|
||||
>x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 8, 43))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 78))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 80))
|
||||
}
|
||||
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -41,11 +41,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 78))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 80))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_main.ts ===
|
||||
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -41,7 +41,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInVarAssignment_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
import Backbone = require("./aliasUsageInVarAssignment_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInVarAssignment_main.ts]
|
||||
import Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
import moduleA = require("aliasUsageInVarAssignment_moduleA");
|
||||
import Backbone = require("./aliasUsageInVarAssignment_backbone");
|
||||
import moduleA = require("./aliasUsageInVarAssignment_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
var Backbone = require("./aliasUsageInVarAssignment_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInVarAssignment_main.ts ===
|
||||
import Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
import Backbone = require("./aliasUsageInVarAssignment_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInVarAssignment_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 64))
|
||||
import moduleA = require("./aliasUsageInVarAssignment_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 66))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 62))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 64))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 2, 34))
|
||||
@@ -16,11 +16,11 @@ interface IHasVisualizationModel {
|
||||
}
|
||||
var i: IHasVisualizationModel;
|
||||
>i : Symbol(i, Decl(aliasUsageInVarAssignment_main.ts, 5, 3))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 62))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 64))
|
||||
|
||||
var m: typeof moduleA = i;
|
||||
>m : Symbol(m, Decl(aliasUsageInVarAssignment_main.ts, 6, 3))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 64))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 66))
|
||||
>i : Symbol(i, Decl(aliasUsageInVarAssignment_main.ts, 5, 3))
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInVarAssignment_backbone.ts ===
|
||||
@@ -32,11 +32,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
import Backbone = require("./aliasUsageInVarAssignment_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 64))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 66))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInVarAssignment_main.ts ===
|
||||
import Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
import Backbone = require("./aliasUsageInVarAssignment_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInVarAssignment_moduleA");
|
||||
import moduleA = require("./aliasUsageInVarAssignment_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -32,7 +32,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
import Backbone = require("./aliasUsageInVarAssignment_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -9,8 +9,8 @@ export function b(a: any): any { return null; }
|
||||
//// [aliasUsedAsNameValue_2.ts]
|
||||
///<reference path='aliasUsedAsNameValue_0.ts' />
|
||||
///<reference path='aliasUsedAsNameValue_1.ts' />
|
||||
import mod = require("aliasUsedAsNameValue_0");
|
||||
import b = require("aliasUsedAsNameValue_1");
|
||||
import mod = require("./aliasUsedAsNameValue_0");
|
||||
import b = require("./aliasUsedAsNameValue_1");
|
||||
|
||||
export var a = function () {
|
||||
//var x = mod.id; // TODO needed hack that mod is loaded
|
||||
@@ -25,8 +25,8 @@ exports.b = b;
|
||||
//// [aliasUsedAsNameValue_2.js]
|
||||
///<reference path='aliasUsedAsNameValue_0.ts' />
|
||||
///<reference path='aliasUsedAsNameValue_1.ts' />
|
||||
var mod = require("aliasUsedAsNameValue_0");
|
||||
var b = require("aliasUsedAsNameValue_1");
|
||||
var mod = require("./aliasUsedAsNameValue_0");
|
||||
var b = require("./aliasUsedAsNameValue_1");
|
||||
exports.a = function () {
|
||||
//var x = mod.id; // TODO needed hack that mod is loaded
|
||||
b.b(mod);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/compiler/aliasUsedAsNameValue_2.ts ===
|
||||
///<reference path='aliasUsedAsNameValue_0.ts' />
|
||||
///<reference path='aliasUsedAsNameValue_1.ts' />
|
||||
import mod = require("aliasUsedAsNameValue_0");
|
||||
import mod = require("./aliasUsedAsNameValue_0");
|
||||
>mod : Symbol(mod, Decl(aliasUsedAsNameValue_2.ts, 0, 0))
|
||||
|
||||
import b = require("aliasUsedAsNameValue_1");
|
||||
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 47))
|
||||
import b = require("./aliasUsedAsNameValue_1");
|
||||
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 49))
|
||||
|
||||
export var a = function () {
|
||||
>a : Symbol(a, Decl(aliasUsedAsNameValue_2.ts, 5, 10))
|
||||
@@ -13,7 +13,7 @@ export var a = function () {
|
||||
//var x = mod.id; // TODO needed hack that mod is loaded
|
||||
b.b(mod);
|
||||
>b.b : Symbol(b.b, Decl(aliasUsedAsNameValue_1.ts, 0, 0))
|
||||
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 47))
|
||||
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 49))
|
||||
>b : Symbol(b.b, Decl(aliasUsedAsNameValue_1.ts, 0, 0))
|
||||
>mod : Symbol(mod, Decl(aliasUsedAsNameValue_2.ts, 0, 0))
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=== tests/cases/compiler/aliasUsedAsNameValue_2.ts ===
|
||||
///<reference path='aliasUsedAsNameValue_0.ts' />
|
||||
///<reference path='aliasUsedAsNameValue_1.ts' />
|
||||
import mod = require("aliasUsedAsNameValue_0");
|
||||
import mod = require("./aliasUsedAsNameValue_0");
|
||||
>mod : typeof mod
|
||||
|
||||
import b = require("aliasUsedAsNameValue_1");
|
||||
import b = require("./aliasUsedAsNameValue_1");
|
||||
>b : typeof b
|
||||
|
||||
export var a = function () {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts
|
||||
|
||||
|
||||
==== tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts (1 errors) ====
|
||||
import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
|
||||
import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
|
||||
var d = b.q3;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'b'.
|
||||
|
||||
@@ -7,7 +7,7 @@ interface c {
|
||||
export = c;
|
||||
|
||||
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts]
|
||||
import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
|
||||
import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
|
||||
var d = b.q3;
|
||||
|
||||
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.js]
|
||||
|
||||
@@ -9,7 +9,7 @@ export = Car;
|
||||
|
||||
//// [arrayOfExportedClass_1.ts]
|
||||
///<reference path='arrayOfExportedClass_0.ts'/>
|
||||
import Car = require('arrayOfExportedClass_0');
|
||||
import Car = require('./arrayOfExportedClass_0');
|
||||
|
||||
class Road {
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=== tests/cases/compiler/arrayOfExportedClass_1.ts ===
|
||||
///<reference path='arrayOfExportedClass_0.ts'/>
|
||||
import Car = require('arrayOfExportedClass_0');
|
||||
import Car = require('./arrayOfExportedClass_0');
|
||||
>Car : Symbol(Car, Decl(arrayOfExportedClass_1.ts, 0, 0))
|
||||
|
||||
class Road {
|
||||
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47))
|
||||
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49))
|
||||
|
||||
public cars: Car[];
|
||||
>cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12))
|
||||
@@ -17,14 +17,14 @@ class Road {
|
||||
|
||||
this.cars = cars;
|
||||
>this.cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12))
|
||||
>this : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47))
|
||||
>this : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49))
|
||||
>cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12))
|
||||
>cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 7, 19))
|
||||
}
|
||||
}
|
||||
|
||||
export = Road;
|
||||
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47))
|
||||
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49))
|
||||
|
||||
=== tests/cases/compiler/arrayOfExportedClass_0.ts ===
|
||||
class Car {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/arrayOfExportedClass_1.ts ===
|
||||
///<reference path='arrayOfExportedClass_0.ts'/>
|
||||
import Car = require('arrayOfExportedClass_0');
|
||||
import Car = require('./arrayOfExportedClass_0');
|
||||
>Car : typeof Car
|
||||
|
||||
class Road {
|
||||
|
||||
@@ -100,12 +100,12 @@ var p8 = ({ a = 1 }) => { };
|
||||
>1 : number
|
||||
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
|
||||
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
|
||||
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
|
||||
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
|
||||
>a : any
|
||||
>b : number
|
||||
>1 : number
|
||||
>{ b: 1 } : { b: number; }
|
||||
>{ b: 1 } : { b?: number; }
|
||||
>b : number
|
||||
>1 : number
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@ declare var a;
|
||||
(<any>[1,3,]);
|
||||
(<any>"string");
|
||||
(<any>23.0);
|
||||
(<any>1);
|
||||
(<any>1.);
|
||||
(<any>1.0);
|
||||
(<any>12e+34);
|
||||
(<any>0xff);
|
||||
(<any>/regexp/g);
|
||||
(<any>false);
|
||||
(<any>true);
|
||||
@@ -23,6 +28,12 @@ declare var a;
|
||||
declare var A;
|
||||
|
||||
// should keep the parentheses in emit
|
||||
(<any>1).foo;
|
||||
(<any>1.).foo;
|
||||
(<any>1.0).foo;
|
||||
(<any>12e+34).foo;
|
||||
(<any>0xff).foo;
|
||||
(<any>(1.0));
|
||||
(<any>new A).foo;
|
||||
(<any>typeof A).x;
|
||||
(<any>-A).x;
|
||||
@@ -46,6 +57,11 @@ new (<any>A());
|
||||
[1, 3,];
|
||||
"string";
|
||||
23.0;
|
||||
1;
|
||||
1.;
|
||||
1.0;
|
||||
12e+34;
|
||||
0xff;
|
||||
/regexp/g;
|
||||
false;
|
||||
true;
|
||||
@@ -59,6 +75,12 @@ a[0];
|
||||
a.b["0"];
|
||||
a().x;
|
||||
// should keep the parentheses in emit
|
||||
(1).foo;
|
||||
(1.).foo;
|
||||
(1.0).foo;
|
||||
(12e+34).foo;
|
||||
(0xff).foo;
|
||||
(1.0);
|
||||
(new A).foo;
|
||||
(typeof A).x;
|
||||
(-A).x;
|
||||
|
||||
@@ -10,6 +10,11 @@ declare var a;
|
||||
(<any>[1,3,]);
|
||||
(<any>"string");
|
||||
(<any>23.0);
|
||||
(<any>1);
|
||||
(<any>1.);
|
||||
(<any>1.0);
|
||||
(<any>12e+34);
|
||||
(<any>0xff);
|
||||
(<any>/regexp/g);
|
||||
(<any>false);
|
||||
(<any>true);
|
||||
@@ -33,36 +38,42 @@ declare var a;
|
||||
>a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11))
|
||||
|
||||
declare var A;
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
// should keep the parentheses in emit
|
||||
(<any>1).foo;
|
||||
(<any>1.).foo;
|
||||
(<any>1.0).foo;
|
||||
(<any>12e+34).foo;
|
||||
(<any>0xff).foo;
|
||||
(<any>(1.0));
|
||||
(<any>new A).foo;
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
(<any>typeof A).x;
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
(<any>-A).x;
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
new (<any>A());
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
(<Tany>()=> {})();
|
||||
>Tany : Symbol(Tany, Decl(castExpressionParentheses.ts, 28, 2))
|
||||
>Tany : Symbol(Tany, Decl(castExpressionParentheses.ts, 39, 2))
|
||||
|
||||
(<any>function foo() { })();
|
||||
>foo : Symbol(foo, Decl(castExpressionParentheses.ts, 29, 6))
|
||||
>foo : Symbol(foo, Decl(castExpressionParentheses.ts, 40, 6))
|
||||
|
||||
(<any><number><any>-A).x;
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
// nested cast, should keep one pair of parenthese
|
||||
(<any><number>(<any>-A)).x;
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
// nested parenthesized expression, should keep one pair of parenthese
|
||||
(<any>(A))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
|
||||
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,31 @@ declare var a;
|
||||
><any>23.0 : any
|
||||
>23.0 : number
|
||||
|
||||
(<any>1);
|
||||
>(<any>1) : any
|
||||
><any>1 : any
|
||||
>1 : number
|
||||
|
||||
(<any>1.);
|
||||
>(<any>1.) : any
|
||||
><any>1. : any
|
||||
>1. : number
|
||||
|
||||
(<any>1.0);
|
||||
>(<any>1.0) : any
|
||||
><any>1.0 : any
|
||||
>1.0 : number
|
||||
|
||||
(<any>12e+34);
|
||||
>(<any>12e+34) : any
|
||||
><any>12e+34 : any
|
||||
>12e+34 : number
|
||||
|
||||
(<any>0xff);
|
||||
>(<any>0xff) : any
|
||||
><any>0xff : any
|
||||
>0xff : number
|
||||
|
||||
(<any>/regexp/g);
|
||||
>(<any>/regexp/g) : any
|
||||
><any>/regexp/g : any
|
||||
@@ -104,6 +129,47 @@ declare var A;
|
||||
>A : any
|
||||
|
||||
// should keep the parentheses in emit
|
||||
(<any>1).foo;
|
||||
>(<any>1).foo : any
|
||||
>(<any>1) : any
|
||||
><any>1 : any
|
||||
>1 : number
|
||||
>foo : any
|
||||
|
||||
(<any>1.).foo;
|
||||
>(<any>1.).foo : any
|
||||
>(<any>1.) : any
|
||||
><any>1. : any
|
||||
>1. : number
|
||||
>foo : any
|
||||
|
||||
(<any>1.0).foo;
|
||||
>(<any>1.0).foo : any
|
||||
>(<any>1.0) : any
|
||||
><any>1.0 : any
|
||||
>1.0 : number
|
||||
>foo : any
|
||||
|
||||
(<any>12e+34).foo;
|
||||
>(<any>12e+34).foo : any
|
||||
>(<any>12e+34) : any
|
||||
><any>12e+34 : any
|
||||
>12e+34 : number
|
||||
>foo : any
|
||||
|
||||
(<any>0xff).foo;
|
||||
>(<any>0xff).foo : any
|
||||
>(<any>0xff) : any
|
||||
><any>0xff : any
|
||||
>0xff : number
|
||||
>foo : any
|
||||
|
||||
(<any>(1.0));
|
||||
>(<any>(1.0)) : any
|
||||
><any>(1.0) : any
|
||||
>(1.0) : number
|
||||
>1.0 : number
|
||||
|
||||
(<any>new A).foo;
|
||||
>(<any>new A).foo : any
|
||||
>(<any>new A) : any
|
||||
|
||||
@@ -6,7 +6,7 @@ export module m {
|
||||
}
|
||||
|
||||
//// [chainedImportAlias_file1.ts]
|
||||
import x = require('chainedImportAlias_file0');
|
||||
import x = require('./chainedImportAlias_file0');
|
||||
import y = x;
|
||||
y.m.foo();
|
||||
|
||||
@@ -18,6 +18,6 @@ var m;
|
||||
m.foo = foo;
|
||||
})(m = exports.m || (exports.m = {}));
|
||||
//// [chainedImportAlias_file1.js]
|
||||
var x = require('chainedImportAlias_file0');
|
||||
var x = require('./chainedImportAlias_file0');
|
||||
var y = x;
|
||||
y.m.foo();
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
=== tests/cases/compiler/chainedImportAlias_file1.ts ===
|
||||
import x = require('chainedImportAlias_file0');
|
||||
import x = require('./chainedImportAlias_file0');
|
||||
>x : Symbol(x, Decl(chainedImportAlias_file1.ts, 0, 0))
|
||||
|
||||
import y = x;
|
||||
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 47))
|
||||
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 49))
|
||||
>x : Symbol(x, Decl(chainedImportAlias_file0.ts, 0, 0))
|
||||
|
||||
y.m.foo();
|
||||
>y.m.foo : Symbol(x.m.foo, Decl(chainedImportAlias_file0.ts, 0, 17))
|
||||
>y.m : Symbol(x.m, Decl(chainedImportAlias_file0.ts, 0, 0))
|
||||
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 47))
|
||||
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 49))
|
||||
>m : Symbol(x.m, Decl(chainedImportAlias_file0.ts, 0, 0))
|
||||
>foo : Symbol(x.m.foo, Decl(chainedImportAlias_file0.ts, 0, 17))
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/compiler/chainedImportAlias_file1.ts ===
|
||||
import x = require('chainedImportAlias_file0');
|
||||
import x = require('./chainedImportAlias_file0');
|
||||
>x : typeof x
|
||||
|
||||
import y = x;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/classExpressionExtendingAbstractClass.ts(5,9): error TS2653: Non-abstract class expression does not implement inherited abstract member 'foo' from class 'A'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classExpressionExtendingAbstractClass.ts (1 errors) ====
|
||||
abstract class A {
|
||||
abstract foo(): void;
|
||||
}
|
||||
|
||||
var C = class extends A { // no error reported!
|
||||
~~~~~
|
||||
!!! error TS2653: Non-abstract class expression does not implement inherited abstract member 'foo' from class 'A'.
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [classExpressionExtendingAbstractClass.ts]
|
||||
abstract class A {
|
||||
abstract foo(): void;
|
||||
}
|
||||
|
||||
var C = class extends A { // no error reported!
|
||||
};
|
||||
|
||||
|
||||
|
||||
//// [classExpressionExtendingAbstractClass.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return class_1;
|
||||
})(A);
|
||||
@@ -1,7 +1,12 @@
|
||||
//// [tests/cases/compiler/commentOnAmbientClass1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare class C {
|
||||
}
|
||||
|
||||
@@ -15,6 +20,9 @@ declare class E extends C {
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
//// [b.js]
|
||||
///<reference path="a.ts"/>
|
||||
|
||||
@@ -5,13 +5,18 @@ declare class E extends C {
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0))
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare class C {
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0))
|
||||
}
|
||||
|
||||
// Don't keep this comment.
|
||||
declare class D {
|
||||
>D : Symbol(D, Decl(a.ts, 2, 1))
|
||||
>D : Symbol(D, Decl(a.ts, 7, 1))
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,12 @@ declare class E extends C {
|
||||
>C : C
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare class C {
|
||||
>C : C
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
//// [tests/cases/compiler/commentOnAmbientEnum.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare enum C {
|
||||
a,
|
||||
b,
|
||||
@@ -18,6 +23,9 @@ declare enum E {
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
//// [b.js]
|
||||
///<reference path="a.ts"/>
|
||||
|
||||
@@ -4,22 +4,27 @@ declare enum E {
|
||||
>E : Symbol(E, Decl(b.ts, 0, 0))
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare enum C {
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0))
|
||||
|
||||
a,
|
||||
>a : Symbol(C.a, Decl(a.ts, 1, 16))
|
||||
>a : Symbol(C.a, Decl(a.ts, 6, 16))
|
||||
|
||||
b,
|
||||
>b : Symbol(C.b, Decl(a.ts, 2, 6))
|
||||
>b : Symbol(C.b, Decl(a.ts, 7, 6))
|
||||
|
||||
c
|
||||
>c : Symbol(C.c, Decl(a.ts, 3, 6))
|
||||
>c : Symbol(C.c, Decl(a.ts, 8, 6))
|
||||
}
|
||||
|
||||
// Don't keep this comment.
|
||||
declare enum D {
|
||||
>D : Symbol(D, Decl(a.ts, 5, 1))
|
||||
>D : Symbol(D, Decl(a.ts, 10, 1))
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,12 @@ declare enum E {
|
||||
>E : E
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare enum C {
|
||||
>C : C
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
//// [tests/cases/compiler/commentOnAmbientModule.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare module C {
|
||||
function foo();
|
||||
}
|
||||
@@ -20,6 +25,9 @@ declare module E {
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
//// [b.js]
|
||||
///<reference path="a.ts"/>
|
||||
|
||||
@@ -5,28 +5,33 @@ declare module E {
|
||||
|
||||
class foobar extends D.bar {
|
||||
>foobar : Symbol(foobar, Decl(b.ts, 1, 18))
|
||||
>D.bar : Symbol(D.bar, Decl(a.ts, 6, 18))
|
||||
>D : Symbol(D, Decl(a.ts, 3, 1))
|
||||
>bar : Symbol(D.bar, Decl(a.ts, 6, 18))
|
||||
>D.bar : Symbol(D.bar, Decl(a.ts, 11, 18))
|
||||
>D : Symbol(D, Decl(a.ts, 8, 1))
|
||||
>bar : Symbol(D.bar, Decl(a.ts, 11, 18))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(foo, Decl(b.ts, 2, 32))
|
||||
}
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare module C {
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0))
|
||||
|
||||
function foo();
|
||||
>foo : Symbol(foo, Decl(a.ts, 1, 18))
|
||||
>foo : Symbol(foo, Decl(a.ts, 6, 18))
|
||||
}
|
||||
|
||||
// Don't keep this comment.
|
||||
declare module D {
|
||||
>D : Symbol(D, Decl(a.ts, 3, 1))
|
||||
>D : Symbol(D, Decl(a.ts, 8, 1))
|
||||
|
||||
class bar { }
|
||||
>bar : Symbol(bar, Decl(a.ts, 6, 18))
|
||||
>bar : Symbol(bar, Decl(a.ts, 11, 18))
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,12 @@ declare module E {
|
||||
}
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare module C {
|
||||
>C : typeof C
|
||||
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
//// [commentOnAmbientVariable1.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare var v: number;
|
||||
|
||||
// Don't keep this comment.
|
||||
declare var y: number;
|
||||
|
||||
//// [commentOnAmbientVariable1.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
=== tests/cases/compiler/commentOnAmbientVariable1.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare var v: number;
|
||||
>v : Symbol(v, Decl(commentOnAmbientVariable1.ts, 1, 11))
|
||||
>v : Symbol(v, Decl(commentOnAmbientVariable1.ts, 6, 11))
|
||||
|
||||
// Don't keep this comment.
|
||||
declare var y: number;
|
||||
>y : Symbol(y, Decl(commentOnAmbientVariable1.ts, 4, 11))
|
||||
>y : Symbol(y, Decl(commentOnAmbientVariable1.ts, 9, 11))
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
=== tests/cases/compiler/commentOnAmbientVariable1.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare var v: number;
|
||||
>v : number
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
//// [tests/cases/compiler/commentOnAmbientfunction.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare function foo();
|
||||
|
||||
// Don't keep this comment.
|
||||
@@ -12,6 +17,9 @@ declare function bar();
|
||||
declare function foobar(a: typeof foo): typeof bar;
|
||||
|
||||
//// [a.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
//// [b.js]
|
||||
///<reference path="a.ts"/>
|
||||
|
||||
@@ -4,14 +4,19 @@ declare function foobar(a: typeof foo): typeof bar;
|
||||
>foobar : Symbol(foobar, Decl(b.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(b.ts, 1, 24))
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0))
|
||||
>bar : Symbol(bar, Decl(a.ts, 1, 23))
|
||||
>bar : Symbol(bar, Decl(a.ts, 6, 23))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare function foo();
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0))
|
||||
|
||||
// Don't keep this comment.
|
||||
declare function bar();
|
||||
>bar : Symbol(bar, Decl(a.ts, 1, 23))
|
||||
>bar : Symbol(bar, Decl(a.ts, 6, 23))
|
||||
|
||||
|
||||
@@ -7,7 +7,12 @@ declare function foobar(a: typeof foo): typeof bar;
|
||||
>bar : () => any
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=========
|
||||
Keep this pinned comment
|
||||
=========
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
declare function foo();
|
||||
>foo : () => any
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
//// [tests/cases/compiler/commentOnElidedModule1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
module ElidedModule {
|
||||
}
|
||||
|
||||
@@ -15,6 +20,9 @@ module ElidedModule3 {
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
//// [b.js]
|
||||
///<reference path="a.ts"/>
|
||||
|
||||
@@ -4,13 +4,18 @@ module ElidedModule3 {
|
||||
>ElidedModule3 : Symbol(ElidedModule3, Decl(b.ts, 0, 0))
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
module ElidedModule {
|
||||
>ElidedModule : Symbol(ElidedModule, Decl(a.ts, 0, 0))
|
||||
}
|
||||
|
||||
// Don't keep this comment.
|
||||
module ElidedModule2 {
|
||||
>ElidedModule2 : Symbol(ElidedModule2, Decl(a.ts, 2, 1))
|
||||
>ElidedModule2 : Symbol(ElidedModule2, Decl(a.ts, 7, 1))
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,12 @@ module ElidedModule3 {
|
||||
>ElidedModule3 : any
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
module ElidedModule {
|
||||
>ElidedModule : any
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
//// [tests/cases/compiler/commentOnInterface1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
interface I {
|
||||
}
|
||||
|
||||
@@ -15,6 +20,9 @@ interface I3 {
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
//// [b.js]
|
||||
///<reference path='a.ts'/>
|
||||
|
||||
@@ -4,13 +4,18 @@ interface I3 {
|
||||
>I3 : Symbol(I3, Decl(b.ts, 0, 0))
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(a.ts, 0, 0))
|
||||
}
|
||||
|
||||
// Don't keep this comment.
|
||||
interface I2 {
|
||||
>I2 : Symbol(I2, Decl(a.ts, 2, 1))
|
||||
>I2 : Symbol(I2, Decl(a.ts, 7, 1))
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,12 @@ interface I3 {
|
||||
>I3 : I3
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
interface I {
|
||||
>I : I
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
//// [tests/cases/compiler/commentOnSignature1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
function foo(n: number): void;
|
||||
// Don't keep this comment.
|
||||
function foo(s: string): void;
|
||||
@@ -33,14 +38,15 @@ function foo2(a: any): void {
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
function foo(a) {
|
||||
}
|
||||
var c = (function () {
|
||||
/*! keep this pinned comment */
|
||||
function c(a) {
|
||||
}
|
||||
/*! keep this pinned comment */
|
||||
c.prototype.foo = function (a) {
|
||||
};
|
||||
return c;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user