mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
parent
2b14bcbb56
commit
b057bf9f01
@ -563,11 +563,6 @@ namespace ts {
|
||||
return isString(value) ? '"' + escapeNonAsciiString(value) + '"' : "" + value;
|
||||
}
|
||||
|
||||
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
|
||||
export function escapeLeadingUnderscores(identifier: string): __String {
|
||||
return (identifier.length >= 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? "_" + identifier : identifier) as __String;
|
||||
}
|
||||
|
||||
// Make an identifier from an external module name by extracting the string after the last "/" and replacing
|
||||
// all non-alphanumeric characters with underscores
|
||||
export function makeIdentifierFromModuleName(moduleName: string): string {
|
||||
@ -4792,6 +4787,11 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' */
|
||||
export function escapeLeadingUnderscores(identifier: string): __String {
|
||||
return (identifier.length >= 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? "_" + identifier : identifier) as __String;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove extra underscore from escaped identifier text content.
|
||||
*
|
||||
|
||||
@ -3184,6 +3184,8 @@ declare namespace ts {
|
||||
* @returns The original parse tree node if found; otherwise, undefined.
|
||||
*/
|
||||
function getParseTreeNode<T extends Node>(node: Node | undefined, nodeTest?: (node: Node) => node is T): T | undefined;
|
||||
/** Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' */
|
||||
function escapeLeadingUnderscores(identifier: string): __String;
|
||||
/**
|
||||
* Remove extra underscore from escaped identifier text content.
|
||||
*
|
||||
|
||||
@ -3184,6 +3184,8 @@ declare namespace ts {
|
||||
* @returns The original parse tree node if found; otherwise, undefined.
|
||||
*/
|
||||
function getParseTreeNode<T extends Node>(node: Node | undefined, nodeTest?: (node: Node) => node is T): T | undefined;
|
||||
/** Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' */
|
||||
function escapeLeadingUnderscores(identifier: string): __String;
|
||||
/**
|
||||
* Remove extra underscore from escaped identifier text content.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user