コード例 #1
0
 static Block GetSwitchTarget(IList <Block> targets, Block fallThrough, Value value)
 {
     if (!value.IsInt32())
     {
         return(null);
     }
     return(CflowUtils.GetSwitchTarget(targets, fallThrough, (Int32Value)value));
 }
コード例 #2
0
        Block GetTarget(Block switchBlock)
        {
            var val1 = instructionEmulator.Pop();

            if (!val1.IsInt32())
            {
                return(null);
            }
            return(CflowUtils.GetSwitchTarget(switchBlock.Targets, switchBlock.FallThrough, (Int32Value)val1));
        }
コード例 #3
0
        bool IBranchHandler.HandleSwitch(Int32Value switchIndex)
        {
            var target = CflowUtils.GetSwitchTarget(block.Targets, block.FallThrough, switchIndex);

            if (target == null)
            {
                return(false);
            }

            PopPushedArgs(1);
            block.ReplaceSwitchWithBranch(target);
            return(true);
        }