public InstructionViewModel(IInstruction instruction)
        {
            m_instruction = instruction;
            instruction.IsCurrentChanged += new EventHandler(IsCurrentChanged);
            m_name = instruction.Name;

            UnaryInstruction  unary  = instruction as UnaryInstruction;
            BinaryInstruction binary = instruction as BinaryInstruction;

            if (binary != null)
            {
                m_leftOperand  = binary.LeftOperand;
                m_rightOperand = binary.RightOperand;
            }
            else if (unary != null)
            {
                m_leftOperand = unary.Operand;
            }
        }
Beispiel #2
0
        private void ExecuteInstruction(IInstruction instruction)
        {
            string            name    = instruction.Name;
            Instruction       regular = instruction as Instruction;
            UnaryInstruction  unary   = instruction as UnaryInstruction;
            BinaryInstruction binary  = instruction as BinaryInstruction;

            if (binary != null)
            {
                ExecuteBinaryInstruction(binary);
            }
            else if (unary != null)
            {
            }
            else if (regular != null)
            {
            }
            else
            {
                throw new Exception("Bad instruction.");
            }
        }
Beispiel #3
0
 public override void Visit(UnaryInstruction instruction)
 {
     //TODO: very imprecise, can we do it better?
     DefaultVarTop(instruction, instruction.Result);
 }
Beispiel #4
0
 public override void Visit(UnaryInstruction instruction)
 {
     instruction.Result.Type = instruction.Operand.Type;
 }
        public void ConstructorInfoOperandEmitSucceeds()
        {
            var unaryInstruction = new UnaryInstruction(OpCodes.Newobj, typeof(Customer).GetConstructor(Type.EmptyTypes));

            unaryInstruction.Emit(_ilGenerator);
        }
        public void IntOperandEmitSucceeds()
        {
            var unaryInstruction = new UnaryInstruction(OpCodes.Ldc_I4_S, 10);

            unaryInstruction.Emit(_ilGenerator);
        }
        public void FieldInfoOperandEmitSucceeds()
        {
            var unaryInstruction = new UnaryInstruction(OpCodes.Ldfld, typeof(Customer2).GetField(nameof(Customer2.GivenName)));

            unaryInstruction.Emit(_ilGenerator);
        }
        public void TypeOperandEmitSucceeds()
        {
            var unaryInstruction = new UnaryInstruction(OpCodes.Ldobj, typeof(Customer2));

            unaryInstruction.Emit(_ilGenerator);
        }
        public void MethodInfoOperandEmitSucceeds()
        {
            var unaryInstruction = new UnaryInstruction(OpCodes.Callvirt, typeof(Customer2).GetProperty(nameof(Customer2.Age)).GetSetMethod());

            unaryInstruction.Emit(_ilGenerator);
        }
Beispiel #10
0
 public virtual void Visit(UnaryInstruction instruction)
 {
 }
 public virtual void Visit(UnaryInstruction instruction)
 {
     Default(instruction);
 }