예제 #1
0
        private void EmitCondBranchForSwitch(ILOpCode branchCode, ConstantValue constant, object targetLabel)
        {
            Debug.Assert(branchCode.IsBranchToLabel());
            Debug.Assert(constant != null &&
                         SwitchConstantValueHelper.IsValidSwitchCaseLabelConstant(constant));
            Debug.Assert(targetLabel != null);

            // ldloc key
            // ldc constant
            // branch branchCode targetLabel

            _builder.EmitLoad(_key);
            _builder.EmitConstantValue(constant);
            _builder.EmitBranch(branchCode, targetLabel, GetReverseBranchCode(branchCode));
        }