// pushes all what's required to perform a clr-to-script function call. function can be null if it's already // at vstack top. private int PushClrToScriptStackFrame(CallStackItemFlags flags, DynValue function, DynValue[] args) { if (function == null) function = m_ValueStack.Peek(); else m_ValueStack.Push(function); // func val args = Internal_AdjustTuple(args); for (int i = 0; i < args.Length; i++) m_ValueStack.Push(args[i]); m_ValueStack.Push(DynValue.NewNumber(args.Length)); // func args count m_ExecutionStack.Push(new CallStackItem() { BasePointer = m_ValueStack.Count, Debug_EntryPoint = function.Function.EntryPointByteCodeLocation, ReturnAddress = -1, ClosureScope = function.Function.ClosureContext, CallingSourceRef = SourceRef.GetClrLocation(), Flags = flags }); return function.Function.EntryPointByteCodeLocation; }
// pushes all what's required to perform a clr-to-script function call. function can be null if it's already // at vstack top. private int PushClrToScriptStackFrame(CallStackItemFlags flags, DynValue function, DynValue[] args) { if (function == null) { function = m_ValueStack.Peek(); } else { m_ValueStack.Push(function); // func val } args = Internal_AdjustTuple(args); for (int i = 0; i < args.Length; i++) { m_ValueStack.Push(args[i]); } m_ValueStack.Push(DynValue.NewNumber(args.Length)); // func args count m_ExecutionStack.Push(new CallStackItem() { BasePointer = m_ValueStack.Count, Debug_EntryPoint = function.Function.EntryPointByteCodeLocation, ReturnAddress = -1, ClosureScope = function.Function.ClosureContext, CallingSourceRef = SourceRef.GetClrLocation(), Flags = flags }); return(function.Function.EntryPointByteCodeLocation); }
private int PushClrToScriptStackFrame(CallStackItemFlags flags, DynValue function, DynValue arg1, DynValue arg2, DynValue arg3, DynValue arg4, DynValue metafunction = default(DynValue)) { if (!function.IsValid) { function = m_ValueStack.Peek(); } else { m_ValueStack.Push(function); // func val } int pushed = 0; if (metafunction.IsValid) { m_ValueStack.Push(metafunction); pushed++; } if (arg1.IsValid) { m_ValueStack.Push(arg1); pushed++; } if (arg2.IsValid) { m_ValueStack.Push(arg2); pushed++; } if (arg3.IsValid) { m_ValueStack.Push(arg3); pushed++; } if (arg4.IsValid) { m_ValueStack.Push(arg4); pushed++; } m_ValueStack.Push(DynValue.NewNumber(pushed)); // func args count m_ExecutionStack.Push(new CallStackItem() { BasePointer = m_ValueStack.Count, Debug_EntryPoint = function.Function.EntryPointByteCodeLocation, ReturnAddress = -1, ClosureScope = function.Function.ClosureContext, CallingSourceRef = SourceRef.GetClrLocation(), Flags = flags }); return(function.Function.EntryPointByteCodeLocation); }