mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-01 03:20:48 -05:00
Merge pull request #381 from branch 'remote/privacyErrors'
Report privacy errors on variable/property declarations and also emit import declarations that get used to defined visible type
This commit is contained in:
@@ -309,7 +309,7 @@ module ts {
|
||||
else {
|
||||
return returnResolvedSymbol(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.Constructor:
|
||||
@@ -449,7 +449,7 @@ module ts {
|
||||
return moduleSymbol;
|
||||
}
|
||||
|
||||
function getExportAssignmentSymbol(symbol: Symbol): Symbol {
|
||||
function getExportAssignmentSymbol(symbol: Symbol): Symbol {
|
||||
checkTypeOfExportAssignmentSymbol(symbol);
|
||||
var symbolLinks = getSymbolLinks(symbol);
|
||||
return symbolLinks.exportAssignSymbol === unknownSymbol ? undefined : symbolLinks.exportAssignSymbol;
|
||||
@@ -660,38 +660,59 @@ module ts {
|
||||
return callback(globals);
|
||||
}
|
||||
|
||||
function getAccessibleSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) {
|
||||
function getAccessibleSymbolFromSymbolTable(symbols: SymbolTable) {
|
||||
function getQualifiedLeftMeaning(rightMeaning: SymbolFlags) {
|
||||
// If we are looking in value space, the parent meaning is value, other wise it is namespace
|
||||
return rightMeaning === SymbolFlags.Value ? SymbolFlags.Value : SymbolFlags.Namespace;
|
||||
}
|
||||
|
||||
function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): Symbol[] {
|
||||
function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] {
|
||||
function canQualifySymbol(symbolFromSymbolTable: Symbol, meaning: SymbolFlags) {
|
||||
// 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 = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning));
|
||||
return !!accessibleParent;
|
||||
}
|
||||
|
||||
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 the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table)
|
||||
// and if symbolfrom symbolTable or alias resolution matches the symbol,
|
||||
// check the symbol can be qualified, it is only then this symbol is accessible
|
||||
return !forEach(symbolFromSymbolTable.declarations, declaration => hasExternalModuleSymbol(declaration)) &&
|
||||
canQualifySymbol(symbolFromSymbolTable, meaning);
|
||||
}
|
||||
}
|
||||
|
||||
// If symbol is directly available by its name in the symbol table
|
||||
if (isAccessible(lookUp(symbols, symbol.name))) {
|
||||
return symbol;
|
||||
return [symbol];
|
||||
}
|
||||
|
||||
// Check if symbol is any of the alias
|
||||
return forEachValue(symbols, symbolFromSymbolTable => {
|
||||
if (symbolFromSymbolTable.flags & SymbolFlags.Import) {
|
||||
var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable);
|
||||
if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) {
|
||||
return symbolFromSymbolTable;
|
||||
return [symbolFromSymbolTable];
|
||||
}
|
||||
|
||||
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
|
||||
// but only if the symbolFromSymbolTable can be qualified
|
||||
var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined;
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (symbol) {
|
||||
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolFromSymbolTable);
|
||||
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,20 +751,19 @@ module ts {
|
||||
var meaningToLook = meaning;
|
||||
while (symbol) {
|
||||
// Symbol is accessible if it by itself is accessible
|
||||
var accessibleSymbol = getAccessibleSymbol(symbol, enclosingDeclaration, meaningToLook);
|
||||
if (accessibleSymbol) {
|
||||
if (forEach(accessibleSymbol.declarations, declaration => !isDeclarationVisible(declaration))) {
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook);
|
||||
if (accessibleSymbolChain) {
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
|
||||
if (!hasAccessibleDeclarations) {
|
||||
return {
|
||||
accessibility: SymbolAccessibility.NotAccessible,
|
||||
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
|
||||
errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, SymbolFlags.Namespace) : undefined
|
||||
errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, SymbolFlags.Namespace) : undefined,
|
||||
};
|
||||
}
|
||||
return { accessibility: SymbolAccessibility.Accessible };
|
||||
return { accessibility: SymbolAccessibility.Accessible, aliasesToMakeVisible: hasAccessibleDeclarations.aliasesToMakeVisible };
|
||||
}
|
||||
|
||||
// TODO(shkamat): Handle static method of class
|
||||
|
||||
// If we havent got the accessible symbol doesnt mean the symbol is actually inaccessible.
|
||||
// It could be qualified symbol and hence verify the path
|
||||
// eg:
|
||||
@@ -756,18 +776,91 @@ module ts {
|
||||
// we are going to see if c can be accessed in scope directly.
|
||||
// But it cant, hence the accessible is going to be undefined, but that doesnt mean m.c is accessible
|
||||
// It is accessible if the parent m is accessible because then m.c can be accessed through qualification
|
||||
meaningToLook = SymbolFlags.Namespace;
|
||||
meaningToLook = getQualifiedLeftMeaning(meaning);
|
||||
symbol = symbol.parent;
|
||||
}
|
||||
|
||||
// This is a local symbol that cannot be named
|
||||
// This could be a symbol that is not exported in the external module
|
||||
// or it could be a symbol from different external module that is not aliased and hence cannot be named
|
||||
var symbolExternalModule = forEach(initialSymbol.declarations, declaration => getExternalModuleContainer(declaration));
|
||||
if (symbolExternalModule) {
|
||||
var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration);
|
||||
if (symbolExternalModule !== enclosingExternalModule) {
|
||||
// name from different external module that is not visibile
|
||||
return {
|
||||
accessibility: SymbolAccessibility.CannotBeNamed,
|
||||
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
|
||||
errorModuleName: symbolToString(symbolExternalModule)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Just a local name that is not accessible
|
||||
return {
|
||||
accessibility: SymbolAccessibility.CannotBeNamed,
|
||||
accessibility: SymbolAccessibility.NotAccessible,
|
||||
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
|
||||
};
|
||||
}
|
||||
|
||||
return { accessibility: SymbolAccessibility.Accessible };
|
||||
|
||||
function getExternalModuleContainer(declaration: Declaration) {
|
||||
for (; declaration; declaration = declaration.parent) {
|
||||
if (hasExternalModuleSymbol(declaration)) {
|
||||
return getSymbolOfNode(declaration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hasExternalModuleSymbol(declaration: Declaration) {
|
||||
return (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.name.kind === SyntaxKind.StringLiteral) ||
|
||||
(declaration.kind === SyntaxKind.SourceFile && isExternalModule(<SourceFile>declaration));
|
||||
}
|
||||
|
||||
function hasVisibleDeclarations(symbol: Symbol): { aliasesToMakeVisible?: ImportDeclaration[]; } {
|
||||
var aliasesToMakeVisible: ImportDeclaration[];
|
||||
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
|
||||
return undefined;
|
||||
}
|
||||
return { aliasesToMakeVisible: aliasesToMakeVisible };
|
||||
|
||||
function getIsDeclarationVisible(declaration: Declaration) {
|
||||
if (!isDeclarationVisible(declaration)) {
|
||||
// Mark the unexported alias as visible if its parent is visible
|
||||
// because these kind of aliases can be used to name types in declaration file
|
||||
if (declaration.kind === SyntaxKind.ImportDeclaration &&
|
||||
!(declaration.flags & NodeFlags.Export) &&
|
||||
isDeclarationVisible(declaration.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!contains(aliasesToMakeVisible, declaration)) {
|
||||
aliasesToMakeVisible.push(declaration);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [declaration];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Declaration is not visible
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function isImportDeclarationEntityNameReferenceDeclarationVisibile(entityName: EntityName): SymbolAccessiblityResult {
|
||||
var firstIdentifier = getFirstIdentifier(entityName);
|
||||
var firstIdentifierName = identifierToString(<Identifier>firstIdentifier);
|
||||
var symbolOfNameSpace = resolveName(entityName.parent, (<Identifier>firstIdentifier).text, SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, firstIdentifierName);
|
||||
// Verify if the symbol is accessible
|
||||
var hasNamespaceDeclarationsVisibile = hasVisibleDeclarations(symbolOfNameSpace);
|
||||
return hasNamespaceDeclarationsVisibile ?
|
||||
{ accessibility: SymbolAccessibility.Accessible, aliasesToMakeVisible: hasNamespaceDeclarationsVisibile.aliasesToMakeVisible } :
|
||||
{ accessibility: SymbolAccessibility.NotAccessible, errorSymbolName: firstIdentifierName };
|
||||
}
|
||||
|
||||
// Enclosing declaration is optional when we dont want to get qualified name in the enclosing declaration scope
|
||||
@@ -788,15 +881,27 @@ module ts {
|
||||
// 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) {
|
||||
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)) {
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning);
|
||||
|
||||
var currentSymbolName: string;
|
||||
if (accessibleSymbolChain) {
|
||||
currentSymbolName = ts.map(accessibleSymbolChain, accessibleSymbol => getSymbolName(accessibleSymbol)).join(".");
|
||||
}
|
||||
else {
|
||||
// If we didnt find accessible symbol chain for this symbol, break if this is external module
|
||||
if (!isFirstName && ts.forEach(symbol.declarations, declaration => hasExternalModuleSymbol(declaration))) {
|
||||
break;
|
||||
}
|
||||
currentSymbolName = getSymbolName(symbol);
|
||||
}
|
||||
symbolName = currentSymbolName + (isFirstName ? "" : ("." + symbolName));
|
||||
if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
|
||||
break;
|
||||
}
|
||||
symbol = accessibleSymbol ? accessibleSymbol.parent : symbol.parent;
|
||||
symbol = accessibleSymbolChain ? accessibleSymbolChain[0].parent : symbol.parent;
|
||||
meaning = getQualifiedLeftMeaning(meaning);
|
||||
}
|
||||
|
||||
return symbolName;
|
||||
@@ -821,7 +926,7 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
function typeToString(type: Type, enclosingDeclaration?:Node, flags?: TypeFormatFlags): string {
|
||||
function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string {
|
||||
var stringWriter = createSingleLineTextWriter();
|
||||
// TODO(shkamat): typeToString should take enclosingDeclaration as input, once we have implemented enclosingDeclaration
|
||||
writeTypeToTextWriter(type, enclosingDeclaration, flags, stringWriter);
|
||||
@@ -880,10 +985,13 @@ module ts {
|
||||
writeTypeofSymbol(type);
|
||||
}
|
||||
// Use 'typeof T' for types of functions and methods that circularly reference themselves
|
||||
// TODO(shkamat): correct the usuage of typeof function - always on functions that are visible
|
||||
else if (type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && typeStack && contains(typeStack, type)) {
|
||||
else if (shouldWriteTypeOfFunctionSymbol()) {
|
||||
writeTypeofSymbol(type);
|
||||
}
|
||||
else if (typeStack && contains(typeStack, type)) {
|
||||
// Recursive usage, use any
|
||||
writer.write("any");
|
||||
}
|
||||
else {
|
||||
if (!typeStack) {
|
||||
typeStack = [];
|
||||
@@ -892,6 +1000,23 @@ module ts {
|
||||
writeLiteralType(type, allowFunctionOrConstructorTypeLiteral);
|
||||
typeStack.pop();
|
||||
}
|
||||
|
||||
function shouldWriteTypeOfFunctionSymbol() {
|
||||
if (type.symbol) {
|
||||
var isStaticMethodSymbol = !!(type.symbol.flags & SymbolFlags.Method && // typeof static method
|
||||
ts.forEach(type.symbol.declarations, declaration => declaration.flags & NodeFlags.Static));
|
||||
var isNonLocalFunctionSymbol = !!(type.symbol.flags & SymbolFlags.Function) &&
|
||||
(type.symbol.parent || // is exported function symbol
|
||||
ts.forEach(type.symbol.declarations, declaration =>
|
||||
declaration.parent.kind === SyntaxKind.SourceFile || declaration.parent.kind === SyntaxKind.ModuleBlock));
|
||||
|
||||
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
||||
// typeof is allowed only for static/non local functions
|
||||
return !!(flags & TypeFormatFlags.UseTypeOfFunction) || // use typeof if format flags specify it
|
||||
(typeStack && contains(typeStack, type)); // it is type of the symbol uses itself recursively
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeTypeofSymbol(type: ObjectType) {
|
||||
@@ -1036,30 +1161,31 @@ module ts {
|
||||
// This is export assigned symbol node
|
||||
var externalModuleSymbol = getSymbolOfNode(externalModule);
|
||||
var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol);
|
||||
var resolvedExportSymbol: Symbol;
|
||||
var symbolOfNode = getSymbolOfNode(node);
|
||||
if (exportAssignmentSymbol === symbolOfNode) {
|
||||
if (isSymbolUsedInExportAssignment(symbolOfNode)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// if symbolOfNode is import declaration, resolve the symbol declaration and check
|
||||
if (symbolOfNode.flags & SymbolFlags.Import) {
|
||||
return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode));
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the symbol is used in export assignment
|
||||
function isSymbolUsedInExportAssignment(symbol: Symbol) {
|
||||
if (exportAssignmentSymbol === symbol) {
|
||||
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) {
|
||||
resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol);
|
||||
if (resolvedExportSymbol === symbol) {
|
||||
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) {
|
||||
@@ -1076,25 +1202,21 @@ module ts {
|
||||
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);
|
||||
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
|
||||
var parent = node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent : node.parent;
|
||||
// If the node is not exported or it is not ambient module element (except import declaration)
|
||||
if (!(node.flags & NodeFlags.Export) &&
|
||||
!(node.kind !== SyntaxKind.ImportDeclaration && parent.kind !== SyntaxKind.SourceFile && isInAmbientContext(parent))) {
|
||||
return isGlobalSourceFile(parent) || isUsedInExportAssignment(node);
|
||||
}
|
||||
// Exported members are visible if parent is visible
|
||||
return isDeclarationVisible(node.parent);
|
||||
// Exported members/ambient module elements (exception import declaraiton) are visible if parent is visible
|
||||
return isDeclarationVisible(parent);
|
||||
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
@@ -1124,7 +1246,7 @@ module ts {
|
||||
if (node) {
|
||||
var links = getNodeLinks(node);
|
||||
if (links.isVisible === undefined) {
|
||||
links.isVisible = determineIfDeclarationIsVisible();
|
||||
links.isVisible = !!determineIfDeclarationIsVisible();
|
||||
}
|
||||
return links.isVisible;
|
||||
}
|
||||
@@ -6758,7 +6880,8 @@ module ts {
|
||||
writeTypeAtLocation: writeTypeAtLocation,
|
||||
writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration,
|
||||
writeSymbol: writeSymbolToTextWriter,
|
||||
isSymbolAccessible: isSymbolAccessible
|
||||
isSymbolAccessible: isSymbolAccessible,
|
||||
isImportDeclarationEntityNameReferenceDeclarationVisibile: isImportDeclarationEntityNameReferenceDeclarationVisibile
|
||||
};
|
||||
checkProgram();
|
||||
return emitFiles(resolver);
|
||||
|
||||
@@ -113,6 +113,51 @@ module ts {
|
||||
Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2021, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
|
||||
Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2022, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
|
||||
Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 2023, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." },
|
||||
Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 2024, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using private name '{1}'." },
|
||||
Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 2025, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using private name '{1}'." },
|
||||
Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 2026, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using private name '{1}'." },
|
||||
Exported_variable_0_has_or_is_using_private_name_1: { code: 2027, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using private name '{1}'." },
|
||||
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2028, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2029, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2030, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." },
|
||||
Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 2031, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 2032, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." },
|
||||
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 2033, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." },
|
||||
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 2034, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." },
|
||||
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2035, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
|
||||
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2036, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
|
||||
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2037, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
|
||||
Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 2038, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." },
|
||||
Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 2039, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 2040, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
|
||||
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2041, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2042, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2043, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2044, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2045, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2046, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2047, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2048, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 2049, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
|
||||
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 2050, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using private name '{0}'." },
|
||||
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 2051, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using private name '{0}'." },
|
||||
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2052, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." },
|
||||
Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2053, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using private name '{0}'." },
|
||||
Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2054, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using private name '{0}'." },
|
||||
Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 2055, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using private name '{0}'." },
|
||||
Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 2056, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using private name '{0}'." },
|
||||
Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 2057, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using private name '{0}'." },
|
||||
Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 2058, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using private name '{0}'." },
|
||||
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2059, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2060, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2061, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2062, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2063, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2064, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2065, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2066, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." },
|
||||
Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 2067, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 2181, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2208, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2209, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2210, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
|
||||
@@ -187,6 +232,18 @@ module ts {
|
||||
A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2246, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." },
|
||||
Function_overload_must_be_static: { code: 2247, category: DiagnosticCategory.Error, key: "Function overload must be static." },
|
||||
Function_overload_must_not_be_static: { code: 2248, category: DiagnosticCategory.Error, key: "Function overload must not be static." },
|
||||
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2249, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2250, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2251, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2252, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2253, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2254, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2255, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2256, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2257, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2258, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2259, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2260, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Circular_definition_of_import_alias_0: { code: 3000, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." },
|
||||
Cannot_find_name_0: { code: 3001, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." },
|
||||
Module_0_has_no_exported_member_1: { code: 3002, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
|
||||
|
||||
@@ -444,6 +444,186 @@
|
||||
"category": "Error",
|
||||
"code": 2023
|
||||
},
|
||||
"Public static property '{0}' of exported class has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2024
|
||||
},
|
||||
"Public property '{0}' of exported class has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2025
|
||||
},
|
||||
"Property '{0}' of exported interface has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2026
|
||||
},
|
||||
"Exported variable '{0}' has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2027
|
||||
},
|
||||
"Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2028
|
||||
},
|
||||
"Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2029
|
||||
},
|
||||
"Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2030
|
||||
},
|
||||
"Exported variable '{0}' has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2031
|
||||
},
|
||||
"Parameter '{0}' of constructor from exported class has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2032
|
||||
},
|
||||
"Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2033
|
||||
},
|
||||
"Parameter '{0}' of public property setter from exported class has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2034
|
||||
},
|
||||
"Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2035
|
||||
},
|
||||
"Parameter '{0}' of call signature from exported interface has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2036
|
||||
},
|
||||
"Parameter '{0}' of public static method from exported class has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2037
|
||||
},
|
||||
"Parameter '{0}' of public method from exported class has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2038
|
||||
},
|
||||
"Parameter '{0}' of method from exported interface has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2039
|
||||
},
|
||||
"Parameter '{0}' of exported function has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2040
|
||||
},
|
||||
"Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2041
|
||||
},
|
||||
"Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2042
|
||||
},
|
||||
"Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2043
|
||||
},
|
||||
"Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2044
|
||||
},
|
||||
"Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2045
|
||||
},
|
||||
"Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2046
|
||||
},
|
||||
"Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2047
|
||||
},
|
||||
"Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2048
|
||||
},
|
||||
"Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2049
|
||||
},
|
||||
"Return type of public static property getter from exported class has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2050
|
||||
},
|
||||
"Return type of public property getter from exported class has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2051
|
||||
},
|
||||
"Return type of constructor signature from exported interface has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2052
|
||||
},
|
||||
"Return type of call signature from exported interface has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2053
|
||||
},
|
||||
"Return type of index signature from exported interface has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2054
|
||||
},
|
||||
"Return type of public static method from exported class has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2055
|
||||
},
|
||||
"Return type of public method from exported class has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2056
|
||||
},
|
||||
"Return type of method from exported interface has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2057
|
||||
},
|
||||
"Return type of exported function has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2058
|
||||
},
|
||||
"Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2059
|
||||
},
|
||||
"Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2060
|
||||
},
|
||||
"Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2061
|
||||
},
|
||||
"Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2062
|
||||
},
|
||||
"Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2063
|
||||
},
|
||||
"Return type of public static method from exported class has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2064
|
||||
},
|
||||
"Return type of public method from exported class has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2065
|
||||
},
|
||||
"Return type of method from exported interface has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2066
|
||||
},
|
||||
"Return type of exported function has or is using name '{0}' from private module '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2067
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2181
|
||||
},
|
||||
"Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2208
|
||||
@@ -740,6 +920,54 @@
|
||||
"category": "Error",
|
||||
"code": 2248
|
||||
},
|
||||
"Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2249
|
||||
},
|
||||
"Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2250
|
||||
},
|
||||
"Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2251
|
||||
},
|
||||
"Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2252
|
||||
},
|
||||
"Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2253
|
||||
},
|
||||
"Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2254
|
||||
},
|
||||
"Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2255
|
||||
},
|
||||
"Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2256
|
||||
},
|
||||
"Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2257
|
||||
},
|
||||
"Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2258
|
||||
},
|
||||
"Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2259
|
||||
},
|
||||
"Return type of exported function has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2260
|
||||
},
|
||||
"Circular definition of import alias '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 3000
|
||||
|
||||
@@ -9,6 +9,7 @@ module ts {
|
||||
getTextPos(): number;
|
||||
getLine(): number;
|
||||
getColumn(): number;
|
||||
getIndent(): number;
|
||||
}
|
||||
|
||||
var indentStrings: string[] = [];
|
||||
@@ -141,6 +142,7 @@ module ts {
|
||||
writeLine: writeLine,
|
||||
increaseIndent: () => indent++,
|
||||
decreaseIndent: () => indent--,
|
||||
getIndent: () => indent,
|
||||
getTextPos: () => output.length,
|
||||
getLine: () => lineCount + 1,
|
||||
getColumn: () => lineStart ? indent * 4 + 1 : output.length - linePos + 1,
|
||||
@@ -1867,27 +1869,63 @@ module ts {
|
||||
var enclosingDeclaration: Node;
|
||||
var reportedDeclarationError = false;
|
||||
|
||||
var aliasDeclarationEmitInfo: {
|
||||
declaration: ImportDeclaration;
|
||||
outputPos: number;
|
||||
indent: number;
|
||||
asynchronousOutput?: string; // If the output for alias was written asynchronously, the corresponding output
|
||||
}[] = [];
|
||||
|
||||
var getSymbolVisibilityDiagnosticMessage: (symbolAccesibilityResult: SymbolAccessiblityResult) => {
|
||||
errorNode: Node;
|
||||
diagnosticMessage: DiagnosticMessage;
|
||||
typeName: Identifier
|
||||
typeName?: Identifier
|
||||
}
|
||||
|
||||
function writeAsychronousImportDeclarations(importDeclarations: ImportDeclaration[]) {
|
||||
var oldWriter = writer;
|
||||
forEach(importDeclarations, aliasToWrite => {
|
||||
var aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined);
|
||||
writer = createTextWriter(writeSymbol);
|
||||
for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) {
|
||||
writer.increaseIndent();
|
||||
}
|
||||
|
||||
writeImportDeclaration(aliasToWrite);
|
||||
aliasEmitInfo.asynchronousOutput = writer.getText();
|
||||
});
|
||||
writer = oldWriter;
|
||||
}
|
||||
|
||||
function writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) {
|
||||
var symbolAccesibilityResult = resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning);
|
||||
// TODO(shkamat): Since we dont have error reporting for all the cases as yet we have this check on handler being present
|
||||
if (!getSymbolVisibilityDiagnosticMessage || symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
|
||||
if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
|
||||
resolver.writeSymbol(symbol, enclosingDeclaration, meaning, writer);
|
||||
|
||||
// write the aliases
|
||||
if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) {
|
||||
writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Report error
|
||||
reportedDeclarationError = true;
|
||||
var errorInfo = getSymbolVisibilityDiagnosticMessage(symbolAccesibilityResult);
|
||||
diagnostics.push(createDiagnosticForNode(errorInfo.errorNode,
|
||||
errorInfo.diagnosticMessage,
|
||||
getSourceTextOfLocalNode(errorInfo.typeName),
|
||||
symbolAccesibilityResult.errorSymbolName,
|
||||
symbolAccesibilityResult.errorModuleName));
|
||||
if (errorInfo) {
|
||||
if (errorInfo.typeName) {
|
||||
diagnostics.push(createDiagnosticForNode(errorInfo.errorNode,
|
||||
errorInfo.diagnosticMessage,
|
||||
getSourceTextOfLocalNode(errorInfo.typeName),
|
||||
symbolAccesibilityResult.errorSymbolName,
|
||||
symbolAccesibilityResult.errorModuleName));
|
||||
}
|
||||
else {
|
||||
diagnostics.push(createDiagnosticForNode(errorInfo.errorNode,
|
||||
errorInfo.diagnosticMessage,
|
||||
symbolAccesibilityResult.errorSymbolName,
|
||||
symbolAccesibilityResult.errorModuleName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1951,23 +1989,55 @@ module ts {
|
||||
}
|
||||
|
||||
function emitImportDeclaration(node: ImportDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
write("export ");
|
||||
}
|
||||
write("import ");
|
||||
emitSourceTextOfNode(node.name);
|
||||
write(" = ");
|
||||
if (node.entityName) {
|
||||
emitSourceTextOfNode(node.entityName);
|
||||
write(";");
|
||||
var nodeEmitInfo = {
|
||||
declaration: node,
|
||||
outputPos: writer.getTextPos(),
|
||||
indent: writer.getIndent(),
|
||||
hasWritten: resolver.isDeclarationVisible(node)
|
||||
};
|
||||
aliasDeclarationEmitInfo.push(nodeEmitInfo);
|
||||
if (nodeEmitInfo.hasWritten) {
|
||||
writeImportDeclaration(node);
|
||||
}
|
||||
}
|
||||
|
||||
function writeImportDeclaration(node: ImportDeclaration) {
|
||||
// note usage of writer. methods instead of aliases created, just to make sure we are using
|
||||
// correct writer especially to handle asynchronous alias writing
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
writer.write("export ");
|
||||
}
|
||||
writer.write("import ");
|
||||
writer.write(getSourceTextOfLocalNode(node.name));
|
||||
writer.write(" = ");
|
||||
if (node.entityName) {
|
||||
checkEntityNameAccessible();
|
||||
writer.write(getSourceTextOfLocalNode(node.entityName));
|
||||
writer.write(";");
|
||||
}
|
||||
else {
|
||||
writer.write("require(");
|
||||
writer.write(getSourceTextOfLocalNode(node.externalModuleName));
|
||||
writer.write(");");
|
||||
}
|
||||
writer.writeLine();
|
||||
|
||||
function checkEntityNameAccessible() {
|
||||
var symbolAccesibilityResult = resolver.isImportDeclarationEntityNameReferenceDeclarationVisibile(node.entityName);
|
||||
if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
|
||||
// write the aliases
|
||||
if (symbolAccesibilityResult.aliasesToMakeVisible) {
|
||||
writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible);
|
||||
}
|
||||
}
|
||||
else {
|
||||
write("require(");
|
||||
emitSourceTextOfNode(node.externalModuleName);
|
||||
write(");");
|
||||
// Report error
|
||||
reportedDeclarationError = true;
|
||||
diagnostics.push(createDiagnosticForNode(node,
|
||||
Diagnostics.Import_declaration_0_is_using_private_name_1,
|
||||
getSourceTextOfLocalNode(node.name),
|
||||
symbolAccesibilityResult.errorSymbolName));
|
||||
}
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2023,7 +2093,7 @@ module ts {
|
||||
function emitTypeParameters(typeParameters: TypeParameterDeclaration[]) {
|
||||
function emitTypeParameter(node: TypeParameterDeclaration) {
|
||||
function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
// TODO(shkamat) Cannot access name errors
|
||||
// Type parameter constraints are named by user so we should always be able to name it
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
@@ -2082,7 +2152,7 @@ module ts {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: node.name
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
emitSourceTextOfNode(node.name);
|
||||
@@ -2090,9 +2160,7 @@ module ts {
|
||||
if (node.constraint && (node.parent.kind !== SyntaxKind.Method || !(node.parent.flags & NodeFlags.Private))) {
|
||||
write(" extends ");
|
||||
getSymbolVisibilityDiagnosticMessage = getTypeParameterConstraintVisibilityError;
|
||||
resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
// TODO(shkamat) This is just till we get rest of the error reporting up
|
||||
getSymbolVisibilityDiagnosticMessage = undefined;
|
||||
resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2111,48 +2179,34 @@ module ts {
|
||||
|
||||
function emitTypeOfTypeReference(node: Node) {
|
||||
getSymbolVisibilityDiagnosticMessage = getHeritageClauseVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.WriteArrayAsGenericType, writer);
|
||||
// TODO(shkamat) This is just till we get rest of the error reporting up
|
||||
getSymbolVisibilityDiagnosticMessage = undefined;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.WriteArrayAsGenericType | TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
|
||||
function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
// Heritage clause is written by user so it can always be named
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
// Class
|
||||
if (symbolAccesibilityResult.accessibility == SymbolAccessibility.NotAccessible) {
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// Class or Interface implemented/extended is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// CannotBeNamed
|
||||
// TODO(shkamat): CannotBeNamed error needs to be handled
|
||||
// Class or Interface implemented/extended is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Interface
|
||||
if (symbolAccesibilityResult.accessibility == SymbolAccessibility.NotAccessible) {
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// interface is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// CannotBeNamed
|
||||
// TODO(shkamat): CannotBeNamed error needs to be handled
|
||||
// interface is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2160,7 +2214,7 @@ module ts {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: (<Declaration>node.parent).name
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2237,9 +2291,50 @@ module ts {
|
||||
}
|
||||
if (!(node.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
getSymbolVisibilityDiagnosticMessage = getVariableDeclarationTypeVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
}
|
||||
|
||||
function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
if (node.kind === SyntaxKind.VariableDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
// This check is to ensure we dont report error on constructor parameter property as that error would be reported during parameter emit
|
||||
else if (node.kind === SyntaxKind.Property) {
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
|
||||
}
|
||||
}
|
||||
|
||||
return diagnosticMessage !== undefined ? {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: node.name
|
||||
} : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
@@ -2260,11 +2355,55 @@ module ts {
|
||||
emitSourceTextOfNode(node.name);
|
||||
if (!(node.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
getSymbolVisibilityDiagnosticMessage = getAccessorDeclarationTypeVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
if (node.kind === SyntaxKind.SetAccessor) {
|
||||
// Setters have to have type named and cannot infer it so, the type should always be named
|
||||
if (node.parent.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
return {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node.parameters[0],
|
||||
typeName: node.name
|
||||
};
|
||||
}
|
||||
else {
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
else {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
return {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node.name,
|
||||
typeName: undefined
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitFunctionDeclaration(node: FunctionDeclaration) {
|
||||
@@ -2317,10 +2456,76 @@ module ts {
|
||||
// If this is not a constructor and is not private, emit the return type
|
||||
if (node.kind !== SyntaxKind.Constructor && !(node.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
getSymbolVisibilityDiagnosticMessage = getReturnTypeVisibilityError;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
|
||||
function getReturnTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
||||
case SyntaxKind.IndexSignature:
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
||||
case SyntaxKind.Method:
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.fail("This is unknown kind for signature: " + SyntaxKind[node.kind]);
|
||||
}
|
||||
|
||||
return {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: <Node>node.name || node,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function emitParameterDeclaration(node: ParameterDeclaration) {
|
||||
@@ -2334,7 +2539,75 @@ module ts {
|
||||
|
||||
if (!(node.parent.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
getSymbolVisibilityDiagnosticMessage = getParameterDeclarationTypeVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
|
||||
function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.ConstructSignature:
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.Method:
|
||||
if (node.parent.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.fail("This is unknown parent for parameter: " + SyntaxKind[node.parent.kind]);
|
||||
}
|
||||
|
||||
return {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: node.name
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2448,7 +2721,19 @@ module ts {
|
||||
// TODO(shkamat): Should we not write any declaration file if any of them can produce error,
|
||||
// or should we just not write this file like we are doing now
|
||||
if (!reportedDeclarationError) {
|
||||
writeFile(getModuleNameFromFilename(jsFilePath) + ".d.ts", referencePathsOutput + writer.getText(), compilerOptions.emitBOM);
|
||||
var declarationOutput = referencePathsOutput;
|
||||
var synchronousDeclarationOutput = writer.getText();
|
||||
// apply additions
|
||||
var appliedSyncOutputPos = 0;
|
||||
forEach(aliasDeclarationEmitInfo, aliasEmitInfo => {
|
||||
if (aliasEmitInfo.asynchronousOutput) {
|
||||
declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);
|
||||
declarationOutput += aliasEmitInfo.asynchronousOutput;
|
||||
appliedSyncOutputPos = aliasEmitInfo.outputPos;
|
||||
}
|
||||
});
|
||||
declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);
|
||||
writeFile(getModuleNameFromFilename(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2469,6 +2754,11 @@ module ts {
|
||||
if (compilerOptions.out) {
|
||||
emitFile(compilerOptions.out);
|
||||
}
|
||||
|
||||
// Sort and make the unique list of diagnostics
|
||||
diagnostics.sort(compareDiagnostics);
|
||||
diagnostics = deduplicateSortedDiagnostics(diagnostics);
|
||||
|
||||
return {
|
||||
errors: diagnostics,
|
||||
sourceMaps: sourceMapDataList
|
||||
|
||||
@@ -625,6 +625,8 @@ module ts {
|
||||
|
||||
/** writes Array<T> instead T[] */
|
||||
WriteArrayAsGenericType = 0x00000001, // Declarations
|
||||
|
||||
UseTypeOfFunction = 0x00000002, // instead of writing signature type of function use typeof
|
||||
}
|
||||
|
||||
export enum SymbolAccessibility {
|
||||
@@ -635,8 +637,9 @@ module ts {
|
||||
|
||||
export interface SymbolAccessiblityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
errorSymbolName?: string; // Optional symbol name that results in error
|
||||
errorModuleName?: string; // If the symbol is not visibile from module, module's name
|
||||
errorSymbolName?: string // Optional symbol name that results in error
|
||||
errorModuleName?: string // If the symbol is not visibile from module, module's name
|
||||
aliasesToMakeVisible?: ImportDeclaration[]; // aliases that need to have this symbol visible
|
||||
}
|
||||
|
||||
export interface EmitResolver {
|
||||
@@ -656,6 +659,7 @@ module ts {
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void;
|
||||
writeSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, writer: TextWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isImportDeclarationEntityNameReferenceDeclarationVisibile(entityName: EntityName): SymbolAccessiblityResult;
|
||||
}
|
||||
|
||||
export enum SymbolFlags {
|
||||
|
||||
Reference in New Issue
Block a user