예제 #1
0
        public bool GetIsVisible(IStackFrame frame)
        {
            Contract.Requires<ArgumentNullException>(frame != null, "frame");
            Contract.Requires<VirtualMachineMismatchException>(this.GetVirtualMachine().Equals(frame.GetVirtualMachine()));

            throw new NotImplementedException();
        }
        private EvaluatedExpression GetField(EvaluatedExpression value, string name)
        {
            Contract.Requires <ArgumentNullException>(value != null, "value");
            Contract.Requires <ArgumentNullException>(name != null, "name");
            Contract.Requires <ArgumentException>(!string.IsNullOrEmpty(name));

            IArrayReference arrayValue = value.Value as IArrayReference;

            if (arrayValue != null)
            {
                if (name == "length")
                {
                    string fullName = string.Format("({0}).{1}", value.FullName, name);
                    return(new EvaluatedExpression(name, fullName, _stackFrame.GetVirtualMachine().GetMirrorOf(arrayValue.GetLength()), value.HasSideEffects));
                }
                else
                {
                    throw new InvalidOperationException();
                }
            }

            IReferenceType declaringType = value.ValueType as IReferenceType;

            if (declaringType == null)
            {
                throw new InvalidOperationException();
            }

            IField field = declaringType.GetFieldByName(name);

            if (field != null)
            {
                string fullName = string.Format("({0}).{1}", value.FullName, name);
                if (field.GetIsStatic())
                {
                    return(new EvaluatedExpression(name, fullName, null, field, declaringType.GetValue(field), value.HasSideEffects));
                }
                else
                {
                    IObjectReference objectReference = value.Value as IObjectReference;
                    if (objectReference == null)
                    {
                        throw new InvalidOperationException("Evaluation failed (todo: distinguish between null pointer and instance field referenced as a static field).");
                    }

                    return(new EvaluatedExpression(name, fullName, objectReference, field, objectReference.GetValue(field), value.HasSideEffects));
                }
            }

            throw new NotImplementedException();
        }
        public void PopFrames(IStackFrame frame)
        {
            Contract.Requires <ArgumentNullException>(frame != null, "frame");
            Contract.Requires <VirtualMachineMismatchException>(this.GetVirtualMachine().Equals(frame.GetVirtualMachine()));

            throw new NotImplementedException();
        }