protected override void VisitStoreFieldInstruction(StoreFieldInstruction instruction)
        {
            ControlState.EvaluationStack.PopValue(_program, instruction.FieldType, out var value);
            ControlState.EvaluationStack.PopValue(_program, instruction.ClassTypeSpec.GetCilType(_program), out var instanceVal);

            CilClassInstance classInstance = null;

            if (instanceVal is CilValueValueType instanceValValueType)
            {
                classInstance = instanceValValueType.Value;
            }
            else if (instanceVal is CilValueReference instanceValReference)
            {
                classInstance = ManagedMemory.Load(instanceValReference) as CilClassInstance;
            }
            else
            {
                throw new System.NotImplementedException();
            }

            classInstance.Fields[instruction.FieldId] = value;

            ControlState.MoveToNextInstruction();
        }
Esempio n. 2
0
 protected abstract void VisitStoreFieldInstruction(StoreFieldInstruction instruction);