Table of Contents

Class CallStackUtil

Namespace
Hi.NcParsers.EvaluationSyntaxs
Assembly
HiMech.dll

Push / pop helpers for the per-block CallStack section. Both produce a fresh deep-cloned JsonObject ready to stamp onto an inlined piece (push site) or onto an M99 return block (pop site); the caller is responsible for deep-cloning again if it distributes the same stamp across multiple pieces of an L-repetition.

Pairs with ModalCarrySyntax at the Logic stage: explicit push / pop writes seed the section at frame boundaries, ModalCarry copies it forward to every block in between so each block is self-contained for cache-dump readers and downstream consumers (notably M99 P{seq} reading the top frame's CallerFilePath).

public static class CallStackUtil
Inheritance
CallStackUtil
Inherited Members

Methods

BuildPoppedCallStack(JsonObject)

Builds the post-pop CallStack section to stamp onto an M99 return block. Reads the M99 block's currently-carried stack, deep-clones it, and drops the top frame. Returns null when there was no frame to pop (M99 in main file with no caller — the runner treats this as program-end via the implicit fall-through; no stamp is needed).

public static JsonObject BuildPoppedCallStack(JsonObject hostJson)

Parameters

hostJson JsonObject

The M99 block's JSON object (post-carry, before this pop runs).

Returns

JsonObject

BuildPushedCallStack(JsonObject, string)

Builds the post-push CallStack section to stamp onto every inlined-body piece of a call. Reads the host block's current stack (defaulting to empty when absent — main-frame caller), deep-clones it, and appends a new CallFrame whose CallerFilePath records where the call originated. The returned JsonObject can be safely deep-cloned by the caller for each piece in an L-repetition.

public static JsonObject BuildPushedCallStack(JsonObject hostJson, string callerFilePath)

Parameters

hostJson JsonObject

The call-host block's JSON object.

callerFilePath string

Project-relative path of the host file (typically FilePath on the host piece).

Returns

JsonObject

GetTopCallerFilePath(JsonObject)

Returns the top frame's CallerFilePath from the given block's CallStack section, or null when the stack is empty or absent (block is in the main frame).

public static string GetTopCallerFilePath(JsonObject hostJson)

Parameters

hostJson JsonObject

Returns

string