MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / getExpandedDictNode

Function getExpandedDictNode

masfactory-visualizer/src/parser/edgeParser.ts:24–36  ·  view source on GitHub ↗
(
    arg: TSNode,
    code: string,
    literalValues?: { [name: string]: TSNode }
)

Source from the content-addressed store, hash-verified

22}
23
24function getExpandedDictNode(
25 arg: TSNode,
26 code: string,
27 literalValues?: { [name: string]: TSNode }
28): TSNode | null {
29 const raw = getNodeText(arg, code).trim();
30 if (!raw.startsWith('**')) {return null;}
31 const inlineDict = arg.namedChildren.find((child): child is TSNode => !!child && child.type === 'dictionary');
32 if (inlineDict) {return inlineDict;}
33 const expr = raw.slice(2).trim();
34 if (!expr || !literalValues) {return null;}
35 return literalValues[expr] && literalValues[expr].type === 'dictionary' ? literalValues[expr] : null;
36}
37
38function getExpandedKeywordValue(
39 args: TSNode[],

Callers 1

getExpandedKeywordValueFunction · 0.70

Calls 1

getNodeTextFunction · 0.90

Tested by

no test coverage detected