Beispiel #1
0
        public override Value Visit(RepeatLoop node)
        {
            //	br repeatloop	; llvm demands it
            //	repeatloop:
            //		body
            //		br cond, repeatend, repeatloop
            //	repeatend:
            // NOTE: it is invalid to modify the id var inside the loop

            // func was set in Visit(RoutineDefinition node)
            Function func = evalCtx.func;

            BasicBlock repeatloop = func.AppendBasicBlock("repeatloop");
            BasicBlock repeatend  = func.AppendBasicBlock("repeatend");

            evalCtx.EnterLoop(repeatloop, repeatend);
            builder.BuildBr(repeatloop);
            builder.ResetInsertPoint(func, repeatloop);

            Value block = traverse(node.block);
            Value cond  = traverse(node.condition);

            builder.BuildCondBr(cond, repeatend, repeatloop);

            Debug.Assert(!block.IsNull, "Invalid Repeat loop block");
            Debug.Assert(!cond.IsNull, "Invalid Repeat loop condition");

            builder.ResetInsertPoint(func, repeatend);
            evalCtx.LeaveLoop();
            return(Value.NonNull);
        }
Beispiel #2
0
 public override bool Visit(RepeatLoop node)
 {
     //Visit((LoopStatement) node);
     outputCode("do ", true, true);
     traverse(node.block);
     outputCode("while (!", true, false);
     traverse(node.condition);
     outputCode(");", false, true);
     return(true);
 }
 private void Awake()
 {
     TargetObserver.onTargetSelected += this.OnTargetSelected;
     TargetObserver.onFull           += this.OnFull;
     repeatLoop = new RepeatLoop((MonoBehaviour)this, UpdateTarget);
 }
 public virtual T Visit(RepeatLoop node)
 {
     return(Visit((LoopStatement)node));
 }
Beispiel #5
0
 public override bool Visit(RepeatLoop node)
 {
     Visit((LoopStatement)node);
     return(true);
 }