PR cleanup

This commit is contained in:
Ron Buckton 2017-10-23 13:55:31 -07:00
parent a31ce789f4
commit 9f1100cf30
2 changed files with 20 additions and 16 deletions

View file

@ -385,12 +385,6 @@ namespace ts {
return (identifier.length >= 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? "_" + identifier : identifier) as __String;
}
export function isEscapedNameOfWellKnownSymbol(escapedName: __String) {
return (escapedName as string).charCodeAt(0) === CharacterCodes._ &&
(escapedName as string).charCodeAt(1) === CharacterCodes._ &&
(escapedName as string).charCodeAt(2) === CharacterCodes.at;
}
/**
* @deprecated Use `id.escapedText` to get the escaped text of an Identifier.
* @param identifier The identifier to escape

View file

@ -167,17 +167,15 @@ namespace ts.Completions {
const uniqueNames = createMap<true>();
if (symbols) {
for (const symbol of symbols) {
if (!isEscapedNameOfWellKnownSymbol(symbol.escapedName)) {
const entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target, allowStringLiteral);
if (entry) {
const id = entry.name;
if (!uniqueNames.has(id)) {
if (symbolToOriginInfoMap && symbolToOriginInfoMap[getUniqueSymbolId(symbol, typeChecker)]) {
entry.hasAction = true;
}
entries.push(entry);
uniqueNames.set(id, true);
const entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target, allowStringLiteral);
if (entry) {
const id = entry.name;
if (!uniqueNames.has(id)) {
if (symbolToOriginInfoMap && symbolToOriginInfoMap[getUniqueSymbolId(symbol, typeChecker)]) {
entry.hasAction = true;
}
entries.push(entry);
uniqueNames.set(id, true);
}
}
}
@ -1778,6 +1776,18 @@ namespace ts.Completions {
}
}
// If the symbol is for a member of an object type and is the internal name of an ES
// symbol, it is not a valid entry. Internal names for ES symbols start with "__@"
if (symbol.flags & SymbolFlags.ClassMember) {
const escapedName = symbol.escapedName as string;
if (escapedName.length >= 3 &&
escapedName.charCodeAt(0) === CharacterCodes._ &&
escapedName.charCodeAt(1) === CharacterCodes._ &&
escapedName.charCodeAt(2) === CharacterCodes.at) {
return undefined;
}
}
return getCompletionEntryDisplayName(name, target, performCharacterChecks, allowStringLiteral);
}