Exemplo n.º 1
0
        internal void EnterFrame(ValuePhoFunc func)
        {
            CallHook(DebugHook.Call);

            var newFrame = new RuntimeFrame(func);

            _currFrame = newFrame;

            _callStack.Push(_currFrame);

            LocalReg.SetCount(newFrame.Func.RegCount);

            LocalReg.AttachScope(func.Scope);
        }
Exemplo n.º 2
0
        internal void LeaveFrame()
        {
            // -1表示多返回值传递
            if (_currFrame.ReceiverCount != -1)
            {
                _dataStack.Adjust(_currFrame.DataStackBase, _currFrame.ReceiverCount);
            }

            _callStack.Pop();

            if (_callStack.Count > 0)
            {
                _currFrame = _callStack.Peek();
            }
            else
            {
                // 单独运行函数后, 结束
                _currFrame = null;
            }

            CallHook(DebugHook.Return);
        }