示例#1
0
        public override void Compile(sunCompiler compiler)
        {
            Condition.Compile(compiler);
            var trueBodyEpilogue = new sunJumpNotEqualSite(compiler.Binary);

            TrueBody.Compile(compiler);
            var falseBody = FalseBody;

            if (falseBody != null)
            {
                var falseBodyEpilogue = new sunJumpSite(compiler.Binary);
                trueBodyEpilogue.Relocate();
                falseBody.Compile(compiler);
                falseBodyEpilogue.Relocate();
            }
            else
            {
                trueBodyEpilogue.Relocate();
            }
        }
示例#2
0
        public override void Compile(sunCompiler compiler)
        {
            Condition.Compile(compiler);
            var falsePrologue = new sunJumpNotEqualSite(compiler.Binary);

            TrueBody.Compile(compiler);
            var trueEpilogue = new sunJumpSite(compiler.Binary);

            falsePrologue.Relocate();
            FalseBody.Compile(compiler);
            trueEpilogue.Relocate();
        }
示例#3
0
        public override void Compile(sunCompiler compiler)
        {
            var loop         = PushLoop(compiler.Context);
            var bodyPrologue = compiler.Binary.Offset;

            loop.ContinuePoint = compiler.Binary.Offset;
            Condition.Compile(compiler);
            var bodyEpilogue = new sunJumpNotEqualSite(compiler.Binary);

            Body.Compile(compiler);
            compiler.Binary.WriteJMP(bodyPrologue);
            bodyEpilogue.Relocate();
            loop.BreakPoint = compiler.Binary.Offset;
            compiler.Context.Loops.Pop(compiler);
        }
示例#4
0
        public override void Compile(sunCompiler compiler)
        {
#if SSC_SCOPES
            compiler.Context.Scopes.Push();
#endif
            var loop = PushLoop(compiler.Context);
            TryCompile(Declaration, compiler);
            var bodyPrologue = compiler.Binary.Offset;
            TryCompile(Condition, compiler);
            var bodyEpilogue = new sunJumpNotEqualSite(compiler.Binary);
            Body.Compile(compiler);
            loop.ContinuePoint = compiler.Binary.Offset;
            TryCompile(Iteration, compiler);
            compiler.Binary.WriteJMP(bodyPrologue);
            bodyEpilogue.Relocate();
            loop.BreakPoint = compiler.Binary.Offset;
            compiler.Context.Loops.Pop(compiler);
#if SSC_SCOPES
            compiler.Context.Scopes.Pop();
#endif
        }