getCallTrace (-- callTrace)
Inputs
- None.
Outputs
callTrace: Immutable Ref to the current top call-trace item, or knownNILof that Ref schema when unavailable.
getCallTrace returns the structured immutable Ref itself.
The result schema is an immutable Ref to the callTraceItem type. In formatted form, that referent schema is:
{
name: Text;
line: Int32;
column: Int32;
prev: Natx;
}
The referent fields mean:
name: Source file path of the recorded call site.line: 1-based source line of that call site.column: 1-based source column of that call site.prev: Natx link to the previous call-trace item, or0when no older frame is present.
Behavior
- If call-trace data is available, the builtin returns an unknown immutable Ref to the current top call-trace item.
- If call-trace data is unavailable, the builtin returns a known
NILimmutable Ref of the same schema.
Example
{} 0 {} [
"-- immutable Ref result --" printCompilerMessage
getCallTrace isConst printStack _:;
getCallTrace printStack _:;
0
] "main" exportFunction
Expected Output During Compilation
-- immutable Ref result --
TRUE
{
name: Text;
line: Int32;
column: Int32;
prev: Natx;
} CNIL
See also
failCompilationbuiltin(--)Aborts compilation immediately.printCompilerMessagebuiltin(message --)Prints a known Text message during compilation and appends one line-feed character.printStackbuiltin(--)Prints the current data stack in canonical formatter form; it does not itself pop stack objects.printStackTracebuiltin(--)Prints the current scope stack as file path, line, column, and node source text information.raiseStaticErrorbuiltin(message --)Raises a compile-time error with the given known Text message.