mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #30 from Microsoft/declarations
Changes to determine when to qualify the symbol in given enclosing declaration
This commit is contained in:
+254
-31
@@ -181,6 +181,10 @@ module ts {
|
||||
return <SourceFile>getAncestor(node, SyntaxKind.SourceFile);
|
||||
}
|
||||
|
||||
function isGlobalSourceFile(node: Node) {
|
||||
return node.kind === SyntaxKind.SourceFile && !(node.flags & NodeFlags.ExternalModule);
|
||||
}
|
||||
|
||||
function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol {
|
||||
if (meaning && hasProperty(symbols, name)) {
|
||||
var symbol = symbols[name];
|
||||
@@ -226,7 +230,7 @@ module ts {
|
||||
|
||||
while (location) {
|
||||
// Locals of a source file are not in scope (because they get merged into the global symbol table)
|
||||
if (location.locals && (location.kind !== SyntaxKind.SourceFile || location.flags & NodeFlags.ExternalModule)) {
|
||||
if (location.locals && !isGlobalSourceFile(location)) {
|
||||
if (result = getSymbol(location.locals, name, meaning)) {
|
||||
return returnResolvedSymbol(result);
|
||||
}
|
||||
@@ -594,14 +598,134 @@ module ts {
|
||||
return (propertySymbol.valueDeclaration.flags & NodeFlags.QuestionMark) && propertySymbol.valueDeclaration.kind !== SyntaxKind.Parameter;
|
||||
}
|
||||
|
||||
function symbolToString(symbol: Symbol) {
|
||||
if (symbol.declarations && symbol.declarations.length > 0) {
|
||||
var declaration = symbol.declarations[0];
|
||||
if (declaration.name) {
|
||||
return identifierToString(declaration.name);
|
||||
function forEachSymbolTableInScope<T>(enclosingDeclaration: Node, callback: (symbolTable: SymbolTable) => T): T {
|
||||
var result: T;
|
||||
for (var location = enclosingDeclaration; location; location = location.parent) {
|
||||
// Locals of a source file are not in scope (because they get merged into the global symbol table)
|
||||
if (location.locals && !isGlobalSourceFile(location)) {
|
||||
if (result = callback(location.locals)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
switch (location.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
if (!(location.flags & NodeFlags.ExternalModule)) {
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if (result = callback(getSymbolOfNode(location).exports)) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
if (result = callback(getSymbolOfNode(location).members)) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return symbol.name;
|
||||
|
||||
return callback(globals);
|
||||
}
|
||||
|
||||
function getAccessibleSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) {
|
||||
function getAccessibleSymbolFromSymbolTable(symbols: SymbolTable) {
|
||||
function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol) {
|
||||
if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) {
|
||||
// If the symbol is equivalent and doesnt need futher qualification, this symbol is accessible
|
||||
if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too
|
||||
var accessibleParent = getAccessibleSymbol(symbolFromSymbolTable.parent, enclosingDeclaration, SymbolFlags.Namespace);
|
||||
return !!accessibleParent;
|
||||
}
|
||||
}
|
||||
|
||||
// If symbol is directly available by its name in the symbol table
|
||||
if (isAccessible(symbols[symbol.name])) {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
// Check if symbol is any of the alias
|
||||
return forEachValue(symbols, symbolFromSymbolTable => {
|
||||
if (symbolFromSymbolTable.flags & SymbolFlags.Import) {
|
||||
if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) {
|
||||
return symbolFromSymbolTable;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (symbol) {
|
||||
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolFromSymbolTable);
|
||||
}
|
||||
}
|
||||
|
||||
function needsQualification(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) {
|
||||
var qualify = false;
|
||||
forEachSymbolTableInScope(enclosingDeclaration, symbolTable => {
|
||||
// If symbol of this name is not available in the symbol table we are ok
|
||||
if (!symbolTable[symbol.name]) {
|
||||
// Continue to the next symbol table
|
||||
return false;
|
||||
}
|
||||
// If the symbol with this name is present it should refer to the symbol
|
||||
var symbolFromSymbolTable = symbolTable[symbol.name];
|
||||
if (symbolFromSymbolTable === symbol) {
|
||||
// No need to qualify
|
||||
return true;
|
||||
}
|
||||
|
||||
// Qualify if the symbol from symbol table has same meaning as expected
|
||||
symbolFromSymbolTable = (symbolFromSymbolTable.flags & SymbolFlags.Import) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable;
|
||||
if (symbolFromSymbolTable.flags & meaning) {
|
||||
qualify = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Continue to the next symbol table
|
||||
return false;
|
||||
});
|
||||
|
||||
return qualify
|
||||
}
|
||||
|
||||
// Enclosing declaration is optional when we dont want to get qualified name in the enclosing declaration scope
|
||||
// Meaning needs to be specified if the enclosing declaration is given
|
||||
function symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) {
|
||||
function getSymbolName(symbol: Symbol) {
|
||||
if (symbol.declarations && symbol.declarations.length > 0) {
|
||||
var declaration = symbol.declarations[0];
|
||||
if (declaration.name) {
|
||||
return identifierToString(declaration.name);
|
||||
}
|
||||
}
|
||||
return symbol.name;
|
||||
}
|
||||
|
||||
// Get qualified name
|
||||
if (enclosingDeclaration &&
|
||||
// Properties/methods/Signatures/Constructors/TypeParameters do not need qualification
|
||||
!(symbol.flags & SymbolFlags.PropertyOrAccessor & SymbolFlags.Signature & SymbolFlags.Constructor & SymbolFlags.Method & SymbolFlags.TypeParameter)) {
|
||||
var symbolName: string;
|
||||
while (symbol) {
|
||||
var isFirstName = !symbolName;
|
||||
var meaningToLook = isFirstName ? meaning : SymbolFlags.Namespace;
|
||||
var accessibleSymbol = getAccessibleSymbol(symbol, enclosingDeclaration, meaningToLook);
|
||||
symbolName = getSymbolName(accessibleSymbol || symbol) + (isFirstName ? "" : ("." + symbolName));
|
||||
if (accessibleSymbol && !needsQualification(accessibleSymbol, enclosingDeclaration, meaningToLook)) {
|
||||
break;
|
||||
}
|
||||
symbol = accessibleSymbol ? accessibleSymbol.parent : symbol.parent;
|
||||
}
|
||||
|
||||
return symbolName;
|
||||
}
|
||||
|
||||
return getSymbolName(symbol);
|
||||
}
|
||||
|
||||
function createSingleLineTextWriter() {
|
||||
@@ -623,7 +747,6 @@ module ts {
|
||||
}
|
||||
|
||||
function writeTypeToTextWriter(type: Type, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter) {
|
||||
// TODO(shkamat): usage of enclosingDeclaration
|
||||
var typeStack: Type[];
|
||||
return writeType(type, /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
|
||||
@@ -635,7 +758,7 @@ module ts {
|
||||
writeTypeReference(<TypeReference>type);
|
||||
}
|
||||
else if (type.flags & (TypeFlags.Class | TypeFlags.Interface | TypeFlags.Enum | TypeFlags.TypeParameter)) {
|
||||
writer.write(symbolToString(type.symbol));
|
||||
writer.write(symbolToString(type.symbol, enclosingDeclaration, SymbolFlags.Type));
|
||||
}
|
||||
else if (type.flags & TypeFlags.Anonymous) {
|
||||
writeAnonymousType(<ObjectType>type, allowFunctionOrConstructorTypeLiteral);
|
||||
@@ -657,7 +780,7 @@ module ts {
|
||||
writer.write("[]");
|
||||
}
|
||||
else {
|
||||
writer.write(symbolToString(type.target.symbol));
|
||||
writer.write(symbolToString(type.target.symbol, enclosingDeclaration, SymbolFlags.Type));
|
||||
writer.write("<");
|
||||
for (var i = 0; i < type.typeArguments.length; i++) {
|
||||
if (i > 0) {
|
||||
@@ -691,7 +814,7 @@ module ts {
|
||||
|
||||
function writeTypeofSymbol(type: ObjectType) {
|
||||
writer.write("typeof ");
|
||||
writer.write(symbolToString(type.symbol));
|
||||
writer.write(symbolToString(type.symbol, enclosingDeclaration, SymbolFlags.Value));
|
||||
}
|
||||
|
||||
function writeLiteralType(type: ObjectType, allowFunctionOrConstructorTypeLiteral: boolean) {
|
||||
@@ -809,6 +932,122 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isDeclarationVisible(node: Declaration): boolean {
|
||||
function getContainingExternalModule(node: Node) {
|
||||
for (; node; node = node.parent) {
|
||||
if (node.kind === SyntaxKind.ModuleDeclaration) {
|
||||
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
else if (node.kind === SyntaxKind.SourceFile) {
|
||||
return (node.flags & NodeFlags.ExternalModule) ? node : undefined;
|
||||
}
|
||||
}
|
||||
Debug.fail("getContainingModule cant reach here");
|
||||
}
|
||||
|
||||
function isUsedInExportAssignment(node: Node) {
|
||||
// Get source File and see if it is external module and has export assigned symbol
|
||||
var externalModule = getContainingExternalModule(node);
|
||||
if (externalModule) {
|
||||
// This is export assigned symbol node
|
||||
var externalModuleSymbol = getSymbolOfNode(externalModule);
|
||||
var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol);
|
||||
var symbolOfNode = getSymbolOfNode(node);
|
||||
if (exportAssignmentSymbol === symbolOfNode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & SymbolFlags.Import)) {
|
||||
// if export assigned symbol is import declaration, resolve the import
|
||||
var resolvedExportSymbol = resolveImport(exportAssignmentSymbol);
|
||||
if (resolvedExportSymbol === symbolOfNode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(shkamat): Chained import assignment
|
||||
// eg. a should be visible too.
|
||||
//module m {
|
||||
// export module c {
|
||||
// export class c {
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//import a = m.c;
|
||||
//import b = a;
|
||||
//export = b;
|
||||
|
||||
// Container of resolvedExportSymbol is visible
|
||||
return forEach(resolvedExportSymbol.declarations, declaration => {
|
||||
while (declaration) {
|
||||
if (declaration === node) {
|
||||
return true;
|
||||
}
|
||||
declaration = declaration.parent;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
// node.parent is variable statement so look at the variable statement's parent
|
||||
return isGlobalSourceFile(node.parent.parent) || isUsedInExportAssignment(node);
|
||||
}
|
||||
// Exported members are visible if parent is visible
|
||||
return isDeclarationVisible(node.parent.parent);
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
// TODO(shkamat): non exported aliases can be visible if they are referenced else where for value/type/namespace
|
||||
return isGlobalSourceFile(node.parent) || isUsedInExportAssignment(node);
|
||||
}
|
||||
// Exported members are visible if parent is visible
|
||||
return isDeclarationVisible(node.parent);
|
||||
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
if (node.flags & NodeFlags.Private) {
|
||||
// Private properties/methods are not visible
|
||||
return false;
|
||||
}
|
||||
// Public properties/methods are visible if its parents are visible, so let it fall into next case statement
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return isDeclarationVisible(node.parent);
|
||||
|
||||
// Source file is always visible
|
||||
case SyntaxKind.SourceFile:
|
||||
return true;
|
||||
|
||||
default:
|
||||
Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + SyntaxKind[node.kind]);
|
||||
}
|
||||
}
|
||||
|
||||
if (node) {
|
||||
var links = getNodeLinks(node);
|
||||
if (links.isVisible === undefined) {
|
||||
links.isVisible = determineIfDeclarationIsVisible();
|
||||
}
|
||||
return links.isVisible;
|
||||
}
|
||||
}
|
||||
|
||||
function getApparentType(type: Type): ApparentType {
|
||||
if (type.flags & TypeFlags.TypeParameter) {
|
||||
do {
|
||||
@@ -4788,7 +5027,7 @@ module ts {
|
||||
checkTypeAssignableTo(checkAndMarkExpression(node.initializer, type), type, node, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
if (!useTypeFromValueDeclaration) {
|
||||
// TypeScript 1.0 spec (April 2014): 5.1
|
||||
@@ -5320,7 +5559,7 @@ module ts {
|
||||
function checkModuleDeclaration(node: ModuleDeclaration) {
|
||||
checkDeclarationModifiers(node);
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
if (node.parent.kind !== SyntaxKind.SourceFile || node.parent.flags & NodeFlags.ExternalModule) {
|
||||
if (!isGlobalSourceFile(node.parent)) {
|
||||
error(node, Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules);
|
||||
}
|
||||
if (isExternalModuleNameRelative(node.name.text)) {
|
||||
@@ -5566,7 +5805,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
while (location) {
|
||||
if (location.locals && (location.kind !== SyntaxKind.SourceFile || location.flags & NodeFlags.ExternalModule)) {
|
||||
if (location.locals && !isGlobalSourceFile(location)) {
|
||||
copySymbols(location.locals, meaning);
|
||||
}
|
||||
switch (location.kind) {
|
||||
@@ -5800,22 +6039,6 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isReferencedInExportAssignment(node: Declaration): boolean {
|
||||
var exportAssignedSymbol = getExportAssignmentSymbol(getSymbolOfNode(getContainerOfModuleElementDeclaration(node)));
|
||||
if (exportAssignedSymbol) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
if (exportAssignedSymbol === symbol) {
|
||||
// This symbol was export assigned symbol
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(shkamat): if export assignment is alias, the alias target would make the node as referenced in export assignment
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isImplementationOfOverload(node: FunctionDeclaration) {
|
||||
if (node.body) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
@@ -5857,7 +6080,7 @@ module ts {
|
||||
getEnumMemberValue: getEnumMemberValue,
|
||||
isTopLevelValueImportedViaEntityName: isTopLevelValueImportedViaEntityName,
|
||||
shouldEmitDeclarations: shouldEmitDeclarations,
|
||||
isReferencedInExportAssignment: isReferencedInExportAssignment,
|
||||
isDeclarationVisible: isDeclarationVisible,
|
||||
isImplementationOfOverload: isImplementationOfOverload,
|
||||
writeTypeAtLocation: writeTypeAtLocation,
|
||||
writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration
|
||||
|
||||
+12
-39
@@ -1898,34 +1898,6 @@ module ts {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function isModuleElementExternallyVisible(node: Declaration) {
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
// Exported member - emit this declaration
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this node is in external module, check if this is export assigned
|
||||
var moduleDeclaration = getContainerOfModuleElementDeclaration(node);
|
||||
if ((moduleDeclaration.flags & NodeFlags.ExternalModule) || // Source file with external module flag
|
||||
// Ambient external module declaration
|
||||
(moduleDeclaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>moduleDeclaration).name.kind === SyntaxKind.StringLiteral)) {
|
||||
return resolver.isReferencedInExportAssignment(node);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function canEmitModuleElementDeclaration(node: Declaration) {
|
||||
if (isModuleElementExternallyVisible(node)) {
|
||||
// Either exported module element or is referenced in export assignment
|
||||
return true;
|
||||
}
|
||||
|
||||
// emit the declaration if this is in global scope source file
|
||||
var moduleDeclaration = getContainerOfModuleElementDeclaration(node);
|
||||
return moduleDeclaration.kind === SyntaxKind.SourceFile && !(moduleDeclaration.flags & NodeFlags.ExternalModule);
|
||||
}
|
||||
|
||||
function emitDeclarationFlags(node: Declaration) {
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
if (node.flags & NodeFlags.Private) {
|
||||
@@ -1952,8 +1924,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitImportDeclaration(node: ImportDeclaration) {
|
||||
// TODO(shkamat): Emit if import decl is used to declare type in this context
|
||||
if (isModuleElementExternallyVisible(node)) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
write("export ");
|
||||
}
|
||||
@@ -1974,7 +1945,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
if (canEmitModuleElementDeclaration(node)) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitDeclarationFlags(node);
|
||||
write("module ");
|
||||
emitSourceTextOfNode(node.name);
|
||||
@@ -1997,7 +1968,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
if (canEmitModuleElementDeclaration(node)) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitDeclarationFlags(node);
|
||||
write("enum ");
|
||||
emitSourceTextOfNode(node.name);
|
||||
@@ -2060,7 +2031,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (canEmitModuleElementDeclaration(node)) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitDeclarationFlags(node);
|
||||
write("class ");
|
||||
emitSourceTextOfNode(node.name);
|
||||
@@ -2084,7 +2055,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
|
||||
if (canEmitModuleElementDeclaration(node)) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitDeclarationFlags(node);
|
||||
write("interface ");
|
||||
emitSourceTextOfNode(node.name);
|
||||
@@ -2111,8 +2082,9 @@ module ts {
|
||||
}
|
||||
|
||||
function emitVariableDeclaration(node: VariableDeclaration) {
|
||||
// If we are emitting property it isnt moduleElement and doesnt need canEmitModuleElement check
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || canEmitModuleElementDeclaration(node)) {
|
||||
// If we are emitting property it isnt moduleElement and hence we already know it needs to be emitted
|
||||
// so there is no check needed to see if declaration is visible
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
|
||||
emitSourceTextOfNode(node.name);
|
||||
// If optional property emit ?
|
||||
if (node.kind === SyntaxKind.Property && (node.flags & NodeFlags.QuestionMark)) {
|
||||
@@ -2126,7 +2098,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
var hasDeclarationWithEmit = forEach(node.declarations, varDeclaration => canEmitModuleElementDeclaration(varDeclaration));
|
||||
var hasDeclarationWithEmit = forEach(node.declarations, varDeclaration => resolver.isDeclarationVisible(varDeclaration));
|
||||
if (hasDeclarationWithEmit) {
|
||||
emitDeclarationFlags(node);
|
||||
write("var ");
|
||||
@@ -2151,8 +2123,9 @@ module ts {
|
||||
}
|
||||
|
||||
function emitFunctionDeclaration(node: FunctionDeclaration) {
|
||||
// If we are emitting Method/Constructor it isnt moduleElement and doesnt need canEmitModuleElement check
|
||||
if ((node.kind !== SyntaxKind.FunctionDeclaration || canEmitModuleElementDeclaration(node)) &&
|
||||
// If we are emitting Method/Constructor it isnt moduleElement and hence already determined to be emitting
|
||||
// so no need to verify if the declaration is visible
|
||||
if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) &&
|
||||
!resolver.isImplementationOfOverload(node)) {
|
||||
emitDeclarationFlags(node);
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration) {
|
||||
|
||||
@@ -273,12 +273,6 @@ module ts {
|
||||
return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & NodeFlags.Rest) !== 0;
|
||||
}
|
||||
|
||||
export function getContainerOfModuleElementDeclaration(node: Declaration) {
|
||||
// If the declaration is var declaration, then the parent is variable statement but we actually want the module
|
||||
var container = node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent : node.parent;
|
||||
return container.kind == SyntaxKind.ModuleBlock ? container.parent : container;
|
||||
}
|
||||
|
||||
enum ParsingContext {
|
||||
SourceElements, // Elements in source file
|
||||
ModuleElements, // Elements in module declaration
|
||||
|
||||
@@ -621,7 +621,7 @@ module ts {
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
shouldEmitDeclarations(): boolean;
|
||||
isReferencedInExportAssignment(node: Declaration): boolean;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
isImplementationOfOverload(node: FunctionDeclaration): boolean;
|
||||
writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void;
|
||||
@@ -740,6 +740,7 @@ module ts {
|
||||
flags?: NodeCheckFlags; // Set of flags specific to Node
|
||||
enumMemberValue?: number; // Constant value of enum member
|
||||
isIllegalTypeReferenceInConstraint?: boolean; // Is type reference in constraint refers to the type parameter from the same list
|
||||
isVisible?: boolean; // Is this node visible
|
||||
}
|
||||
|
||||
export enum TypeFlags {
|
||||
|
||||
@@ -254,7 +254,7 @@ declare module m1 {
|
||||
function foo2Export(a: string): void;
|
||||
function foo3Export(): void;
|
||||
}
|
||||
declare var myvar: c;
|
||||
declare var myvar: m1.m2.c;
|
||||
declare module m2.m3 {
|
||||
class c {
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ declare module "SubModule" {
|
||||
}
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_1.d.ts]
|
||||
/// <reference path='declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts' />
|
||||
export declare var x: c;
|
||||
export declare var x: SubModule.m.m3.c;
|
||||
|
||||
@@ -31,5 +31,21 @@ module.exports = m;
|
||||
|
||||
|
||||
//// [declFileExportAssignmentImportInternalModule.d.ts]
|
||||
declare module m3 {
|
||||
module m2 {
|
||||
interface connectModule {
|
||||
(res: any, req: any, next: any): void;
|
||||
}
|
||||
interface connectExport {
|
||||
use: (mod: connectModule) => connectExport;
|
||||
listen: (port: number) => void;
|
||||
}
|
||||
}
|
||||
var server: {
|
||||
(): m2.connectExport;
|
||||
test1: m2.connectModule;
|
||||
test2(): m2.connectModule;
|
||||
};
|
||||
}
|
||||
import m = m3;
|
||||
export = m;
|
||||
|
||||
@@ -28,4 +28,4 @@ interface Foo<T> {
|
||||
}
|
||||
export = Foo;
|
||||
//// [declFileExportAssignmentOfGenericInterface_1.d.ts]
|
||||
export declare var x: Foo<Foo<string>>;
|
||||
export declare var x: a<a<string>>;
|
||||
|
||||
@@ -74,4 +74,4 @@ export = b;
|
||||
//// [declFileExportImportChain_c.d.ts]
|
||||
export import b1 = require("declFileExportImportChain_b1");
|
||||
//// [declFileExportImportChain_d.d.ts]
|
||||
export declare var x: c1;
|
||||
export declare var x: m1.m2.c1;
|
||||
|
||||
@@ -65,4 +65,4 @@ export = a;
|
||||
//// [declFileExportImportChain2_c.d.ts]
|
||||
export import b = require("declFileExportImportChain2_b");
|
||||
//// [declFileExportImportChain2_d.d.ts]
|
||||
export declare var x: c1;
|
||||
export declare var x: m1.m2.c1;
|
||||
|
||||
@@ -130,16 +130,16 @@ export declare module C {
|
||||
constructor(val: T);
|
||||
}
|
||||
}
|
||||
export declare var a: A<B>;
|
||||
export declare var b: <T>(x: T) => A<B>;
|
||||
export declare var c: <T>(x: T) => A<B>;
|
||||
export declare var d: <T>(x: T) => A<B>[];
|
||||
export declare var e: <T extends A<B>>(x: T) => A<B>[];
|
||||
export declare var x: A<B>;
|
||||
export declare function f<T extends A<B>>(): void;
|
||||
export declare var g: A<B>;
|
||||
export declare class h extends A<B> {
|
||||
export declare var a: C.A<C.B>;
|
||||
export declare var b: <T>(x: T) => C.A<C.B>;
|
||||
export declare var c: <T>(x: T) => C.A<C.B>;
|
||||
export declare var d: <T>(x: T) => C.A<C.B>[];
|
||||
export declare var e: <T extends C.A<C.B>>(x: T) => C.A<C.B>[];
|
||||
export declare var x: C.A<C.B>;
|
||||
export declare function f<T extends C.A<C.B>>(): void;
|
||||
export declare var g: C.A<C.B>;
|
||||
export declare class h extends C.A<C.B> {
|
||||
}
|
||||
export interface i extends A<B> {
|
||||
export interface i extends C.A<C.B> {
|
||||
}
|
||||
export declare var j: <T extends A<B>>(x: T) => T;
|
||||
export declare var j: <T extends C.A<C.B>>(x: T) => T;
|
||||
|
||||
@@ -99,17 +99,17 @@ declare module templa.mvc {
|
||||
declare module templa.mvc.composite {
|
||||
}
|
||||
declare module templa.dom.mvc {
|
||||
interface IElementController<ModelType extends IModel> extends IController<ModelType> {
|
||||
interface IElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.IController<ModelType> {
|
||||
}
|
||||
}
|
||||
declare module templa.dom.mvc {
|
||||
class AbstractElementController<ModelType extends IModel> extends AbstractController<ModelType> implments IElementController<ModelType> {
|
||||
class AbstractElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.AbstractController<ModelType> implments IElementController<ModelType> {
|
||||
constructor();
|
||||
}
|
||||
}
|
||||
declare module templa.dom.mvc.composite {
|
||||
class AbstractCompositeElementController<ModelType extends ICompositeControllerModel> extends AbstractElementController<ModelType> {
|
||||
_controllers: IController<IModel>[];
|
||||
class AbstractCompositeElementController<ModelType extends templa.mvc.composite.ICompositeControllerModel> extends AbstractElementController<ModelType> {
|
||||
_controllers: templa.mvc.IController<templa.mvc.IModel>[];
|
||||
constructor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ declare module m2 {
|
||||
}
|
||||
}
|
||||
declare var m2: {
|
||||
(): connectExport;
|
||||
test1: connectModule;
|
||||
test2(): connectModule;
|
||||
(): m2.connectExport;
|
||||
test1: m2.connectModule;
|
||||
test2(): m2.connectModule;
|
||||
};
|
||||
export = m2;
|
||||
//// [declFileImportModuleWithExportAssignment_1.d.ts]
|
||||
export declare var a: {
|
||||
(): connectExport;
|
||||
test1: connectModule;
|
||||
test2(): connectModule;
|
||||
(): a1.connectExport;
|
||||
test1: a1.connectModule;
|
||||
test2(): a1.connectModule;
|
||||
};
|
||||
|
||||
@@ -27,5 +27,5 @@ declare class List<T> {
|
||||
declare module 'mod1' {
|
||||
}
|
||||
declare module 'moo' {
|
||||
var p: List<Foo>;
|
||||
var p: List<x.Foo>;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ declare module m {
|
||||
}
|
||||
}
|
||||
declare module m1 {
|
||||
var d: c;
|
||||
var d: x;
|
||||
}
|
||||
declare module m2 {
|
||||
export import x = m.c;
|
||||
var d: c;
|
||||
var d: x;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ declare var d: {
|
||||
m: typeof m1;
|
||||
};
|
||||
m2: {
|
||||
c: typeof c;
|
||||
c: typeof m1.c;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -33,6 +33,6 @@ declare module A.C {
|
||||
}
|
||||
}
|
||||
declare module A.B.C {
|
||||
class W implments Z {
|
||||
class W implments A.C.Z {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ declare module m1 {
|
||||
}
|
||||
}
|
||||
declare var a: {
|
||||
c: c;
|
||||
c: m1.c;
|
||||
};
|
||||
declare var b: {
|
||||
c: typeof c;
|
||||
c: typeof m1.c;
|
||||
m1: typeof m1;
|
||||
};
|
||||
declare var c: {
|
||||
@@ -77,10 +77,10 @@ declare var d: {
|
||||
mod: typeof m1;
|
||||
};
|
||||
mc: {
|
||||
cl: typeof c;
|
||||
cl: typeof m1.c;
|
||||
};
|
||||
me: {
|
||||
en: typeof e;
|
||||
en: typeof m1.e;
|
||||
};
|
||||
mh: e;
|
||||
mh: m1.e;
|
||||
};
|
||||
|
||||
+2
-2
@@ -73,12 +73,12 @@ declare module A.B.Base {
|
||||
}
|
||||
}
|
||||
declare module X.Y.base {
|
||||
class W extends W {
|
||||
class W extends A.B.Base.W {
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
declare module X.Y.base.Z {
|
||||
class W<TValue> extends W {
|
||||
class W<TValue> extends base.W {
|
||||
value: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,6 +38,6 @@ declare module X.A.C {
|
||||
}
|
||||
}
|
||||
declare module X.A.B.C {
|
||||
class W implments Z {
|
||||
class W implments X.A.C.Z {
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ declare module X.A.C {
|
||||
}
|
||||
}
|
||||
declare module X.A.B.C {
|
||||
class W implments Z {
|
||||
class W implments A.C.Z {
|
||||
}
|
||||
}
|
||||
declare module X.A.B.C {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ declare module X.A.C {
|
||||
}
|
||||
}
|
||||
declare module X.A.B.C {
|
||||
class W implments Z {
|
||||
class W implments X.A.C.Z {
|
||||
}
|
||||
}
|
||||
declare module X.A.B.C {
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
==== tests/cases/compiler/declarationEmit_nameConflicts_0.ts (1 errors) ====
|
||||
import im = require('declarationEmit_nameConflicts_1');
|
||||
export module M {
|
||||
export function f() { }
|
||||
export class C { }
|
||||
export module N {
|
||||
export function g() { };
|
||||
export interface I { }
|
||||
}
|
||||
|
||||
export import a = M.f;
|
||||
export import b = M.C;
|
||||
export import c = N;
|
||||
export import d = im;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find name 'im'.
|
||||
}
|
||||
|
||||
export module M.P {
|
||||
export function f() { }
|
||||
export class C { }
|
||||
export module N {
|
||||
export function g() { };
|
||||
export interface I { }
|
||||
}
|
||||
export import im = M.P.f;
|
||||
// Bug 887180: Invalid .d.ts when an aliased entity is referenced, and a different entity is closer in scope
|
||||
export var a = M.a; // emitted incorrectly as typeof f
|
||||
export var b = M.b; // ok
|
||||
export var c = M.c; // ok
|
||||
export var g = M.c.g; // ok
|
||||
export var d = M.d; // emitted incorrectly as typeof im
|
||||
}
|
||||
|
||||
export module M.Q {
|
||||
export function f() { }
|
||||
export class C { }
|
||||
export module N {
|
||||
export function g() { };
|
||||
export interface I { }
|
||||
}
|
||||
export interface b extends M.b { } // ok
|
||||
export interface I extends M.c.I { } // ok
|
||||
export module c {
|
||||
export interface I extends M.c.I { } // ok
|
||||
}
|
||||
}
|
||||
==== tests/cases/compiler/declarationEmit_nameConflicts_1.ts (1 errors) ====
|
||||
function f() { }
|
||||
export = f;
|
||||
~~~~~~~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//// [tests/cases/compiler/declarationEmit_nameConflicts.ts] ////
|
||||
|
||||
//// [declarationEmit_nameConflicts_1.ts]
|
||||
function f() { }
|
||||
module f { export class c { } }
|
||||
export = f;
|
||||
|
||||
//// [declarationEmit_nameConflicts_0.ts]
|
||||
@@ -51,10 +51,18 @@ export module M.Q {
|
||||
}
|
||||
|
||||
//// [declarationEmit_nameConflicts_1.js]
|
||||
function f() {
|
||||
}
|
||||
var f;
|
||||
(function (f) {
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
})();
|
||||
f.c = c;
|
||||
})(f || (f = {}));
|
||||
module.exports = f;
|
||||
//// [declarationEmit_nameConflicts_0.js]
|
||||
var im = require('declarationEmit_nameConflicts_1');
|
||||
(function (M) {
|
||||
function f() {
|
||||
}
|
||||
@@ -75,6 +83,7 @@ module.exports = f;
|
||||
M.a = M.f;
|
||||
M.b = M.C;
|
||||
M.c = N;
|
||||
M.d = im;
|
||||
})(exports.M || (exports.M = {}));
|
||||
var M = exports.M;
|
||||
(function (M) {
|
||||
@@ -127,3 +136,60 @@ var M = exports.M;
|
||||
var Q = M.Q;
|
||||
})(exports.M || (exports.M = {}));
|
||||
var M = exports.M;
|
||||
|
||||
|
||||
//// [declarationEmit_nameConflicts_1.d.ts]
|
||||
declare module f {
|
||||
class c {
|
||||
}
|
||||
}
|
||||
export = f;
|
||||
//// [declarationEmit_nameConflicts_0.d.ts]
|
||||
export declare module M {
|
||||
function f(): void;
|
||||
class C {
|
||||
}
|
||||
module N {
|
||||
function g(): void;
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
export import a = M.f;
|
||||
export import b = M.C;
|
||||
export import c = N;
|
||||
export import d = im;
|
||||
}
|
||||
export declare module M.P {
|
||||
function f(): void;
|
||||
class C {
|
||||
}
|
||||
module N {
|
||||
function g(): void;
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
export import im = M.P.f;
|
||||
var a: () => void;
|
||||
var b: typeof M.C;
|
||||
var c: typeof M.N;
|
||||
var g: () => void;
|
||||
var d: typeof M.d;
|
||||
}
|
||||
export declare module M.Q {
|
||||
function f(): void;
|
||||
class C {
|
||||
}
|
||||
module N {
|
||||
function g(): void;
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
interface b extends M.C {
|
||||
}
|
||||
interface I extends M.N.I {
|
||||
}
|
||||
module c {
|
||||
interface I extends M.N.I {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ declare module X.Y.base {
|
||||
}
|
||||
declare module X.Y.base.Z {
|
||||
var f: () => void;
|
||||
var C: typeof C;
|
||||
var M: typeof M;
|
||||
var E: typeof E;
|
||||
var C: typeof base.C;
|
||||
var M: typeof base.M;
|
||||
var E: typeof base.E;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ declare module M.P {
|
||||
enum D {
|
||||
f = 0,
|
||||
}
|
||||
var v: D;
|
||||
var v: M.D;
|
||||
var w: () => void;
|
||||
var x: () => void;
|
||||
var x: () => void;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
==== tests/cases/compiler/declarationEmit_nameConflictsWithAlias.ts (1 errors) ====
|
||||
// Bug 887180
|
||||
export module C { export interface I { } }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
export import v = C;
|
||||
export module M {
|
||||
export module C { export interface I { } }
|
||||
export var w: v.I; // Gets emitted as C.I, which is the wrong interface
|
||||
}
|
||||
@@ -12,3 +12,18 @@ export module M {
|
||||
M.w;
|
||||
})(exports.M || (exports.M = {}));
|
||||
var M = exports.M;
|
||||
|
||||
|
||||
//// [declarationEmit_nameConflictsWithAlias.d.ts]
|
||||
export declare module C {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
export import v = C;
|
||||
export declare module M {
|
||||
module C {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
var w: v.I;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ declare module m2 {
|
||||
}
|
||||
}
|
||||
declare var m2: {
|
||||
(): connectExport;
|
||||
test1: connectModule;
|
||||
test2(): connectModule;
|
||||
(): m2.connectExport;
|
||||
test1: m2.connectModule;
|
||||
test2(): m2.connectModule;
|
||||
};
|
||||
export = m2;
|
||||
|
||||
+3
-3
@@ -34,8 +34,8 @@ declare module m2 {
|
||||
}
|
||||
}
|
||||
declare var m2: {
|
||||
(): connectExport;
|
||||
test1: connectModule;
|
||||
test2(): connectModule;
|
||||
(): m2.connectExport;
|
||||
test1: m2.connectModule;
|
||||
test2(): m2.connectModule;
|
||||
};
|
||||
export = m2;
|
||||
|
||||
+1
-1
@@ -25,6 +25,6 @@ declare module foo {
|
||||
}
|
||||
}
|
||||
declare module bar {
|
||||
class Foo<T> implments IFoo<T> {
|
||||
class Foo<T> implments foo.IFoo<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,4 @@ declare module Foo {
|
||||
class A {
|
||||
}
|
||||
}
|
||||
declare var a: B<A>;
|
||||
declare var a: Foo.B<Foo.A>;
|
||||
|
||||
@@ -28,4 +28,4 @@ export declare class B {
|
||||
}
|
||||
//// [importDeclarationUsedAsTypeQuery_1.d.ts]
|
||||
/// <reference path='importDeclarationUsedAsTypeQuery_require.d.ts' />
|
||||
export declare var x: typeof "tests/cases/compiler/importDeclarationUsedAsTypeQuery_require";
|
||||
export declare var x: typeof a;
|
||||
|
||||
@@ -32,5 +32,5 @@ declare module a {
|
||||
}
|
||||
}
|
||||
declare module c {
|
||||
var x: c;
|
||||
var x: b;
|
||||
}
|
||||
|
||||
@@ -54,4 +54,4 @@ export declare module m2 {
|
||||
var cProp: c;
|
||||
}
|
||||
}
|
||||
export declare var d: c;
|
||||
export declare var d: x.c;
|
||||
|
||||
@@ -36,4 +36,4 @@ export declare module x {
|
||||
}
|
||||
}
|
||||
export import xc = x.c;
|
||||
export declare var cProp: c;
|
||||
export declare var cProp: xc;
|
||||
|
||||
@@ -35,4 +35,4 @@ export declare module x {
|
||||
foo(a: number): number;
|
||||
}
|
||||
}
|
||||
export declare var cProp: c;
|
||||
export declare var cProp: xc;
|
||||
|
||||
@@ -39,5 +39,5 @@ declare module a {
|
||||
}
|
||||
}
|
||||
declare module c {
|
||||
var bVal: weekend;
|
||||
var bVal: b;
|
||||
}
|
||||
|
||||
@@ -40,5 +40,5 @@ export declare module a {
|
||||
}
|
||||
export declare module c {
|
||||
export import b = a.weekend;
|
||||
var bVal: weekend;
|
||||
var bVal: b;
|
||||
}
|
||||
|
||||
@@ -39,5 +39,5 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export declare module c {
|
||||
var bVal: weekend;
|
||||
var bVal: b;
|
||||
}
|
||||
|
||||
@@ -36,4 +36,4 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export import b = a.weekend;
|
||||
export declare var bVal: weekend;
|
||||
export declare var bVal: b;
|
||||
|
||||
@@ -35,4 +35,4 @@ export declare module a {
|
||||
Sunday = 2,
|
||||
}
|
||||
}
|
||||
export declare var bVal: weekend;
|
||||
export declare var bVal: b;
|
||||
|
||||
@@ -39,5 +39,5 @@ declare module a {
|
||||
}
|
||||
}
|
||||
declare module c {
|
||||
var x: c;
|
||||
var x: b.c;
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,5 +42,5 @@ export declare module a {
|
||||
}
|
||||
export declare module c {
|
||||
export import b = a.b;
|
||||
var x: c;
|
||||
var x: b.c;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,5 +39,5 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export declare module c {
|
||||
var x: c;
|
||||
var x: b.c;
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,4 +34,4 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export import b = a.b;
|
||||
export declare var x: c;
|
||||
export declare var x: b.c;
|
||||
|
||||
+1
-1
@@ -35,4 +35,4 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare var x: c;
|
||||
export declare var x: b.c;
|
||||
|
||||
@@ -23,5 +23,5 @@ declare module a {
|
||||
}
|
||||
}
|
||||
declare module c {
|
||||
var x: I;
|
||||
var x: b;
|
||||
}
|
||||
|
||||
@@ -26,5 +26,5 @@ export declare module a {
|
||||
}
|
||||
export declare module c {
|
||||
export import b = a.I;
|
||||
var x: I;
|
||||
var x: b;
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export declare module c {
|
||||
var x: I;
|
||||
var x: b;
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export import b = a.I;
|
||||
export declare var x: I;
|
||||
export declare var x: b;
|
||||
|
||||
+1
-1
@@ -19,4 +19,4 @@ export declare module a {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
export declare var x: I;
|
||||
export declare var x: b;
|
||||
|
||||
@@ -30,5 +30,5 @@ declare module a {
|
||||
}
|
||||
}
|
||||
declare module c {
|
||||
var x: I;
|
||||
var x: b.I;
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,5 +31,5 @@ export declare module a {
|
||||
}
|
||||
export declare module c {
|
||||
export import b = a.b;
|
||||
var x: I;
|
||||
var x: b.I;
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,5 +30,5 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export declare module c {
|
||||
var x: I;
|
||||
var x: b.I;
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,4 +28,4 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
export import b = a.b;
|
||||
export declare var x: I;
|
||||
export declare var x: b.I;
|
||||
|
||||
+1
-1
@@ -25,4 +25,4 @@ export declare module a {
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare var x: I;
|
||||
export declare var x: b.I;
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
declare module "quotedm1" {
|
||||
class v {
|
||||
c: d;
|
||||
c: m4.d;
|
||||
}
|
||||
}
|
||||
declare module "quotedm2" {
|
||||
var c: v;
|
||||
var c: m1.v;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
declare module "quotedm1" {
|
||||
class v {
|
||||
c: d;
|
||||
c: m4.d;
|
||||
}
|
||||
}
|
||||
declare module "quotedm2" {
|
||||
var c: v;
|
||||
var c: m1.v;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
export declare var useGlo_m4_x4: d;
|
||||
export declare var useGlo_m4_d4: typeof d;
|
||||
export declare var useGlo_m4_f4: d;
|
||||
export declare var useGlo_m4_x4: glo_m4.d;
|
||||
export declare var useGlo_m4_d4: typeof glo_m4.d;
|
||||
export declare var useGlo_m4_f4: glo_m4.d;
|
||||
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
export declare var useGlo_m4_x4: d;
|
||||
export declare var useGlo_m4_d4: typeof d;
|
||||
export declare var useGlo_m4_f4: d;
|
||||
export declare var useGlo_m4_x4: glo_m4.d;
|
||||
export declare var useGlo_m4_d4: typeof glo_m4.d;
|
||||
export declare var useGlo_m4_f4: glo_m4.d;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export declare var useFncOnly_m4_f4: d;
|
||||
export declare var useFncOnly_m4_f4: fncOnly_m4.d;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export declare var useFncOnly_m4_f4: d;
|
||||
export declare var useFncOnly_m4_f4: fncOnly_m4.d;
|
||||
|
||||
+9
-9
@@ -1,11 +1,11 @@
|
||||
export declare var x4: d;
|
||||
export declare var d4: typeof d;
|
||||
export declare var f4: d;
|
||||
export declare var x4: m4.d;
|
||||
export declare var d4: typeof m4.d;
|
||||
export declare var f4: m4.d;
|
||||
export declare module m1 {
|
||||
var x2: d;
|
||||
var d2: typeof d;
|
||||
var f2: d;
|
||||
var x2: m4.d;
|
||||
var d2: typeof m4.d;
|
||||
var f2: m4.d;
|
||||
}
|
||||
export declare var useMultiImport_m4_x4: d;
|
||||
export declare var useMultiImport_m4_d4: typeof d;
|
||||
export declare var useMultiImport_m4_f4: d;
|
||||
export declare var useMultiImport_m4_x4: m4.d;
|
||||
export declare var useMultiImport_m4_d4: typeof m4.d;
|
||||
export declare var useMultiImport_m4_f4: m4.d;
|
||||
|
||||
+9
-9
@@ -1,11 +1,11 @@
|
||||
export declare var x4: d;
|
||||
export declare var d4: typeof d;
|
||||
export declare var f4: d;
|
||||
export declare var x4: m4.d;
|
||||
export declare var d4: typeof m4.d;
|
||||
export declare var f4: m4.d;
|
||||
export declare module m1 {
|
||||
var x2: d;
|
||||
var d2: typeof d;
|
||||
var f2: d;
|
||||
var x2: m4.d;
|
||||
var d2: typeof m4.d;
|
||||
var f2: m4.d;
|
||||
}
|
||||
export declare var useMultiImport_m4_x4: d;
|
||||
export declare var useMultiImport_m4_d4: typeof d;
|
||||
export declare var useMultiImport_m4_f4: d;
|
||||
export declare var useMultiImport_m4_x4: m4.d;
|
||||
export declare var useMultiImport_m4_d4: typeof m4.d;
|
||||
export declare var useMultiImport_m4_f4: m4.d;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export declare function foo2(): d;
|
||||
export declare function foo2(): m4.d;
|
||||
|
||||
Vendored
+7
-7
@@ -1,9 +1,9 @@
|
||||
export declare var x4: d;
|
||||
export declare var d4: typeof d;
|
||||
export declare var f4: d;
|
||||
export declare var x4: m4.d;
|
||||
export declare var d4: typeof m4.d;
|
||||
export declare var f4: m4.d;
|
||||
export declare module m1 {
|
||||
var x2: d;
|
||||
var d2: typeof d;
|
||||
var f2: d;
|
||||
var x2: m4.d;
|
||||
var d2: typeof m4.d;
|
||||
var f2: m4.d;
|
||||
}
|
||||
export declare var d: d;
|
||||
export declare var d: m4.d;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export declare function foo2(): d;
|
||||
export declare function foo2(): m4.d;
|
||||
|
||||
Vendored
+7
-7
@@ -1,9 +1,9 @@
|
||||
export declare var x4: d;
|
||||
export declare var d4: typeof d;
|
||||
export declare var f4: d;
|
||||
export declare var x4: m4.d;
|
||||
export declare var d4: typeof m4.d;
|
||||
export declare var f4: m4.d;
|
||||
export declare module m1 {
|
||||
var x2: d;
|
||||
var d2: typeof d;
|
||||
var f2: d;
|
||||
var x2: m4.d;
|
||||
var d2: typeof m4.d;
|
||||
var f2: m4.d;
|
||||
}
|
||||
export declare var d: d;
|
||||
export declare var d: m4.d;
|
||||
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
export declare var x4: d;
|
||||
export declare var d4: typeof d;
|
||||
export declare var f4: d;
|
||||
export declare var x4: m4.d;
|
||||
export declare var d4: typeof m4.d;
|
||||
export declare var f4: m4.d;
|
||||
export declare module m1 {
|
||||
var x2: d;
|
||||
var d2: typeof d;
|
||||
var f2: d;
|
||||
var x2: m4.d;
|
||||
var d2: typeof m4.d;
|
||||
var f2: m4.d;
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
export declare var x4: d;
|
||||
export declare var d4: typeof d;
|
||||
export declare var f4: d;
|
||||
export declare var x4: m4.d;
|
||||
export declare var d4: typeof m4.d;
|
||||
export declare var f4: m4.d;
|
||||
export declare module m1 {
|
||||
var x2: d;
|
||||
var d2: typeof d;
|
||||
var f2: d;
|
||||
var x2: m4.d;
|
||||
var d2: typeof m4.d;
|
||||
var f2: m4.d;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
Vendored
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts
Vendored
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
Vendored
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
Vendored
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a3: typeof m2_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
export declare var a3: typeof m2.m2_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ export declare class c1 {
|
||||
}
|
||||
export declare var instance1: c1;
|
||||
export declare function f1(): c1;
|
||||
export declare var a2: typeof m1_c1;
|
||||
export declare var a2: typeof m1.m1_c1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user