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

Function getExpandedDictNode

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

Source from the content-addressed store, hash-verified

181}
182
183function getExpandedDictNode(
184 arg: TSNode,
185 code: string,
186 literalValues?: { [name: string]: TSNode }
187): TSNode | null {
188 const raw = getNodeText(arg, code).trim();
189 if (!raw.startsWith('**')) {return null;}
190
191 const inlineDict = arg.namedChildren.find((child): child is TSNode => !!child && child.type === 'dictionary');
192 if (inlineDict) {return inlineDict;}
193
194 const expr = raw.slice(2).trim();
195 if (!expr || !literalValues) {return null;}
196 return literalValues[expr] && literalValues[expr].type === 'dictionary' ? literalValues[expr] : null;
197}
198
199function getExpandedKeywordArgValue(
200 args: TSNode[],

Callers 1

Calls 1

getNodeTextFunction · 0.90

Tested by

no test coverage detected