mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into tscJsFiles
This commit is contained in:
+114
-42
@@ -976,8 +976,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;
|
||||
@@ -2318,8 +2318,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;
|
||||
@@ -2406,7 +2406,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
|
||||
@@ -2416,48 +2416,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);
|
||||
}
|
||||
|
||||
@@ -2468,10 +2467,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
|
||||
@@ -3126,7 +3125,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;
|
||||
}
|
||||
@@ -4047,11 +4046,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;
|
||||
}
|
||||
|
||||
@@ -4640,7 +4640,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;
|
||||
@@ -5511,6 +5513,7 @@ namespace ts {
|
||||
regularType.constructSignatures = (<ResolvedType>type).constructSignatures;
|
||||
regularType.stringIndexType = (<ResolvedType>type).stringIndexType;
|
||||
regularType.numberIndexType = (<ResolvedType>type).numberIndexType;
|
||||
(<FreshObjectLiteralType>type).regularType = regularType;
|
||||
}
|
||||
return regularType;
|
||||
}
|
||||
@@ -6613,7 +6616,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
if (isBindingPattern(declaration.name)) {
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name, /*includePatternInType*/ true);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -7009,11 +7012,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);
|
||||
@@ -7045,12 +7050,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 {
|
||||
@@ -7117,6 +7149,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) {
|
||||
@@ -7137,6 +7172,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) {
|
||||
@@ -7163,11 +7217,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) {
|
||||
|
||||
@@ -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." },
|
||||
@@ -428,6 +429,8 @@ namespace ts {
|
||||
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." },
|
||||
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}'." },
|
||||
|
||||
@@ -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
|
||||
@@ -1701,7 +1705,14 @@
|
||||
"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
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
|
||||
+102
-53
@@ -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) {
|
||||
@@ -5166,7 +5176,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
|
||||
emitOnlyPinnedOrTripleSlashComments(node);
|
||||
emitCommentsOnNotEmittedNode(node);
|
||||
}
|
||||
|
||||
function shouldEmitEnumDeclaration(node: EnumDeclaration) {
|
||||
@@ -5288,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);
|
||||
@@ -6089,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 = [];
|
||||
}
|
||||
@@ -6718,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)) {
|
||||
@@ -6985,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) {
|
||||
@@ -7028,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);
|
||||
@@ -7061,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
|
||||
@@ -7078,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
|
||||
@@ -7086,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;
|
||||
@@ -7136,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) {
|
||||
|
||||
+88
-81
@@ -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;
|
||||
@@ -652,9 +643,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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -830,7 +822,8 @@ namespace ts {
|
||||
|
||||
function getOptionsDiagnostics(): Diagnostic[] {
|
||||
let allDiagnostics: Diagnostic[] = [];
|
||||
addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics())
|
||||
addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
|
||||
return sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
|
||||
@@ -938,10 +931,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -963,11 +956,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);
|
||||
@@ -1003,11 +996,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1030,9 +1023,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.File_0_is_not_a_module, 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1043,7 +1050,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1068,7 +1075,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;
|
||||
}
|
||||
|
||||
@@ -1097,7 +1104,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;
|
||||
}
|
||||
}
|
||||
@@ -1110,52 +1117,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;
|
||||
}
|
||||
@@ -1166,24 +1173,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
|
||||
@@ -1212,30 +1219,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);
|
||||
|
||||
+24
-9
@@ -1284,7 +1284,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[];
|
||||
}
|
||||
|
||||
@@ -1359,6 +1359,7 @@ namespace ts {
|
||||
/* @internal */ getSymbolCount(): number;
|
||||
/* @internal */ getTypeCount(): number;
|
||||
|
||||
/* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection;
|
||||
// For testing purposes only.
|
||||
/* @internal */ structureIsReused?: boolean;
|
||||
}
|
||||
@@ -1714,6 +1715,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 */
|
||||
@@ -1811,11 +1813,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 */
|
||||
@@ -1864,8 +1869,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 {
|
||||
@@ -2269,11 +2273,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;
|
||||
@@ -2291,7 +2304,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 {
|
||||
@@ -2322,5 +2335,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[];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -213,27 +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;
|
||||
|
||||
// Type operation
|
||||
public SpaceBeforeBar: Rule;
|
||||
public NoSpaceBeforeBar: Rule;
|
||||
public SpaceAfterBar: Rule;
|
||||
public NoSpaceAfterBar: Rule;
|
||||
public SpaceBeforeAmpersand: Rule;
|
||||
public SpaceAfterAmpersand: Rule;
|
||||
|
||||
constructor() {
|
||||
///
|
||||
@@ -315,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));
|
||||
@@ -348,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" {
|
||||
@@ -384,25 +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));
|
||||
|
||||
// type operation
|
||||
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));
|
||||
this.SpaceBeforeAmpersand = new Rule(RuleDescriptor.create3(SyntaxKind.AmpersandToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterAmpersand = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.AmpersandToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// These rules are higher in priority than user-configurable rules.
|
||||
this.HighPriorityCommonRules =
|
||||
@@ -430,12 +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.SpaceBeforeAmpersand, this.SpaceAfterAmpersand,
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword,
|
||||
this.SpaceBetweenTagAndTemplateString,
|
||||
|
||||
// TypeScript-specific rules
|
||||
this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,
|
||||
@@ -539,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]])
|
||||
|
||||
@@ -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[];
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+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;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -942,7 +945,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
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -14,49 +14,54 @@ function foo2(a: any): void {
|
||||
>a : Symbol(a, Decl(b.ts, 4, 14))
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
function foo(n: number): void;
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30))
|
||||
>n : Symbol(n, Decl(a.ts, 1, 13))
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30))
|
||||
>n : Symbol(n, Decl(a.ts, 6, 13))
|
||||
|
||||
// Don't keep this comment.
|
||||
function foo(s: string): void;
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30))
|
||||
>s : Symbol(s, Decl(a.ts, 3, 13))
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30))
|
||||
>s : Symbol(s, Decl(a.ts, 8, 13))
|
||||
|
||||
function foo(a: any): void {
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30))
|
||||
>a : Symbol(a, Decl(a.ts, 4, 13))
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30))
|
||||
>a : Symbol(a, Decl(a.ts, 9, 13))
|
||||
}
|
||||
|
||||
class c {
|
||||
>c : Symbol(c, Decl(a.ts, 5, 1))
|
||||
>c : Symbol(c, Decl(a.ts, 10, 1))
|
||||
|
||||
// dont keep this comment
|
||||
constructor(a: string);
|
||||
>a : Symbol(a, Decl(a.ts, 9, 16))
|
||||
>a : Symbol(a, Decl(a.ts, 14, 16))
|
||||
|
||||
/*! keep this pinned comment */
|
||||
constructor(a: number);
|
||||
>a : Symbol(a, Decl(a.ts, 11, 16))
|
||||
>a : Symbol(a, Decl(a.ts, 16, 16))
|
||||
|
||||
constructor(a: any) {
|
||||
>a : Symbol(a, Decl(a.ts, 12, 16))
|
||||
>a : Symbol(a, Decl(a.ts, 17, 16))
|
||||
}
|
||||
|
||||
// dont keep this comment
|
||||
foo(a: string);
|
||||
>foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19))
|
||||
>a : Symbol(a, Decl(a.ts, 16, 8))
|
||||
>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19))
|
||||
>a : Symbol(a, Decl(a.ts, 21, 8))
|
||||
|
||||
/*! keep this pinned comment */
|
||||
foo(a: number);
|
||||
>foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19))
|
||||
>a : Symbol(a, Decl(a.ts, 18, 8))
|
||||
>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19))
|
||||
>a : Symbol(a, Decl(a.ts, 23, 8))
|
||||
|
||||
foo(a: any) {
|
||||
>foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19))
|
||||
>a : Symbol(a, Decl(a.ts, 19, 8))
|
||||
>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19))
|
||||
>a : Symbol(a, Decl(a.ts, 24, 8))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,12 @@ function foo2(a: any): void {
|
||||
>a : any
|
||||
}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
/*! Keep this pinned comment */
|
||||
/*!=================
|
||||
Keep this pinned
|
||||
=================
|
||||
*/
|
||||
|
||||
/*! Don't keep this pinned comment */
|
||||
function foo(n: number): void;
|
||||
>foo : { (n: number): void; (s: string): void; }
|
||||
>n : number
|
||||
|
||||
@@ -21,8 +21,8 @@ function h1(_a) {
|
||||
|
||||
//// [declarationEmitDestructuring2.d.ts]
|
||||
declare function f({x, y: [a, b, c, d]}?: {
|
||||
x: number;
|
||||
y: [number, number, number, number];
|
||||
x?: number;
|
||||
y?: [number, number, number, number];
|
||||
}): void;
|
||||
declare function g([a, b, c, d]?: [number, number, number, number]): void;
|
||||
declare function h([a, [b], [[c]], {x, y: [a, b, c], z: {a1, b1}}]: [any, [any], [[any]], {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
tests/cases/compiler/declarationEmitDestructuring4.ts(9,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuring4.ts (1 errors) ====
|
||||
// For an array binding pattern with empty elements,
|
||||
// we will not make any modification and will emit
|
||||
// the similar binding pattern users' have written
|
||||
function baz([]) { }
|
||||
function baz1([] = [1,2,3]) { }
|
||||
function baz2([[]] = [[1,2,3]]) { }
|
||||
|
||||
function baz3({}) { }
|
||||
function baz4({} = { x: 10 }) { }
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuring4.ts ===
|
||||
// For an array binding pattern with empty elements,
|
||||
// we will not make any modification and will emit
|
||||
// the similar binding pattern users' have written
|
||||
function baz([]) { }
|
||||
>baz : Symbol(baz, Decl(declarationEmitDestructuring4.ts, 0, 0))
|
||||
|
||||
function baz1([] = [1,2,3]) { }
|
||||
>baz1 : Symbol(baz1, Decl(declarationEmitDestructuring4.ts, 3, 20))
|
||||
|
||||
function baz2([[]] = [[1,2,3]]) { }
|
||||
>baz2 : Symbol(baz2, Decl(declarationEmitDestructuring4.ts, 4, 31))
|
||||
|
||||
function baz3({}) { }
|
||||
>baz3 : Symbol(baz3, Decl(declarationEmitDestructuring4.ts, 5, 35))
|
||||
|
||||
function baz4({} = { x: 10 }) { }
|
||||
>baz4 : Symbol(baz4, Decl(declarationEmitDestructuring4.ts, 7, 21))
|
||||
>x : Symbol(x, Decl(declarationEmitDestructuring4.ts, 8, 20))
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuring4.ts ===
|
||||
// For an array binding pattern with empty elements,
|
||||
// we will not make any modification and will emit
|
||||
// the similar binding pattern users' have written
|
||||
function baz([]) { }
|
||||
>baz : ([]: any[]) => void
|
||||
|
||||
function baz1([] = [1,2,3]) { }
|
||||
>baz1 : ([]?: number[]) => void
|
||||
>[1,2,3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
function baz2([[]] = [[1,2,3]]) { }
|
||||
>baz2 : ([[]]?: [number[]]) => void
|
||||
>[[1,2,3]] : [number[]]
|
||||
>[1,2,3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
function baz3({}) { }
|
||||
>baz3 : ({}: {}) => void
|
||||
|
||||
function baz4({} = { x: 10 }) { }
|
||||
>baz4 : ({}?: { x: number; }) => void
|
||||
>{ x: 10 } : { x: number; }
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts (3 errors) ====
|
||||
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
|
||||
|
||||
var [x11 = 0, y11 = ""] = [1, "hello"];
|
||||
var [a11, b11, c11] = [];
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
|
||||
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
|
||||
|
||||
var [x13, y13] = [1, "hello"];
|
||||
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts ===
|
||||
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
|
||||
>x10 : Symbol(x10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 5))
|
||||
>y10 : Symbol(y10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 11))
|
||||
>z10 : Symbol(z10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 17))
|
||||
|
||||
var [x11 = 0, y11 = ""] = [1, "hello"];
|
||||
>x11 : Symbol(x11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 5))
|
||||
>y11 : Symbol(y11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 13))
|
||||
|
||||
var [a11, b11, c11] = [];
|
||||
>a11 : Symbol(a11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 5))
|
||||
>b11 : Symbol(b11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 9))
|
||||
>c11 : Symbol(c11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 14))
|
||||
|
||||
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 5))
|
||||
>b2 : Symbol(b2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 10))
|
||||
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 15))
|
||||
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
|
||||
>c2 : Symbol(c2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 20))
|
||||
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 41))
|
||||
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 50))
|
||||
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 83))
|
||||
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
|
||||
|
||||
var [x13, y13] = [1, "hello"];
|
||||
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
|
||||
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
|
||||
|
||||
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
|
||||
>a3 : Symbol(a3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 5))
|
||||
>b3 : Symbol(b3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 8))
|
||||
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
|
||||
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
|
||||
>x : Symbol(x, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 29))
|
||||
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
|
||||
>y : Symbol(y, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 37))
|
||||
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts ===
|
||||
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
|
||||
>x10 : number
|
||||
>y10 : string
|
||||
>z10 : boolean
|
||||
>[1, ["hello", [true]]] : [number, [string, [boolean]]]
|
||||
>1 : number
|
||||
>["hello", [true]] : [string, [boolean]]
|
||||
>"hello" : string
|
||||
>[true] : [boolean]
|
||||
>true : boolean
|
||||
|
||||
var [x11 = 0, y11 = ""] = [1, "hello"];
|
||||
>x11 : number
|
||||
>0 : number
|
||||
>y11 : string
|
||||
>"" : string
|
||||
>[1, "hello"] : [number, string]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
|
||||
var [a11, b11, c11] = [];
|
||||
>a11 : any
|
||||
>b11 : any
|
||||
>c11 : any
|
||||
>[] : undefined[]
|
||||
|
||||
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
|
||||
>a2 : number
|
||||
>b2 : string
|
||||
>x12 : number
|
||||
>y12 : any
|
||||
>c2 : boolean
|
||||
>["abc", { x12: 10, y12: false }] : [string, { x12: number; y12: boolean; }]
|
||||
>"abc" : string
|
||||
>{ x12: 10, y12: false } : { x12: number; y12: boolean; }
|
||||
>x12 : number
|
||||
>10 : number
|
||||
>y12 : boolean
|
||||
>false : boolean
|
||||
>[1, ["hello", { x12: 5, y12: true }]] : [number, [string, { x12: number; y12: boolean; }]]
|
||||
>1 : number
|
||||
>["hello", { x12: 5, y12: true }] : [string, { x12: number; y12: boolean; }]
|
||||
>"hello" : string
|
||||
>{ x12: 5, y12: true } : { x12: number; y12: boolean; }
|
||||
>x12 : number
|
||||
>5 : number
|
||||
>y12 : boolean
|
||||
>true : boolean
|
||||
|
||||
var [x13, y13] = [1, "hello"];
|
||||
>x13 : number
|
||||
>y13 : string
|
||||
>[1, "hello"] : [number, string]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
|
||||
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
|
||||
>a3 : (number | string)[]
|
||||
>b3 : { x: number; y: string; }
|
||||
>[[x13, y13], { x: x13, y: y13 }] : [(number | string)[], { x: number; y: string; }]
|
||||
>[x13, y13] : (number | string)[]
|
||||
>x13 : number
|
||||
>y13 : string
|
||||
>{ x: x13, y: y13 } : { x: number; y: string; }
|
||||
>x : number
|
||||
>x13 : number
|
||||
>y : string
|
||||
>y13 : string
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts (6 errors) ====
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
|
||||
function f15() {
|
||||
var a4 = "hello";
|
||||
var b4 = 1;
|
||||
var c4 = true;
|
||||
return { a4, b4, c4 };
|
||||
}
|
||||
var { a4, b4, c4 } = f15();
|
||||
|
||||
module m {
|
||||
export var { a4, b4, c4 } = f15();
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts ===
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
>x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 11))
|
||||
>y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 17))
|
||||
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 5))
|
||||
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 14))
|
||||
>y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 21))
|
||||
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 5))
|
||||
>x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 14))
|
||||
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 21))
|
||||
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 5))
|
||||
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 9))
|
||||
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 18))
|
||||
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 25))
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
|
||||
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 5))
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
|
||||
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 25))
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
|
||||
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 5))
|
||||
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 18))
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 5))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
|
||||
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 13))
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
|
||||
>x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 5))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
|
||||
>y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 18))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
|
||||
>z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 31))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
|
||||
|
||||
function f15() {
|
||||
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
|
||||
|
||||
var a4 = "hello";
|
||||
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 12, 7))
|
||||
|
||||
var b4 = 1;
|
||||
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 13, 7))
|
||||
|
||||
var c4 = true;
|
||||
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 14, 7))
|
||||
|
||||
return { a4, b4, c4 };
|
||||
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 12))
|
||||
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 16))
|
||||
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 20))
|
||||
}
|
||||
var { a4, b4, c4 } = f15();
|
||||
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 5))
|
||||
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 9))
|
||||
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 13))
|
||||
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
|
||||
|
||||
module m {
|
||||
>m : Symbol(m, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 27))
|
||||
|
||||
export var { a4, b4, c4 } = f15();
|
||||
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 16))
|
||||
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 20))
|
||||
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 24))
|
||||
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts ===
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
>{ x: 5, y: "hello" } : { x: number; y: string; }
|
||||
>x : number
|
||||
>5 : number
|
||||
>y : string
|
||||
>"hello" : string
|
||||
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
>x4 : number
|
||||
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
|
||||
>x4 : number
|
||||
>5 : number
|
||||
>y4 : string
|
||||
>"hello" : string
|
||||
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
>y5 : string
|
||||
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
|
||||
>x5 : number
|
||||
>5 : number
|
||||
>y5 : string
|
||||
>"hello" : string
|
||||
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>x6 : number
|
||||
>y6 : string
|
||||
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
|
||||
>x6 : number
|
||||
>5 : number
|
||||
>y6 : string
|
||||
>"hello" : string
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : any
|
||||
>a1 : number
|
||||
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
|
||||
>x7 : number
|
||||
>5 : number
|
||||
>y7 : string
|
||||
>"hello" : string
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : any
|
||||
>b1 : string
|
||||
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
|
||||
>x8 : number
|
||||
>5 : number
|
||||
>y8 : string
|
||||
>"hello" : string
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : any
|
||||
>a2 : number
|
||||
>y9 : any
|
||||
>b2 : string
|
||||
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
|
||||
>x9 : number
|
||||
>5 : number
|
||||
>y9 : string
|
||||
>"hello" : string
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
>a : any
|
||||
>x11 : number
|
||||
>b : any
|
||||
>a : any
|
||||
>y11 : string
|
||||
>b : any
|
||||
>a : any
|
||||
>z11 : boolean
|
||||
>{ a: 1, b: { a: "hello", b: { a: true } } } : { a: number; b: { a: string; b: { a: boolean; }; }; }
|
||||
>a : number
|
||||
>1 : number
|
||||
>b : { a: string; b: { a: boolean; }; }
|
||||
>{ a: "hello", b: { a: true } } : { a: string; b: { a: boolean; }; }
|
||||
>a : string
|
||||
>"hello" : string
|
||||
>b : { a: boolean; }
|
||||
>{ a: true } : { a: boolean; }
|
||||
>a : boolean
|
||||
>true : boolean
|
||||
|
||||
function f15() {
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
|
||||
var a4 = "hello";
|
||||
>a4 : string
|
||||
>"hello" : string
|
||||
|
||||
var b4 = 1;
|
||||
>b4 : number
|
||||
>1 : number
|
||||
|
||||
var c4 = true;
|
||||
>c4 : boolean
|
||||
>true : boolean
|
||||
|
||||
return { a4, b4, c4 };
|
||||
>{ a4, b4, c4 } : { a4: string; b4: number; c4: boolean; }
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
}
|
||||
var { a4, b4, c4 } = f15();
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
>f15() : { a4: string; b4: number; c4: boolean; }
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
|
||||
module m {
|
||||
>m : typeof m
|
||||
|
||||
export var { a4, b4, c4 } = f15();
|
||||
>a4 : string
|
||||
>b4 : number
|
||||
>c4 : boolean
|
||||
>f15() : { a4: string; b4: number; c4: boolean; }
|
||||
>f15 : () => { a4: string; b4: number; c4: boolean; }
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
|
||||
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts (6 errors) ====
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
@@ -1,42 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts ===
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
>x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 11))
|
||||
>y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 17))
|
||||
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 5))
|
||||
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 14))
|
||||
>y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 21))
|
||||
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 5))
|
||||
>x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 14))
|
||||
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 21))
|
||||
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 5))
|
||||
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 9))
|
||||
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 18))
|
||||
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 25))
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
|
||||
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 5))
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
|
||||
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 25))
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
|
||||
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 5))
|
||||
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 18))
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 5))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
|
||||
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 13))
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts ===
|
||||
|
||||
var { } = { x: 5, y: "hello" };
|
||||
>{ x: 5, y: "hello" } : { x: number; y: string; }
|
||||
>x : number
|
||||
>5 : number
|
||||
>y : string
|
||||
>"hello" : string
|
||||
|
||||
var { x4 } = { x4: 5, y4: "hello" };
|
||||
>x4 : number
|
||||
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
|
||||
>x4 : number
|
||||
>5 : number
|
||||
>y4 : string
|
||||
>"hello" : string
|
||||
|
||||
var { y5 } = { x5: 5, y5: "hello" };
|
||||
>y5 : string
|
||||
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
|
||||
>x5 : number
|
||||
>5 : number
|
||||
>y5 : string
|
||||
>"hello" : string
|
||||
|
||||
var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>x6 : number
|
||||
>y6 : string
|
||||
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
|
||||
>x6 : number
|
||||
>5 : number
|
||||
>y6 : string
|
||||
>"hello" : string
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : any
|
||||
>a1 : number
|
||||
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
|
||||
>x7 : number
|
||||
>5 : number
|
||||
>y7 : string
|
||||
>"hello" : string
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : any
|
||||
>b1 : string
|
||||
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
|
||||
>x8 : number
|
||||
>5 : number
|
||||
>y8 : string
|
||||
>"hello" : string
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : any
|
||||
>a2 : number
|
||||
>y9 : any
|
||||
>b2 : string
|
||||
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
|
||||
>x9 : number
|
||||
>5 : number
|
||||
>y9 : string
|
||||
>"hello" : string
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,17): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,23): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{ [x: number]: undefined; }' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2459: Type '{}' has no property 'a' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2459: Type '{}' has no property 'b' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,11): error TS2459: Type 'undefined[]' has no property 'a' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,14): error TS2459: Type 'undefined[]' has no property 'b' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(106,5): error TS2345: Argument of type '[number, [string, { y: boolean; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
|
||||
@@ -18,15 +27,15 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,6):
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts (13 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts (22 errors) ====
|
||||
function f0() {
|
||||
var [] = [1, "hello"];
|
||||
var [x] = [1, "hello"];
|
||||
var [x, y] = [1, "hello"];
|
||||
var [x, y, z] = [1, "hello"]; // Error
|
||||
var [x, y, z] = [1, "hello"];
|
||||
~
|
||||
!!! error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'.
|
||||
var [,, z] = [0, 1, 2];
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var [,, x] = [0, 1, 2];
|
||||
var x: number;
|
||||
var y: string;
|
||||
}
|
||||
@@ -42,14 +51,26 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
}
|
||||
|
||||
function f2() {
|
||||
var { } = { x: 5, y: "hello" };
|
||||
var { x } = { x: 5, y: "hello" };
|
||||
var { y } = { x: 5, y: "hello" };
|
||||
var { } = { x: 5, y: "hello" }; // Error, no x and y in target
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
|
||||
var { x } = { x: 5, y: "hello" }; // Error, no y in target
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
var { y } = { x: 5, y: "hello" }; // Error, no x in target
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
var { x, y } = { x: 5, y: "hello" };
|
||||
var x: number;
|
||||
var y: string;
|
||||
var { x: a } = { x: 5, y: "hello" };
|
||||
var { y: b } = { x: 5, y: "hello" };
|
||||
var { x: a } = { x: 5, y: "hello" }; // Error, no y in target
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
var { y: b } = { x: 5, y: "hello" }; // Error, no x in target
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
var { x: a, y: b } = { x: 5, y: "hello" };
|
||||
var a: number;
|
||||
var b: string;
|
||||
@@ -85,11 +106,17 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
|
||||
function f8() {
|
||||
var [a, b, c] = []; // Ok, [] is an array
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var [d, e, f] = [1]; // Error, [1] is a tuple
|
||||
~
|
||||
!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~
|
||||
!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
}
|
||||
|
||||
function f9() {
|
||||
@@ -105,9 +132,9 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
function f10() {
|
||||
var { a, b } = {}; // Error
|
||||
~
|
||||
!!! error TS2459: Type '{}' has no property 'a' and no string index signature.
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~
|
||||
!!! error TS2459: Type '{}' has no property 'b' and no string index signature.
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var { a, b } = []; // Error
|
||||
~
|
||||
!!! error TS2459: Type 'undefined[]' has no property 'a' and no string index signature.
|
||||
|
||||
@@ -3,8 +3,8 @@ function f0() {
|
||||
var [] = [1, "hello"];
|
||||
var [x] = [1, "hello"];
|
||||
var [x, y] = [1, "hello"];
|
||||
var [x, y, z] = [1, "hello"]; // Error
|
||||
var [,, z] = [0, 1, 2];
|
||||
var [x, y, z] = [1, "hello"];
|
||||
var [,, x] = [0, 1, 2];
|
||||
var x: number;
|
||||
var y: string;
|
||||
}
|
||||
@@ -20,14 +20,14 @@ function f1() {
|
||||
}
|
||||
|
||||
function f2() {
|
||||
var { } = { x: 5, y: "hello" };
|
||||
var { x } = { x: 5, y: "hello" };
|
||||
var { y } = { x: 5, y: "hello" };
|
||||
var { } = { x: 5, y: "hello" }; // Error, no x and y in target
|
||||
var { x } = { x: 5, y: "hello" }; // Error, no y in target
|
||||
var { y } = { x: 5, y: "hello" }; // Error, no x in target
|
||||
var { x, y } = { x: 5, y: "hello" };
|
||||
var x: number;
|
||||
var y: string;
|
||||
var { x: a } = { x: 5, y: "hello" };
|
||||
var { y: b } = { x: 5, y: "hello" };
|
||||
var { x: a } = { x: 5, y: "hello" }; // Error, no y in target
|
||||
var { y: b } = { x: 5, y: "hello" }; // Error, no x in target
|
||||
var { x: a, y: b } = { x: 5, y: "hello" };
|
||||
var a: number;
|
||||
var b: string;
|
||||
@@ -185,8 +185,8 @@ function f0() {
|
||||
var _a = [1, "hello"];
|
||||
var x = [1, "hello"][0];
|
||||
var _b = [1, "hello"], x = _b[0], y = _b[1];
|
||||
var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2]; // Error
|
||||
var _d = [0, 1, 2], z = _d[2];
|
||||
var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2];
|
||||
var _d = [0, 1, 2], x = _d[2];
|
||||
var x;
|
||||
var y;
|
||||
}
|
||||
@@ -200,14 +200,14 @@ function f1() {
|
||||
var z;
|
||||
}
|
||||
function f2() {
|
||||
var _a = { x: 5, y: "hello" };
|
||||
var x = { x: 5, y: "hello" }.x;
|
||||
var y = { x: 5, y: "hello" }.y;
|
||||
var _a = { x: 5, y: "hello" }; // Error, no x and y in target
|
||||
var x = { x: 5, y: "hello" }.x; // Error, no y in target
|
||||
var y = { x: 5, y: "hello" }.y; // Error, no x in target
|
||||
var _b = { x: 5, y: "hello" }, x = _b.x, y = _b.y;
|
||||
var x;
|
||||
var y;
|
||||
var a = { x: 5, y: "hello" }.x;
|
||||
var b = { x: 5, y: "hello" }.y;
|
||||
var a = { x: 5, y: "hello" }.x; // Error, no y in target
|
||||
var b = { x: 5, y: "hello" }.y; // Error, no x in target
|
||||
var _c = { x: 5, y: "hello" }, a = _c.x, b = _c.y;
|
||||
var a;
|
||||
var b;
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(43,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts (3 errors) ====
|
||||
/* AssignmentPattern:
|
||||
* ObjectAssignmentPattern
|
||||
* ArrayAssignmentPattern
|
||||
* ArrayAssignmentPattern:
|
||||
* [Elision<opt> AssignmentRestElementopt ]
|
||||
* [AssignmentElementList]
|
||||
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
|
||||
* AssignmentElementList:
|
||||
* Elision<opt> AssignmentElement
|
||||
* AssignmentElementList, Elisionopt AssignmentElement
|
||||
* AssignmentElement:
|
||||
* LeftHandSideExpression Initialiseropt
|
||||
* AssignmentPattern Initialiseropt
|
||||
* AssignmentRestElement:
|
||||
* ... LeftHandSideExpression
|
||||
*/
|
||||
|
||||
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
|
||||
// An expression of type S is considered assignable to an assignment target V if one of the following is true
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is the type Any, or
|
||||
|
||||
var [a0, a1]: any = undefined;
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
|
||||
// where N is the numeric index of E in the array assignment pattern, or
|
||||
var [b0, b1, b2] = [2, 3, 4];
|
||||
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
|
||||
|
||||
function foo() {
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
var [b6, b7] = foo();
|
||||
var [...b8] = foo();
|
||||
|
||||
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
|
||||
var temp = [1,2,3]
|
||||
var [c0, c1] = [...temp];
|
||||
var [c2] = [];
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
var [, c7] = [1, 2, 3];
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
var [,,, c9] = [1, 2, 3, 4];
|
||||
var [,,,...c10] = [1, 2, 3, 4, "hello"];
|
||||
var [c11, c12, ...c13] = [1, 2, "string"];
|
||||
var [c14, c15, c16] = [1, 2, "string"];
|
||||
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts ===
|
||||
/* AssignmentPattern:
|
||||
* ObjectAssignmentPattern
|
||||
* ArrayAssignmentPattern
|
||||
* ArrayAssignmentPattern:
|
||||
* [Elision<opt> AssignmentRestElementopt ]
|
||||
* [AssignmentElementList]
|
||||
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
|
||||
* AssignmentElementList:
|
||||
* Elision<opt> AssignmentElement
|
||||
* AssignmentElementList, Elisionopt AssignmentElement
|
||||
* AssignmentElement:
|
||||
* LeftHandSideExpression Initialiseropt
|
||||
* AssignmentPattern Initialiseropt
|
||||
* AssignmentRestElement:
|
||||
* ... LeftHandSideExpression
|
||||
*/
|
||||
|
||||
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
|
||||
// An expression of type S is considered assignable to an assignment target V if one of the following is true
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is the type Any, or
|
||||
|
||||
var [a0, a1]: any = undefined;
|
||||
>a0 : Symbol(a0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 23, 5))
|
||||
>a1 : Symbol(a1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 23, 8))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
>a2 : Symbol(a2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 24, 5))
|
||||
>a3 : Symbol(a3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 24, 16))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
|
||||
// where N is the numeric index of E in the array assignment pattern, or
|
||||
var [b0, b1, b2] = [2, 3, 4];
|
||||
>b0 : Symbol(b0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 5))
|
||||
>b1 : Symbol(b1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 8))
|
||||
>b2 : Symbol(b2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 12))
|
||||
|
||||
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
|
||||
>b3 : Symbol(b3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 5))
|
||||
>b4 : Symbol(b4, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 8))
|
||||
>b5 : Symbol(b5, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 12))
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62))
|
||||
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
var [b6, b7] = foo();
|
||||
>b6 : Symbol(b6, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 36, 5))
|
||||
>b7 : Symbol(b7, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 36, 8))
|
||||
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62))
|
||||
|
||||
var [...b8] = foo();
|
||||
>b8 : Symbol(b8, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 37, 5))
|
||||
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62))
|
||||
|
||||
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
|
||||
var temp = [1,2,3]
|
||||
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 40, 3))
|
||||
|
||||
var [c0, c1] = [...temp];
|
||||
>c0 : Symbol(c0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 41, 5))
|
||||
>c1 : Symbol(c1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 41, 8))
|
||||
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 40, 3))
|
||||
|
||||
var [c2] = [];
|
||||
>c2 : Symbol(c2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 42, 5))
|
||||
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
>c3 : Symbol(c3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 43, 7))
|
||||
>c4 : Symbol(c4, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 43, 17))
|
||||
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
>c5 : Symbol(c5, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 44, 6))
|
||||
>c6 : Symbol(c6, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 44, 10))
|
||||
|
||||
var [, c7] = [1, 2, 3];
|
||||
>c7 : Symbol(c7, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 45, 6))
|
||||
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
>c8 : Symbol(c8, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 46, 8))
|
||||
|
||||
var [,,, c9] = [1, 2, 3, 4];
|
||||
>c9 : Symbol(c9, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 47, 8))
|
||||
|
||||
var [,,,...c10] = [1, 2, 3, 4, "hello"];
|
||||
>c10 : Symbol(c10, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 48, 8))
|
||||
|
||||
var [c11, c12, ...c13] = [1, 2, "string"];
|
||||
>c11 : Symbol(c11, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 5))
|
||||
>c12 : Symbol(c12, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 9))
|
||||
>c13 : Symbol(c13, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 14))
|
||||
|
||||
var [c14, c15, c16] = [1, 2, "string"];
|
||||
>c14 : Symbol(c14, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 5))
|
||||
>c15 : Symbol(c15, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 9))
|
||||
>c16 : Symbol(c16, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 14))
|
||||
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts ===
|
||||
/* AssignmentPattern:
|
||||
* ObjectAssignmentPattern
|
||||
* ArrayAssignmentPattern
|
||||
* ArrayAssignmentPattern:
|
||||
* [Elision<opt> AssignmentRestElementopt ]
|
||||
* [AssignmentElementList]
|
||||
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
|
||||
* AssignmentElementList:
|
||||
* Elision<opt> AssignmentElement
|
||||
* AssignmentElementList, Elisionopt AssignmentElement
|
||||
* AssignmentElement:
|
||||
* LeftHandSideExpression Initialiseropt
|
||||
* AssignmentPattern Initialiseropt
|
||||
* AssignmentRestElement:
|
||||
* ... LeftHandSideExpression
|
||||
*/
|
||||
|
||||
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
|
||||
// An expression of type S is considered assignable to an assignment target V if one of the following is true
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is the type Any, or
|
||||
|
||||
var [a0, a1]: any = undefined;
|
||||
>a0 : any
|
||||
>a1 : any
|
||||
>undefined : undefined
|
||||
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
>a2 : boolean
|
||||
>false : boolean
|
||||
>a3 : number
|
||||
>1 : number
|
||||
>undefined : undefined
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
|
||||
// where N is the numeric index of E in the array assignment pattern, or
|
||||
var [b0, b1, b2] = [2, 3, 4];
|
||||
>b0 : number
|
||||
>b1 : number
|
||||
>b2 : number
|
||||
>[2, 3, 4] : [number, number, number]
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
|
||||
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
|
||||
>b3 : number
|
||||
>b4 : number
|
||||
>b5 : string
|
||||
>[1, 2, "string"] : [number, number, string]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"string" : string
|
||||
|
||||
function foo() {
|
||||
>foo : () => number[]
|
||||
|
||||
return [1, 2, 3];
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
}
|
||||
|
||||
var [b6, b7] = foo();
|
||||
>b6 : number
|
||||
>b7 : number
|
||||
>foo() : number[]
|
||||
>foo : () => number[]
|
||||
|
||||
var [...b8] = foo();
|
||||
>b8 : number[]
|
||||
>foo() : number[]
|
||||
>foo : () => number[]
|
||||
|
||||
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
|
||||
var temp = [1,2,3]
|
||||
>temp : number[]
|
||||
>[1,2,3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var [c0, c1] = [...temp];
|
||||
>c0 : number
|
||||
>c1 : number
|
||||
>[...temp] : number[]
|
||||
>...temp : number
|
||||
>temp : number[]
|
||||
|
||||
var [c2] = [];
|
||||
>c2 : any
|
||||
>[] : undefined[]
|
||||
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
>c3 : any
|
||||
>c4 : any
|
||||
>[[[]], [[[[]]]]] : [[undefined[]], [[[undefined[]]]]]
|
||||
>[[]] : [undefined[]]
|
||||
>[] : undefined[]
|
||||
>[[[[]]]] : [[[undefined[]]]]
|
||||
>[[[]]] : [[undefined[]]]
|
||||
>[[]] : [undefined[]]
|
||||
>[] : undefined[]
|
||||
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
>c5 : string | number
|
||||
>c6 : boolean
|
||||
>[[1], true] : [[number], boolean]
|
||||
>[1] : [number]
|
||||
>1 : number
|
||||
>true : boolean
|
||||
|
||||
var [, c7] = [1, 2, 3];
|
||||
> : undefined
|
||||
>c7 : number
|
||||
>[1, 2, 3] : [number, number, number]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
>c8 : number
|
||||
>[1, 2, 3, 4] : [number, number, number, number]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
|
||||
var [,,, c9] = [1, 2, 3, 4];
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
>c9 : number
|
||||
>[1, 2, 3, 4] : [number, number, number, number]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
|
||||
var [,,,...c10] = [1, 2, 3, 4, "hello"];
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
>c10 : (number | string)[]
|
||||
>[1, 2, 3, 4, "hello"] : (number | string)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
>"hello" : string
|
||||
|
||||
var [c11, c12, ...c13] = [1, 2, "string"];
|
||||
>c11 : number | string
|
||||
>c12 : number | string
|
||||
>c13 : (number | string)[]
|
||||
>[1, 2, "string"] : (number | string)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"string" : string
|
||||
|
||||
var [c14, c15, c16] = [1, 2, "string"];
|
||||
>c14 : number
|
||||
>c15 : number
|
||||
>c16 : string
|
||||
>[1, 2, "string"] : [number, number, string]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"string" : string
|
||||
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(44,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(45,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(45,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts (3 errors) ====
|
||||
|
||||
/* AssignmentPattern:
|
||||
* ObjectAssignmentPattern
|
||||
* ArrayAssignmentPattern
|
||||
* ArrayAssignmentPattern:
|
||||
* [Elision<opt> AssignmentRestElementopt ]
|
||||
* [AssignmentElementList]
|
||||
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
|
||||
* AssignmentElementList:
|
||||
* Elision<opt> AssignmentElement
|
||||
* AssignmentElementList, Elisionopt AssignmentElement
|
||||
* AssignmentElement:
|
||||
* LeftHandSideExpression Initialiseropt
|
||||
* AssignmentPattern Initialiseropt
|
||||
* AssignmentRestElement:
|
||||
* ... LeftHandSideExpression
|
||||
*/
|
||||
|
||||
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
|
||||
// An expression of type S is considered assignable to an assignment target V if one of the following is true
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is the type Any, or
|
||||
|
||||
var [a0, a1]: any = undefined;
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
|
||||
// where N is the numeric index of E in the array assignment pattern, or
|
||||
var [b0, b1, b2] = [2, 3, 4];
|
||||
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
|
||||
|
||||
function foo() {
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
var [b6, b7] = foo();
|
||||
var [...b8] = foo();
|
||||
|
||||
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
|
||||
var temp = [1,2,3]
|
||||
var [c0, c1] = [...temp];
|
||||
var [c2] = [];
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
var [, c7] = [1, 2, 3];
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
var [,,, c9] = [1, 2, 3, 4];
|
||||
var [,,,...c10] = [1, 2, 3, 4, "hello"];
|
||||
var [c11, c12, ...c13] = [1, 2, "string"];
|
||||
var [c14, c15, c16] = [1, 2, "string"];
|
||||
@@ -1,105 +0,0 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts ===
|
||||
|
||||
/* AssignmentPattern:
|
||||
* ObjectAssignmentPattern
|
||||
* ArrayAssignmentPattern
|
||||
* ArrayAssignmentPattern:
|
||||
* [Elision<opt> AssignmentRestElementopt ]
|
||||
* [AssignmentElementList]
|
||||
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
|
||||
* AssignmentElementList:
|
||||
* Elision<opt> AssignmentElement
|
||||
* AssignmentElementList, Elisionopt AssignmentElement
|
||||
* AssignmentElement:
|
||||
* LeftHandSideExpression Initialiseropt
|
||||
* AssignmentPattern Initialiseropt
|
||||
* AssignmentRestElement:
|
||||
* ... LeftHandSideExpression
|
||||
*/
|
||||
|
||||
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
|
||||
// An expression of type S is considered assignable to an assignment target V if one of the following is true
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is the type Any, or
|
||||
|
||||
var [a0, a1]: any = undefined;
|
||||
>a0 : Symbol(a0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 24, 5))
|
||||
>a1 : Symbol(a1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 24, 8))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
>a2 : Symbol(a2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 25, 5))
|
||||
>a3 : Symbol(a3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 25, 16))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
|
||||
// where N is the numeric index of E in the array assignment pattern, or
|
||||
var [b0, b1, b2] = [2, 3, 4];
|
||||
>b0 : Symbol(b0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 5))
|
||||
>b1 : Symbol(b1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 8))
|
||||
>b2 : Symbol(b2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 12))
|
||||
|
||||
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
|
||||
>b3 : Symbol(b3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 5))
|
||||
>b4 : Symbol(b4, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 8))
|
||||
>b5 : Symbol(b5, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 12))
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62))
|
||||
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
var [b6, b7] = foo();
|
||||
>b6 : Symbol(b6, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 37, 5))
|
||||
>b7 : Symbol(b7, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 37, 8))
|
||||
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62))
|
||||
|
||||
var [...b8] = foo();
|
||||
>b8 : Symbol(b8, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 38, 5))
|
||||
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62))
|
||||
|
||||
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
|
||||
var temp = [1,2,3]
|
||||
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 41, 3))
|
||||
|
||||
var [c0, c1] = [...temp];
|
||||
>c0 : Symbol(c0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 42, 5))
|
||||
>c1 : Symbol(c1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 42, 8))
|
||||
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 41, 3))
|
||||
|
||||
var [c2] = [];
|
||||
>c2 : Symbol(c2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 43, 5))
|
||||
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
>c3 : Symbol(c3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 44, 7))
|
||||
>c4 : Symbol(c4, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 44, 17))
|
||||
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
>c5 : Symbol(c5, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 45, 6))
|
||||
>c6 : Symbol(c6, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 45, 10))
|
||||
|
||||
var [, c7] = [1, 2, 3];
|
||||
>c7 : Symbol(c7, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 46, 6))
|
||||
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
>c8 : Symbol(c8, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 47, 8))
|
||||
|
||||
var [,,, c9] = [1, 2, 3, 4];
|
||||
>c9 : Symbol(c9, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 48, 8))
|
||||
|
||||
var [,,,...c10] = [1, 2, 3, 4, "hello"];
|
||||
>c10 : Symbol(c10, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 49, 8))
|
||||
|
||||
var [c11, c12, ...c13] = [1, 2, "string"];
|
||||
>c11 : Symbol(c11, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 5))
|
||||
>c12 : Symbol(c12, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 9))
|
||||
>c13 : Symbol(c13, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 14))
|
||||
|
||||
var [c14, c15, c16] = [1, 2, "string"];
|
||||
>c14 : Symbol(c14, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 5))
|
||||
>c15 : Symbol(c15, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 9))
|
||||
>c16 : Symbol(c16, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 14))
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts ===
|
||||
|
||||
/* AssignmentPattern:
|
||||
* ObjectAssignmentPattern
|
||||
* ArrayAssignmentPattern
|
||||
* ArrayAssignmentPattern:
|
||||
* [Elision<opt> AssignmentRestElementopt ]
|
||||
* [AssignmentElementList]
|
||||
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
|
||||
* AssignmentElementList:
|
||||
* Elision<opt> AssignmentElement
|
||||
* AssignmentElementList, Elisionopt AssignmentElement
|
||||
* AssignmentElement:
|
||||
* LeftHandSideExpression Initialiseropt
|
||||
* AssignmentPattern Initialiseropt
|
||||
* AssignmentRestElement:
|
||||
* ... LeftHandSideExpression
|
||||
*/
|
||||
|
||||
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
|
||||
// An expression of type S is considered assignable to an assignment target V if one of the following is true
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is the type Any, or
|
||||
|
||||
var [a0, a1]: any = undefined;
|
||||
>a0 : any
|
||||
>a1 : any
|
||||
>undefined : undefined
|
||||
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
>a2 : boolean
|
||||
>false : boolean
|
||||
>a3 : number
|
||||
>1 : number
|
||||
>undefined : undefined
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
|
||||
// where N is the numeric index of E in the array assignment pattern, or
|
||||
var [b0, b1, b2] = [2, 3, 4];
|
||||
>b0 : number
|
||||
>b1 : number
|
||||
>b2 : number
|
||||
>[2, 3, 4] : [number, number, number]
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
|
||||
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
|
||||
>b3 : number
|
||||
>b4 : number
|
||||
>b5 : string
|
||||
>[1, 2, "string"] : [number, number, string]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"string" : string
|
||||
|
||||
function foo() {
|
||||
>foo : () => number[]
|
||||
|
||||
return [1, 2, 3];
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
}
|
||||
|
||||
var [b6, b7] = foo();
|
||||
>b6 : number
|
||||
>b7 : number
|
||||
>foo() : number[]
|
||||
>foo : () => number[]
|
||||
|
||||
var [...b8] = foo();
|
||||
>b8 : number[]
|
||||
>foo() : number[]
|
||||
>foo : () => number[]
|
||||
|
||||
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
|
||||
var temp = [1,2,3]
|
||||
>temp : number[]
|
||||
>[1,2,3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var [c0, c1] = [...temp];
|
||||
>c0 : number
|
||||
>c1 : number
|
||||
>[...temp] : number[]
|
||||
>...temp : number
|
||||
>temp : number[]
|
||||
|
||||
var [c2] = [];
|
||||
>c2 : any
|
||||
>[] : undefined[]
|
||||
|
||||
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
|
||||
>c3 : any
|
||||
>c4 : any
|
||||
>[[[]], [[[[]]]]] : [[undefined[]], [[[undefined[]]]]]
|
||||
>[[]] : [undefined[]]
|
||||
>[] : undefined[]
|
||||
>[[[[]]]] : [[[undefined[]]]]
|
||||
>[[[]]] : [[undefined[]]]
|
||||
>[[]] : [undefined[]]
|
||||
>[] : undefined[]
|
||||
|
||||
var [[c5], c6]: [[string|number], boolean] = [[1], true];
|
||||
>c5 : string | number
|
||||
>c6 : boolean
|
||||
>[[1], true] : [[number], boolean]
|
||||
>[1] : [number]
|
||||
>1 : number
|
||||
>true : boolean
|
||||
|
||||
var [, c7] = [1, 2, 3];
|
||||
> : undefined
|
||||
>c7 : number
|
||||
>[1, 2, 3] : [number, number, number]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var [,,, c8] = [1, 2, 3, 4];
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
>c8 : number
|
||||
>[1, 2, 3, 4] : [number, number, number, number]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
|
||||
var [,,, c9] = [1, 2, 3, 4];
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
>c9 : number
|
||||
>[1, 2, 3, 4] : [number, number, number, number]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
|
||||
var [,,,...c10] = [1, 2, 3, 4, "hello"];
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
>c10 : (number | string)[]
|
||||
>[1, 2, 3, 4, "hello"] : (number | string)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>4 : number
|
||||
>"hello" : string
|
||||
|
||||
var [c11, c12, ...c13] = [1, 2, "string"];
|
||||
>c11 : number | string
|
||||
>c12 : number | string
|
||||
>c13 : (number | string)[]
|
||||
>[1, 2, "string"] : (number | string)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"string" : string
|
||||
|
||||
var [c14, c15, c16] = [1, 2, "string"];
|
||||
>c14 : number
|
||||
>c15 : number
|
||||
>c16 : string
|
||||
>[1, 2, "string"] : [number, number, string]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"string" : string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
|
||||
Types of property '1' are incompatible.
|
||||
@@ -18,9 +18,9 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
// S is the type Any, or
|
||||
var [[a0], [[a1]]] = [] // Error
|
||||
~~~~
|
||||
!!! error TS2461: Type 'undefined' is not an array type.
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~~~~~~
|
||||
!!! error TS2461: Type 'undefined' is not an array type.
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
var [[a2], [[a3]]] = undefined // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2461: Type 'undefined' is not an array type.
|
||||
|
||||
@@ -27,7 +27,7 @@ var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
|
||||
>{ b21: "string" } : { b21: string; }
|
||||
>b21 : string
|
||||
>"string" : string
|
||||
>{ b2: { b21: "world" } } : { b2: { b21: string; }; }
|
||||
>{ b2: { b21: "world" } } : { b2?: { b21: string; }; }
|
||||
>b2 : { b21: string; }
|
||||
>{ b21: "world" } : { b21: string; }
|
||||
>b21 : string
|
||||
|
||||
@@ -27,7 +27,7 @@ var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
|
||||
>{ b21: "string" } : { b21: string; }
|
||||
>b21 : string
|
||||
>"string" : string
|
||||
>{ b2: { b21: "world" } } : { b2: { b21: string; }; }
|
||||
>{ b2: { b21: "world" } } : { b2?: { b21: string; }; }
|
||||
>b2 : { b21: string; }
|
||||
>{ b21: "world" } : { b21: string; }
|
||||
>b21 : string
|
||||
|
||||
+15
-3
@@ -3,14 +3,18 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs
|
||||
Type '{ i: number; }' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(3,6): error TS2459: Type 'string | number' has no property 'i' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(4,6): error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2459: Type '{ f212: string; }' has no property 'f21' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,21): error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(6,7): error TS1180: Property destructuring pattern expected.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,5): error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{ d1: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,11): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ d1: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,24): error TS2353: Object literal may only specify known properties, and 'e' does not exist in type '{ d1: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(9,7): error TS1005: ':' expected.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(9,15): error TS1005: ':' expected.
|
||||
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(10,12): error TS1005: ':' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts (9 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts (13 errors) ====
|
||||
// Error
|
||||
var {h?} = { h?: 1 };
|
||||
~
|
||||
@@ -26,11 +30,19 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs
|
||||
!!! error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature.
|
||||
var { f2: {f21} = { f212: "string" } }: any = undefined;
|
||||
~~~
|
||||
!!! error TS2459: Type '{ f212: string; }' has no property 'f21' and no string index signature.
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
~~~~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'.
|
||||
var { ...d1 } = {
|
||||
~~~
|
||||
!!! error TS1180: Property destructuring pattern expected.
|
||||
a: 1, b: 1, d1: 9, e: 10
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{ d1: any; }'.
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ d1: any; }'.
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'e' does not exist in type '{ d1: any; }'.
|
||||
}
|
||||
var {1} = { 1 };
|
||||
~
|
||||
|
||||
@@ -31,7 +31,7 @@ var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
|
||||
>{ b11: "string" } : { b11: string; }
|
||||
>b11 : string
|
||||
>"string" : string
|
||||
>{ b1: { b11: "world" } } : { b1: { b11: string; }; }
|
||||
>{ b1: { b11: "world" } } : { b1?: { b11: string; }; }
|
||||
>b1 : { b11: string; }
|
||||
>{ b11: "world" } : { b11: string; }
|
||||
>b11 : string
|
||||
@@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
>f4 : number
|
||||
>f5 : number
|
||||
> : undefined
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; }
|
||||
>f : [number, number, { f3: number; f5: number; }]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }]
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, any]; }
|
||||
>f : [number, number, { f3: number; f5: number; }, any]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, any]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>{ f3: 4, f5: 0 } : { f3: number; f5: number; }
|
||||
|
||||
@@ -31,7 +31,7 @@ var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
|
||||
>{ b11: "string" } : { b11: string; }
|
||||
>b11 : string
|
||||
>"string" : string
|
||||
>{ b1: { b11: "world" } } : { b1: { b11: string; }; }
|
||||
>{ b1: { b11: "world" } } : { b1?: { b11: string; }; }
|
||||
>b1 : { b11: string; }
|
||||
>{ b11: "world" } : { b11: string; }
|
||||
>b11 : string
|
||||
@@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
>f4 : number
|
||||
>f5 : number
|
||||
> : undefined
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; }
|
||||
>f : [number, number, { f3: number; f5: number; }]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }]
|
||||
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, any]; }
|
||||
>f : [number, number, { f3: number; f5: number; }, any]
|
||||
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, any]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>{ f3: 4, f5: 0 } : { f3: number; f5: number; }
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
//// [destructuringWithLiteralInitializers.ts]
|
||||
// (arg: { x: any, y: any }) => void
|
||||
function f1({ x, y }) { }
|
||||
f1({ x: 1, y: 1 });
|
||||
|
||||
// (arg: { x: any, y?: number }) => void
|
||||
function f2({ x, y = 0 }) { }
|
||||
f2({ x: 1 });
|
||||
f2({ x: 1, y: 1 });
|
||||
|
||||
// (arg: { x?: number, y?: number }) => void
|
||||
function f3({ x = 0, y = 0 }) { }
|
||||
f3({});
|
||||
f3({ x: 1 });
|
||||
f3({ y: 1 });
|
||||
f3({ x: 1, y: 1 });
|
||||
|
||||
// (arg?: { x: number, y: number }) => void
|
||||
function f4({ x, y } = { x: 0, y: 0 }) { }
|
||||
f4();
|
||||
f4({ x: 1, y: 1 });
|
||||
|
||||
// (arg?: { x: number, y?: number }) => void
|
||||
function f5({ x, y = 0 } = { x: 0 }) { }
|
||||
f5();
|
||||
f5({ x: 1 });
|
||||
f5({ x: 1, y: 1 });
|
||||
|
||||
// (arg?: { x?: number, y?: number }) => void
|
||||
function f6({ x = 0, y = 0 } = {}) { }
|
||||
f6();
|
||||
f6({});
|
||||
f6({ x: 1 });
|
||||
f6({ y: 1 });
|
||||
f6({ x: 1, y: 1 });
|
||||
|
||||
// (arg?: { a: { x?: number, y?: number } }) => void
|
||||
function f7({ a: { x = 0, y = 0 } } = { a: {} }) { }
|
||||
f7();
|
||||
f7({ a: {} });
|
||||
f7({ a: { x: 1 } });
|
||||
f7({ a: { y: 1 } });
|
||||
f7({ a: { x: 1, y: 1 } });
|
||||
|
||||
// (arg: [any, any]) => void
|
||||
function g1([x, y]) { }
|
||||
g1([1, 1]);
|
||||
|
||||
// (arg: [number, number]) => void
|
||||
function g2([x = 0, y = 0]) { }
|
||||
g2([1, 1]);
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g3([x, y] = [0, 0]) { }
|
||||
g3();
|
||||
g3([1, 1]);
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g4([x, y = 0] = [0]) { }
|
||||
g4();
|
||||
g4([1, 1]);
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g5([x = 0, y = 0] = []) { }
|
||||
g5();
|
||||
g5([1, 1]);
|
||||
|
||||
|
||||
//// [destructuringWithLiteralInitializers.js]
|
||||
// (arg: { x: any, y: any }) => void
|
||||
function f1(_a) {
|
||||
var x = _a.x, y = _a.y;
|
||||
}
|
||||
f1({ x: 1, y: 1 });
|
||||
// (arg: { x: any, y?: number }) => void
|
||||
function f2(_a) {
|
||||
var x = _a.x, _b = _a.y, y = _b === void 0 ? 0 : _b;
|
||||
}
|
||||
f2({ x: 1 });
|
||||
f2({ x: 1, y: 1 });
|
||||
// (arg: { x?: number, y?: number }) => void
|
||||
function f3(_a) {
|
||||
var _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c;
|
||||
}
|
||||
f3({});
|
||||
f3({ x: 1 });
|
||||
f3({ y: 1 });
|
||||
f3({ x: 1, y: 1 });
|
||||
// (arg?: { x: number, y: number }) => void
|
||||
function f4(_a) {
|
||||
var _b = _a === void 0 ? { x: 0, y: 0 } : _a, x = _b.x, y = _b.y;
|
||||
}
|
||||
f4();
|
||||
f4({ x: 1, y: 1 });
|
||||
// (arg?: { x: number, y?: number }) => void
|
||||
function f5(_a) {
|
||||
var _b = _a === void 0 ? { x: 0 } : _a, x = _b.x, _c = _b.y, y = _c === void 0 ? 0 : _c;
|
||||
}
|
||||
f5();
|
||||
f5({ x: 1 });
|
||||
f5({ x: 1, y: 1 });
|
||||
// (arg?: { x?: number, y?: number }) => void
|
||||
function f6(_a) {
|
||||
var _b = _a === void 0 ? {} : _a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d;
|
||||
}
|
||||
f6();
|
||||
f6({});
|
||||
f6({ x: 1 });
|
||||
f6({ y: 1 });
|
||||
f6({ x: 1, y: 1 });
|
||||
// (arg?: { a: { x?: number, y?: number } }) => void
|
||||
function f7(_a) {
|
||||
var _b = (_a === void 0 ? { a: {} } : _a).a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d;
|
||||
}
|
||||
f7();
|
||||
f7({ a: {} });
|
||||
f7({ a: { x: 1 } });
|
||||
f7({ a: { y: 1 } });
|
||||
f7({ a: { x: 1, y: 1 } });
|
||||
// (arg: [any, any]) => void
|
||||
function g1(_a) {
|
||||
var x = _a[0], y = _a[1];
|
||||
}
|
||||
g1([1, 1]);
|
||||
// (arg: [number, number]) => void
|
||||
function g2(_a) {
|
||||
var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 0 : _c;
|
||||
}
|
||||
g2([1, 1]);
|
||||
// (arg?: [number, number]) => void
|
||||
function g3(_a) {
|
||||
var _b = _a === void 0 ? [0, 0] : _a, x = _b[0], y = _b[1];
|
||||
}
|
||||
g3();
|
||||
g3([1, 1]);
|
||||
// (arg?: [number, number]) => void
|
||||
function g4(_a) {
|
||||
var _b = _a === void 0 ? [0] : _a, x = _b[0], _c = _b[1], y = _c === void 0 ? 0 : _c;
|
||||
}
|
||||
g4();
|
||||
g4([1, 1]);
|
||||
// (arg?: [number, number]) => void
|
||||
function g5(_a) {
|
||||
var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 0 : _d;
|
||||
}
|
||||
g5();
|
||||
g5([1, 1]);
|
||||
@@ -0,0 +1,194 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts ===
|
||||
// (arg: { x: any, y: any }) => void
|
||||
function f1({ x, y }) { }
|
||||
>f1 : Symbol(f1, Decl(destructuringWithLiteralInitializers.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 1, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 1, 16))
|
||||
|
||||
f1({ x: 1, y: 1 });
|
||||
>f1 : Symbol(f1, Decl(destructuringWithLiteralInitializers.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 2, 4))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 2, 10))
|
||||
|
||||
// (arg: { x: any, y?: number }) => void
|
||||
function f2({ x, y = 0 }) { }
|
||||
>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 5, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 5, 16))
|
||||
|
||||
f2({ x: 1 });
|
||||
>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 6, 4))
|
||||
|
||||
f2({ x: 1, y: 1 });
|
||||
>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 7, 4))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 7, 10))
|
||||
|
||||
// (arg: { x?: number, y?: number }) => void
|
||||
function f3({ x = 0, y = 0 }) { }
|
||||
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 10, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 10, 20))
|
||||
|
||||
f3({});
|
||||
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
|
||||
|
||||
f3({ x: 1 });
|
||||
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 12, 4))
|
||||
|
||||
f3({ y: 1 });
|
||||
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 13, 4))
|
||||
|
||||
f3({ x: 1, y: 1 });
|
||||
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 14, 4))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 14, 10))
|
||||
|
||||
// (arg?: { x: number, y: number }) => void
|
||||
function f4({ x, y } = { x: 0, y: 0 }) { }
|
||||
>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 17, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 17, 16))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 17, 24))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 17, 30))
|
||||
|
||||
f4();
|
||||
>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19))
|
||||
|
||||
f4({ x: 1, y: 1 });
|
||||
>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 19, 4))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 19, 10))
|
||||
|
||||
// (arg?: { x: number, y?: number }) => void
|
||||
function f5({ x, y = 0 } = { x: 0 }) { }
|
||||
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 22, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 22, 16))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 22, 28))
|
||||
|
||||
f5();
|
||||
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
|
||||
|
||||
f5({ x: 1 });
|
||||
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 24, 4))
|
||||
|
||||
f5({ x: 1, y: 1 });
|
||||
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 25, 4))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 25, 10))
|
||||
|
||||
// (arg?: { x?: number, y?: number }) => void
|
||||
function f6({ x = 0, y = 0 } = {}) { }
|
||||
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 28, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 28, 20))
|
||||
|
||||
f6();
|
||||
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
|
||||
|
||||
f6({});
|
||||
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
|
||||
|
||||
f6({ x: 1 });
|
||||
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 31, 4))
|
||||
|
||||
f6({ y: 1 });
|
||||
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 32, 4))
|
||||
|
||||
f6({ x: 1, y: 1 });
|
||||
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 33, 4))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 33, 10))
|
||||
|
||||
// (arg?: { a: { x?: number, y?: number } }) => void
|
||||
function f7({ a: { x = 0, y = 0 } } = { a: {} }) { }
|
||||
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
|
||||
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 36, 39))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 36, 18))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 36, 25))
|
||||
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 36, 39))
|
||||
|
||||
f7();
|
||||
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
|
||||
|
||||
f7({ a: {} });
|
||||
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
|
||||
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 38, 4))
|
||||
|
||||
f7({ a: { x: 1 } });
|
||||
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
|
||||
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 39, 4))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 39, 9))
|
||||
|
||||
f7({ a: { y: 1 } });
|
||||
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
|
||||
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 40, 4))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 40, 9))
|
||||
|
||||
f7({ a: { x: 1, y: 1 } });
|
||||
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
|
||||
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 41, 4))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 41, 9))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 41, 15))
|
||||
|
||||
// (arg: [any, any]) => void
|
||||
function g1([x, y]) { }
|
||||
>g1 : Symbol(g1, Decl(destructuringWithLiteralInitializers.ts, 41, 26))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 44, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 44, 15))
|
||||
|
||||
g1([1, 1]);
|
||||
>g1 : Symbol(g1, Decl(destructuringWithLiteralInitializers.ts, 41, 26))
|
||||
|
||||
// (arg: [number, number]) => void
|
||||
function g2([x = 0, y = 0]) { }
|
||||
>g2 : Symbol(g2, Decl(destructuringWithLiteralInitializers.ts, 45, 11))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 48, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 48, 19))
|
||||
|
||||
g2([1, 1]);
|
||||
>g2 : Symbol(g2, Decl(destructuringWithLiteralInitializers.ts, 45, 11))
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g3([x, y] = [0, 0]) { }
|
||||
>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 52, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 52, 15))
|
||||
|
||||
g3();
|
||||
>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11))
|
||||
|
||||
g3([1, 1]);
|
||||
>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11))
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g4([x, y = 0] = [0]) { }
|
||||
>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 57, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 57, 15))
|
||||
|
||||
g4();
|
||||
>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11))
|
||||
|
||||
g4([1, 1]);
|
||||
>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11))
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g5([x = 0, y = 0] = []) { }
|
||||
>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11))
|
||||
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 62, 13))
|
||||
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 62, 19))
|
||||
|
||||
g5();
|
||||
>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11))
|
||||
|
||||
g5([1, 1]);
|
||||
>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11))
|
||||
|
||||
@@ -0,0 +1,310 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts ===
|
||||
// (arg: { x: any, y: any }) => void
|
||||
function f1({ x, y }) { }
|
||||
>f1 : ({ x, y }: { x: any; y: any; }) => void
|
||||
>x : any
|
||||
>y : any
|
||||
|
||||
f1({ x: 1, y: 1 });
|
||||
>f1({ x: 1, y: 1 }) : void
|
||||
>f1 : ({ x, y }: { x: any; y: any; }) => void
|
||||
>{ x: 1, y: 1 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
// (arg: { x: any, y?: number }) => void
|
||||
function f2({ x, y = 0 }) { }
|
||||
>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void
|
||||
>x : any
|
||||
>y : number
|
||||
>0 : number
|
||||
|
||||
f2({ x: 1 });
|
||||
>f2({ x: 1 }) : void
|
||||
>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void
|
||||
>{ x: 1 } : { x: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
f2({ x: 1, y: 1 });
|
||||
>f2({ x: 1, y: 1 }) : void
|
||||
>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void
|
||||
>{ x: 1, y: 1 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
// (arg: { x?: number, y?: number }) => void
|
||||
function f3({ x = 0, y = 0 }) { }
|
||||
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
|
||||
f3({});
|
||||
>f3({}) : void
|
||||
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
|
||||
>{} : {}
|
||||
|
||||
f3({ x: 1 });
|
||||
>f3({ x: 1 }) : void
|
||||
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
|
||||
>{ x: 1 } : { x: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
f3({ y: 1 });
|
||||
>f3({ y: 1 }) : void
|
||||
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
|
||||
>{ y: 1 } : { y: number; }
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
f3({ x: 1, y: 1 });
|
||||
>f3({ x: 1, y: 1 }) : void
|
||||
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
|
||||
>{ x: 1, y: 1 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
// (arg?: { x: number, y: number }) => void
|
||||
function f4({ x, y } = { x: 0, y: 0 }) { }
|
||||
>f4 : ({ x, y }?: { x: number; y: number; }) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
|
||||
f4();
|
||||
>f4() : void
|
||||
>f4 : ({ x, y }?: { x: number; y: number; }) => void
|
||||
|
||||
f4({ x: 1, y: 1 });
|
||||
>f4({ x: 1, y: 1 }) : void
|
||||
>f4 : ({ x, y }?: { x: number; y: number; }) => void
|
||||
>{ x: 1, y: 1 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
// (arg?: { x: number, y?: number }) => void
|
||||
function f5({ x, y = 0 } = { x: 0 }) { }
|
||||
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>0 : number
|
||||
>{ x: 0 } : { x: number; y?: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
|
||||
f5();
|
||||
>f5() : void
|
||||
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
|
||||
|
||||
f5({ x: 1 });
|
||||
>f5({ x: 1 }) : void
|
||||
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
|
||||
>{ x: 1 } : { x: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
f5({ x: 1, y: 1 });
|
||||
>f5({ x: 1, y: 1 }) : void
|
||||
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
|
||||
>{ x: 1, y: 1 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
// (arg?: { x?: number, y?: number }) => void
|
||||
function f6({ x = 0, y = 0 } = {}) { }
|
||||
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
>{} : { x?: number; y?: number; }
|
||||
|
||||
f6();
|
||||
>f6() : void
|
||||
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
|
||||
|
||||
f6({});
|
||||
>f6({}) : void
|
||||
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
|
||||
>{} : {}
|
||||
|
||||
f6({ x: 1 });
|
||||
>f6({ x: 1 }) : void
|
||||
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
|
||||
>{ x: 1 } : { x: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
f6({ y: 1 });
|
||||
>f6({ y: 1 }) : void
|
||||
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
|
||||
>{ y: 1 } : { y: number; }
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
f6({ x: 1, y: 1 });
|
||||
>f6({ x: 1, y: 1 }) : void
|
||||
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
|
||||
>{ x: 1, y: 1 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
// (arg?: { a: { x?: number, y?: number } }) => void
|
||||
function f7({ a: { x = 0, y = 0 } } = { a: {} }) { }
|
||||
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
|
||||
>a : any
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
>{ a: {} } : { a: { x?: number; y?: number; }; }
|
||||
>a : { x?: number; y?: number; }
|
||||
>{} : { x?: number; y?: number; }
|
||||
|
||||
f7();
|
||||
>f7() : void
|
||||
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
|
||||
|
||||
f7({ a: {} });
|
||||
>f7({ a: {} }) : void
|
||||
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
|
||||
>{ a: {} } : { a: {}; }
|
||||
>a : {}
|
||||
>{} : {}
|
||||
|
||||
f7({ a: { x: 1 } });
|
||||
>f7({ a: { x: 1 } }) : void
|
||||
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
|
||||
>{ a: { x: 1 } } : { a: { x: number; }; }
|
||||
>a : { x: number; }
|
||||
>{ x: 1 } : { x: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
f7({ a: { y: 1 } });
|
||||
>f7({ a: { y: 1 } }) : void
|
||||
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
|
||||
>{ a: { y: 1 } } : { a: { y: number; }; }
|
||||
>a : { y: number; }
|
||||
>{ y: 1 } : { y: number; }
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
f7({ a: { x: 1, y: 1 } });
|
||||
>f7({ a: { x: 1, y: 1 } }) : void
|
||||
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
|
||||
>{ a: { x: 1, y: 1 } } : { a: { x: number; y: number; }; }
|
||||
>a : { x: number; y: number; }
|
||||
>{ x: 1, y: 1 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
// (arg: [any, any]) => void
|
||||
function g1([x, y]) { }
|
||||
>g1 : ([x, y]: [any, any]) => void
|
||||
>x : any
|
||||
>y : any
|
||||
|
||||
g1([1, 1]);
|
||||
>g1([1, 1]) : void
|
||||
>g1 : ([x, y]: [any, any]) => void
|
||||
>[1, 1] : [number, number]
|
||||
>1 : number
|
||||
>1 : number
|
||||
|
||||
// (arg: [number, number]) => void
|
||||
function g2([x = 0, y = 0]) { }
|
||||
>g2 : ([x = 0, y = 0]: [number, number]) => void
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
|
||||
g2([1, 1]);
|
||||
>g2([1, 1]) : void
|
||||
>g2 : ([x = 0, y = 0]: [number, number]) => void
|
||||
>[1, 1] : [number, number]
|
||||
>1 : number
|
||||
>1 : number
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g3([x, y] = [0, 0]) { }
|
||||
>g3 : ([x, y]?: [number, number]) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>[0, 0] : [number, number]
|
||||
>0 : number
|
||||
>0 : number
|
||||
|
||||
g3();
|
||||
>g3() : void
|
||||
>g3 : ([x, y]?: [number, number]) => void
|
||||
|
||||
g3([1, 1]);
|
||||
>g3([1, 1]) : void
|
||||
>g3 : ([x, y]?: [number, number]) => void
|
||||
>[1, 1] : [number, number]
|
||||
>1 : number
|
||||
>1 : number
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g4([x, y = 0] = [0]) { }
|
||||
>g4 : ([x, y = 0]?: [number, number]) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>0 : number
|
||||
>[0] : [number, number]
|
||||
>0 : number
|
||||
|
||||
g4();
|
||||
>g4() : void
|
||||
>g4 : ([x, y = 0]?: [number, number]) => void
|
||||
|
||||
g4([1, 1]);
|
||||
>g4([1, 1]) : void
|
||||
>g4 : ([x, y = 0]?: [number, number]) => void
|
||||
>[1, 1] : [number, number]
|
||||
>1 : number
|
||||
>1 : number
|
||||
|
||||
// (arg?: [number, number]) => void
|
||||
function g5([x = 0, y = 0] = []) { }
|
||||
>g5 : ([x = 0, y = 0]?: [number, number]) => void
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
>[] : [number, number]
|
||||
|
||||
g5();
|
||||
>g5() : void
|
||||
>g5 : ([x = 0, y = 0]?: [number, number]) => void
|
||||
|
||||
g5([1, 1]);
|
||||
>g5([1, 1]) : void
|
||||
>g5 : ([x = 0, y = 0]?: [number, number]) => void
|
||||
>[1, 1] : [number, number]
|
||||
>1 : number
|
||||
>1 : number
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//// [doNotEmitDetachedComments.ts]
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
var x = 10;
|
||||
|
||||
// Single Line comment
|
||||
|
||||
function foo() { }
|
||||
|
||||
|
||||
/*
|
||||
multi-line comment
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
function bar() { }
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
//// [doNotEmitDetachedComments.js]
|
||||
var x = 10;
|
||||
function foo() { }
|
||||
function bar() { }
|
||||
@@ -0,0 +1,31 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedComments.ts ===
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(doNotEmitDetachedComments.ts, 6, 3))
|
||||
|
||||
// Single Line comment
|
||||
|
||||
function foo() { }
|
||||
>foo : Symbol(foo, Decl(doNotEmitDetachedComments.ts, 6, 11))
|
||||
|
||||
|
||||
/*
|
||||
multi-line comment
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
function bar() { }
|
||||
>bar : Symbol(bar, Decl(doNotEmitDetachedComments.ts, 10, 18))
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedComments.ts ===
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
// Single Line comment
|
||||
|
||||
function foo() { }
|
||||
>foo : () => void
|
||||
|
||||
|
||||
/*
|
||||
multi-line comment
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
function bar() { }
|
||||
>bar : () => void
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
//// [doNotEmitDetachedCommentsAtStartOfConstructor.ts]
|
||||
class A {
|
||||
constructor() {
|
||||
// Single Line Comment
|
||||
|
||||
var x = 10;
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
constructor() {
|
||||
/*
|
||||
Multi-line comment
|
||||
*/
|
||||
|
||||
var y = 10;
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
constructor() {
|
||||
// Single Line Comment with more than one blank line
|
||||
|
||||
|
||||
var x = 10;
|
||||
}
|
||||
}
|
||||
|
||||
class D {
|
||||
constructor() {
|
||||
/*
|
||||
Multi-line comment with more than one blank line
|
||||
*/
|
||||
|
||||
|
||||
var y = 10;
|
||||
}
|
||||
}
|
||||
|
||||
//// [doNotEmitDetachedCommentsAtStartOfConstructor.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
var x = 10;
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function () {
|
||||
function B() {
|
||||
var y = 10;
|
||||
}
|
||||
return B;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
var x = 10;
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var D = (function () {
|
||||
function D() {
|
||||
var y = 10;
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
@@ -0,0 +1,50 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 0, 0))
|
||||
|
||||
constructor() {
|
||||
// Single Line Comment
|
||||
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 4, 11))
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
>B : Symbol(B, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 6, 1))
|
||||
|
||||
constructor() {
|
||||
/*
|
||||
Multi-line comment
|
||||
*/
|
||||
|
||||
var y = 10;
|
||||
>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 14, 11))
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 16, 1))
|
||||
|
||||
constructor() {
|
||||
// Single Line Comment with more than one blank line
|
||||
|
||||
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 23, 11))
|
||||
}
|
||||
}
|
||||
|
||||
class D {
|
||||
>D : Symbol(D, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 25, 1))
|
||||
|
||||
constructor() {
|
||||
/*
|
||||
Multi-line comment with more than one blank line
|
||||
*/
|
||||
|
||||
|
||||
var y = 10;
|
||||
>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 34, 11))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
constructor() {
|
||||
// Single Line Comment
|
||||
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
>B : B
|
||||
|
||||
constructor() {
|
||||
/*
|
||||
Multi-line comment
|
||||
*/
|
||||
|
||||
var y = 10;
|
||||
>y : number
|
||||
>10 : number
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
constructor() {
|
||||
// Single Line Comment with more than one blank line
|
||||
|
||||
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
}
|
||||
}
|
||||
|
||||
class D {
|
||||
>D : D
|
||||
|
||||
constructor() {
|
||||
/*
|
||||
Multi-line comment with more than one blank line
|
||||
*/
|
||||
|
||||
|
||||
var y = 10;
|
||||
>y : number
|
||||
>10 : number
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.ts]
|
||||
function foo1() {
|
||||
// Single line comment
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
// Single line comment with more than one blank line
|
||||
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
function foo4() {
|
||||
/*
|
||||
|
||||
multi line comment with more than one blank line
|
||||
*/
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.js]
|
||||
function foo1() {
|
||||
return 42;
|
||||
}
|
||||
function foo2() {
|
||||
return 42;
|
||||
}
|
||||
function foo3() {
|
||||
return 42;
|
||||
}
|
||||
function foo4() {
|
||||
return 42;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts ===
|
||||
function foo1() {
|
||||
>foo1 : Symbol(foo1, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 0, 0))
|
||||
|
||||
// Single line comment
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
>foo2 : Symbol(foo2, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 4, 1))
|
||||
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
>foo3 : Symbol(foo3, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 14, 1))
|
||||
|
||||
// Single line comment with more than one blank line
|
||||
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
function foo4() {
|
||||
>foo4 : Symbol(foo4, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 21, 1))
|
||||
|
||||
/*
|
||||
|
||||
multi line comment with more than one blank line
|
||||
*/
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts ===
|
||||
function foo1() {
|
||||
>foo1 : () => number
|
||||
|
||||
// Single line comment
|
||||
|
||||
return 42;
|
||||
>42 : number
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
>foo2 : () => number
|
||||
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
return 42;
|
||||
>42 : number
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
>foo3 : () => number
|
||||
|
||||
// Single line comment with more than one blank line
|
||||
|
||||
|
||||
return 42;
|
||||
>42 : number
|
||||
}
|
||||
|
||||
function foo4() {
|
||||
>foo4 : () => number
|
||||
|
||||
/*
|
||||
|
||||
multi line comment with more than one blank line
|
||||
*/
|
||||
|
||||
return 42;
|
||||
>42 : number
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts]
|
||||
() => {
|
||||
// Single line comment
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
() => {
|
||||
/*
|
||||
multi-line comment
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
() => {
|
||||
// Single line comment with more than one blank line
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
() => {
|
||||
/*
|
||||
multi-line comment with more than one blank line
|
||||
*/
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.js]
|
||||
(function () {
|
||||
return 0;
|
||||
});
|
||||
(function () {
|
||||
return 0;
|
||||
});
|
||||
(function () {
|
||||
return 0;
|
||||
});
|
||||
(function () {
|
||||
return 0;
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts ===
|
||||
() => {
|
||||
No type information for this code. // Single line comment
|
||||
No type information for this code.
|
||||
No type information for this code. return 0;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.() => {
|
||||
No type information for this code. /*
|
||||
No type information for this code. multi-line comment
|
||||
No type information for this code. */
|
||||
No type information for this code.
|
||||
No type information for this code. return 0;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.() => {
|
||||
No type information for this code. // Single line comment with more than one blank line
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
No type information for this code. return 0;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.() => {
|
||||
No type information for this code. /*
|
||||
No type information for this code. multi-line comment with more than one blank line
|
||||
No type information for this code. */
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
No type information for this code. return 0;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,43 @@
|
||||
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts ===
|
||||
() => {
|
||||
>() => { // Single line comment return 0;} : () => number
|
||||
|
||||
// Single line comment
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
() => {
|
||||
>() => { /* multi-line comment */ return 0;} : () => number
|
||||
|
||||
/*
|
||||
multi-line comment
|
||||
*/
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
() => {
|
||||
>() => { // Single line comment with more than one blank line return 0;} : () => number
|
||||
|
||||
// Single line comment with more than one blank line
|
||||
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
() => {
|
||||
>() => { /* multi-line comment with more than one blank line */ return 0;} : () => number
|
||||
|
||||
/*
|
||||
multi-line comment with more than one blank line
|
||||
*/
|
||||
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [doNotEmitPinnedCommentNotOnTopOfFile.ts]
|
||||
var x = 10;
|
||||
|
||||
/*!
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
var x = 10;
|
||||
|
||||
//// [doNotEmitPinnedCommentNotOnTopOfFile.js]
|
||||
var x = 10;
|
||||
var x = 10;
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts ===
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 0, 3), Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 8, 3))
|
||||
|
||||
/*!
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 0, 3), Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 8, 3))
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts ===
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
/*!
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [file1.ts]
|
||||
|
||||
class C {
|
||||
/*! remove pinned comment anywhere else */
|
||||
public foo(x: string, y: any)
|
||||
public foo(x: string, y: number) { }
|
||||
}
|
||||
|
||||
var x = 10;
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
declare var OData: any;
|
||||
|
||||
//// [file1.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function (x, y) { };
|
||||
return C;
|
||||
})();
|
||||
var x = 10;
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(file1.ts, 0, 0))
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
public foo(x: string, y: any)
|
||||
>foo : Symbol(foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33))
|
||||
>x : Symbol(x, Decl(file1.ts, 3, 15))
|
||||
>y : Symbol(y, Decl(file1.ts, 3, 25))
|
||||
|
||||
public foo(x: string, y: number) { }
|
||||
>foo : Symbol(foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33))
|
||||
>x : Symbol(x, Decl(file1.ts, 4, 15))
|
||||
>y : Symbol(y, Decl(file1.ts, 4, 25))
|
||||
}
|
||||
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(file1.ts, 7, 3))
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
declare var OData: any;
|
||||
>OData : Symbol(OData, Decl(file1.ts, 10, 11))
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
public foo(x: string, y: any)
|
||||
>foo : (x: string, y: any) => any
|
||||
>x : string
|
||||
>y : any
|
||||
|
||||
public foo(x: string, y: number) { }
|
||||
>foo : (x: string, y: any) => any
|
||||
>x : string
|
||||
>y : number
|
||||
}
|
||||
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
declare var OData: any;
|
||||
>OData : any
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [doNotEmitPinnedCommentOnNotEmittedNodets.ts]
|
||||
|
||||
class C {
|
||||
/*! remove pinned comment anywhere else */
|
||||
public foo(x: string, y: any)
|
||||
public foo(x: string, y: number) { }
|
||||
}
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
declare var OData: any;
|
||||
|
||||
//// [doNotEmitPinnedCommentOnNotEmittedNodets.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function (x, y) { };
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts ===
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 0, 0))
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
public foo(x: string, y: any)
|
||||
>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33))
|
||||
>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 15))
|
||||
>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 25))
|
||||
|
||||
public foo(x: string, y: number) { }
|
||||
>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33))
|
||||
>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 15))
|
||||
>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 25))
|
||||
}
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
declare var OData: any;
|
||||
>OData : Symbol(OData, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 8, 11))
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts ===
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
public foo(x: string, y: any)
|
||||
>foo : (x: string, y: any) => any
|
||||
>x : string
|
||||
>y : any
|
||||
|
||||
public foo(x: string, y: number) { }
|
||||
>foo : (x: string, y: any) => any
|
||||
>x : string
|
||||
>y : number
|
||||
}
|
||||
|
||||
/*! remove pinned comment anywhere else */
|
||||
declare var OData: any;
|
||||
>OData : any
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//// [doNotEmitPinnedDetachedComments.ts]
|
||||
var x = 10;
|
||||
|
||||
/*! Single Line comment */
|
||||
|
||||
function baz() { }
|
||||
|
||||
|
||||
/*!
|
||||
multi-line comment
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
function bar() {
|
||||
/*!
|
||||
Remove this comment
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
function foo() {
|
||||
/*! Remove this */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
//// [doNotEmitPinnedDetachedComments.js]
|
||||
var x = 10;
|
||||
function baz() { }
|
||||
function bar() {
|
||||
}
|
||||
function foo() {
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
=== tests/cases/compiler/doNotEmitPinnedDetachedComments.ts ===
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(doNotEmitPinnedDetachedComments.ts, 0, 3))
|
||||
|
||||
/*! Single Line comment */
|
||||
|
||||
function baz() { }
|
||||
>baz : Symbol(baz, Decl(doNotEmitPinnedDetachedComments.ts, 0, 11))
|
||||
|
||||
|
||||
/*!
|
||||
multi-line comment
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
function bar() {
|
||||
>bar : Symbol(bar, Decl(doNotEmitPinnedDetachedComments.ts, 4, 18))
|
||||
|
||||
/*!
|
||||
Remove this comment
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(doNotEmitPinnedDetachedComments.ts, 21, 1))
|
||||
|
||||
/*! Remove this */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
=== tests/cases/compiler/doNotEmitPinnedDetachedComments.ts ===
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
/*! Single Line comment */
|
||||
|
||||
function baz() { }
|
||||
>baz : () => void
|
||||
|
||||
|
||||
/*!
|
||||
multi-line comment
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
function bar() {
|
||||
>bar : () => void
|
||||
|
||||
/*!
|
||||
Remove this comment
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : () => number
|
||||
|
||||
/*! Remove this */
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts] ////
|
||||
|
||||
//// [file0.ts]
|
||||
|
||||
|
||||
//// [file1.ts]
|
||||
|
||||
//// [file2.ts]
|
||||
/// <reference path="file0.ts" />
|
||||
/// <reference path="file1.ts" />
|
||||
/// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
|
||||
|
||||
//// [file0.js]
|
||||
//// [file1.js]
|
||||
//// [file2.js]
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/file2.ts ===
|
||||
/// <reference path="file0.ts" />
|
||||
No type information for this code./// <reference path="file1.ts" />
|
||||
No type information for this code./// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
|
||||
No type information for this code.=== tests/cases/compiler/file0.ts ===
|
||||
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/file2.ts ===
|
||||
/// <reference path="file0.ts" />
|
||||
No type information for this code./// <reference path="file1.ts" />
|
||||
No type information for this code./// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
|
||||
No type information for this code.=== tests/cases/compiler/file0.ts ===
|
||||
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
No type information for this code.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user