예제 #1
0
        private void CGWhileStat(FuncInfo funcInfo, WhileStatNode node)
        {
            int beforePc = funcInfo.PC();
            int r        = funcInfo.AllocReg();

            CGExp(funcInfo, node.Exp, r, 1);
            funcInfo.FreeReg();
            funcInfo.EmitTest(r, 0);
            int jumPC = funcInfo.EmitJMP(0, 0);

            funcInfo.EnterScope(true);
            CGBlock(funcInfo, node.DoStatNode.Block);
            funcInfo.EmitJMP(0, beforePc - funcInfo.PC());
            funcInfo.ExitScope();
            funcInfo.FixSBX(jumPC, funcInfo.PC() - jumPC);
        }
예제 #2
0
 public virtual TResult Visit(WhileStatNode node) => this.VisitChildren(node);