Respond to code review remarks
This commit is contained in:
parent
383f01dbf6
commit
0c5d736251
|
@ -351,7 +351,8 @@ module ts {
|
|||
}
|
||||
else if (location.kind === SyntaxKind.SourceFile) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember);
|
||||
if (result && (result.flags & meaning) && result.valueDeclaration && (result.valueDeclaration.flags & NodeFlags.Default) && result.valueDeclaration.localSymbol.name === name) {
|
||||
let localSymbol = getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
|
|
|
@ -145,7 +145,7 @@ module ts {
|
|||
|
||||
return node.pos === node.end && node.kind !== SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
|
||||
export function nodeIsPresent(node: Node) {
|
||||
return !nodeIsMissing(node);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ module ts {
|
|||
errorNode = (<Declaration>node).name;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (errorNode === undefined) {
|
||||
// If we don't have a better node, then just set the error on the first token of
|
||||
// construct.
|
||||
|
@ -634,7 +634,7 @@ module ts {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
export function childIsDecorated(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
|
@ -745,7 +745,7 @@ module ts {
|
|||
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) {
|
||||
let moduleState = getModuleInstanceState(node)
|
||||
return moduleState === ModuleInstanceState.Instantiated ||
|
||||
(preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly);
|
||||
(preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly);
|
||||
}
|
||||
|
||||
export function isExternalModuleImportEqualsDeclaration(node: Node) {
|
||||
|
@ -1161,7 +1161,7 @@ module ts {
|
|||
export function createTextSpanFromBounds(start: number, end: number) {
|
||||
return createTextSpan(start, end - start);
|
||||
}
|
||||
|
||||
|
||||
export function textChangeRangeNewSpan(range: TextChangeRange) {
|
||||
return createTextSpan(range.span.start, range.newLength);
|
||||
}
|
||||
|
@ -1435,13 +1435,13 @@ module ts {
|
|||
return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get16BitUnicodeEscapeSequence(charCode: number): string {
|
||||
let hexCharCode = charCode.toString(16).toUpperCase();
|
||||
let paddedHexCode = ("0000" + hexCharCode).slice(-4);
|
||||
return "\\u" + paddedHexCode;
|
||||
}
|
||||
|
||||
|
||||
let nonAsciiCharacters = /[^\u0000-\u007F]/g;
|
||||
export function escapeNonAsciiCharacters(s: string): string {
|
||||
// Replace non-ASCII characters with '\uNNNN' escapes if any exist.
|
||||
|
@ -1768,4 +1768,7 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
export function getLocalSymbolForExportDefault(symbol: Symbol) {
|
||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2405,8 +2405,11 @@ module ts {
|
|||
}
|
||||
|
||||
// If this is the default export, get the name of the declaration if it exists
|
||||
if (displayName === "default" && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) && symbol.valueDeclaration.localSymbol && symbol.valueDeclaration.localSymbol.name) {
|
||||
displayName = symbol.valueDeclaration.localSymbol.name;
|
||||
if (displayName === "default") {
|
||||
let localSymbol = getLocalSymbolForExportDefault(symbol);
|
||||
if (localSymbol && localSymbol.name) {
|
||||
displayName = symbol.valueDeclaration.localSymbol.name;
|
||||
}
|
||||
}
|
||||
|
||||
let firstCharCode = displayName.charCodeAt(0);
|
||||
|
|
Loading…
Reference in a new issue