Exemple #1
0
        public override CodeNode VisitSkipAssignmentIfFlagSet(SkipAssignmentIfFlagSetNode node)
        {
            if (!_InFieldAssignment)
            {
                throw new InvalidOperationException("SkipAssignmentIfFlagSetNode must be in a FieldAssignmentNode");
            }
            //get the flag field
            LocalBuilder flag = _FieldLocals[node.FlagFieldIndex];

            //TODO: assert that it's a byte?
            ILGen.Ldloc(flag);
            ILGen.Ldc_I4_S(node.FlagMask);
            ILGen.And();
            //skip assignment if the flag is set
            ILGen.Brtrue(_SkipAssignmentLabel);
            return(node);
        }