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

Function getEnumKind

test/fixtures/snapshot/typescript.js:57449–57472  ·  view source on GitHub ↗
(symbol)

Source from the content-addressed store, hash-verified

57447 }
57448 }
57449 function getEnumKind(symbol) {
57450 var links = getSymbolLinks(symbol);
57451 if (links.enumKind !== undefined) {
57452 return links.enumKind;
57453 }
57454 var hasNonLiteralMember = false;
57455 if (symbol.declarations) {
57456 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
57457 var declaration = _a[_i];
57458 if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) {
57459 for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
57460 var member = _c[_b];
57461 if (member.initializer && ts.isStringLiteralLike(member.initializer)) {
57462 return links.enumKind = 1 /* EnumKind.Literal */;
57463 }
57464 if (!isLiteralEnumMember(member)) {
57465 hasNonLiteralMember = true;
57466 }
57467 }
57468 }
57469 }
57470 }
57471 return links.enumKind = hasNonLiteralMember ? 0 /* EnumKind.Numeric */ : 1 /* EnumKind.Literal */;
57472 }
57473 function getBaseTypeOfEnumLiteralType(type) {
57474 return type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
57475 }

Callers 4

getDeclaredTypeOfEnumFunction · 0.85
computeMemberValueFunction · 0.85
computeConstantValueFunction · 0.85

Calls 2

getSymbolLinksFunction · 0.85
isLiteralEnumMemberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…