MCPcopy Index your code
hub / github.com/nodejs/node / isSameEntityName

Function isSameEntityName

test/fixtures/snapshot/typescript.js:16525–16542  ·  view source on GitHub ↗

* Is the 'declared' name the same as the one in the initializer? * @return true for identical entity names, as well as ones where the initializer is prefixed with * 'window', 'self' or 'global'. For example: * * var my = my || {} * var min = window.min || {} * my.app =

(name, initializer)

Source from the content-addressed store, hash-verified

16523 * my.app = self.my.app || class { }
16524 */
16525 function isSameEntityName(name, initializer) {
16526 if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
16527 return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
16528 }
16529 if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
16530 (initializer.expression.kind === 108 /* SyntaxKind.ThisKeyword */ ||
16531 ts.isIdentifier(initializer.expression) &&
16532 (initializer.expression.escapedText === "window" ||
16533 initializer.expression.escapedText === "self" ||
16534 initializer.expression.escapedText === "global"))) {
16535 return isSameEntityName(name, getNameOrArgument(initializer));
16536 }
16537 if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
16538 return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
16539 && isSameEntityName(name.expression, initializer.expression);
16540 }
16541 return false;
16542 }
16543 ts.isSameEntityName = isSameEntityName;
16544 function getRightMostAssignedExpression(node) {
16545 while (isAssignmentExpression(node, /*excludeCompoundAssignments*/ true)) {

Callers 3

getEffectiveInitializerFunction · 0.85

Calls 5

isPropertyNameLiteralFunction · 0.85
isLiteralLikeAccessFunction · 0.85
getNameOrArgumentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…