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

Function serializeEnum

test/fixtures/snapshot/typescript.js:54641–54653  ·  view source on GitHub ↗
(symbol, symbolName, modifierFlags)

Source from the content-addressed store, hash-verified

54639 }
54640 }
54641 function serializeEnum(symbol, symbolName, modifierFlags) {
54642 addResult(ts.factory.createEnumDeclaration(
54643 /*decorators*/ undefined, ts.factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 2048 /* ModifierFlags.Const */ : 0), getInternalSymbolName(symbol, symbolName), ts.map(ts.filter(getPropertiesOfType(getTypeOfSymbol(symbol)), function (p) { return !!(p.flags & 8 /* SymbolFlags.EnumMember */); }), function (p) {
54644 // TODO: Handle computed names
54645 // I hate that to get the initialized value we need to walk back to the declarations here; but there's no
54646 // other way to get the possible const value of an enum member that I'm aware of, as the value is cached
54647 // _on the declaration_, not on the declaration's symbol...
54648 var initializedValue = p.declarations && p.declarations[0] && ts.isEnumMember(p.declarations[0]) ? getConstantValue(p.declarations[0]) : undefined;
54649 return ts.factory.createEnumMember(ts.unescapeLeadingUnderscores(p.escapedName), initializedValue === undefined ? undefined :
54650 typeof initializedValue === "string" ? ts.factory.createStringLiteral(initializedValue) :
54651 ts.factory.createNumericLiteral(initializedValue));
54652 })), modifierFlags);
54653 }
54654 function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
54655 var signatures = getSignaturesOfType(type, 0 /* SignatureKind.Call */);
54656 for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {

Callers 1

serializeSymbolWorkerFunction · 0.85

Calls 8

addResultFunction · 0.85
isConstEnumSymbolFunction · 0.85
getInternalSymbolNameFunction · 0.85
getPropertiesOfTypeFunction · 0.85
getTypeOfSymbolFunction · 0.85
getConstantValueFunction · 0.85
mapMethod · 0.65
filterMethod · 0.65

Tested by

no test coverage detected