Exemple #1
0
        public static BTType[] GetObjectFieldBTTypes(NewObject upNode)
        {
            ReferenceBTValue obj = AnnotatingVisitor.GetNewBTValue(upNode);
            FieldInfo[] fldInfos = ReflectionUtils.GetAllFields(upNode.Constructor.DeclaringType);
            BTType[] btTypes = new BTType[fldInfos.Length];
            for (int i = 0; i < btTypes.Length; i++)
                btTypes[i] = obj[fldInfos[i]].BTType;

            return btTypes;
        }
Exemple #2
0
 public override Node Clone()
 {
     NewObject clone = new NewObject(Constructor);
     clone.Options.CopyFrom(Options);
     return(clone);
 }
Exemple #3
0
        protected override void VisitNewObject(NewObject node, object data)
        {
            ParameterValues paramVals =
                state.Stack.Perform_CreateObject(node.Constructor);

            Exception exc = null;

            if (holder.ContainsMethodBody(paramVals.Method))
                InterpretMethod(holder,holder[paramVals.Method],paramVals,out exc,indent+"    ");
            else
                paramVals.Invoke(out exc);

            if (exc == null)
                AddTask(node.Next);
            else
                HandleException(node,exc);
        }
Exemple #4
0
 protected internal override void VisitNewObject(NewObject node, object data)
 {
     StackTypes stack = data as StackTypes;
     Verifier.ProcessCallOrNewobj(node.CtorWithParams, stack, true);
     AddTask(node.Next,stack);
 }
Exemple #5
0
 protected internal virtual void VisitNewObject(NewObject node, object data)
 {
     throw new NodeNotSupportedException(node);
 }
Exemple #6
0
        protected override void VisitNewObject(NewObject downNode, object o)
        {
            PointerToNode ptrUpNode = (o as Data).PointerToNode;
            AnnotatedMethod method = Annotation.GetAnnotatedMethod(downNode);

            Node upNode;
            ArrayList list = new ArrayList();
            for (int i = method.ParamVals.Count - 1; i > 0; i--)
                if (Annotation.GetValueBTType(method.ParamVals[i].Val) == BTType.Static)
                    list.Add(this.state.Stack.Pop());
            if (Annotation.GetValueBTType(method.ParamVals[0].Val) == BTType.Static)
            {
                Type objtype = downNode.Constructor.DeclaringType;
                ObjectReferenceValue obj = new ObjectReferenceValue(FormatterServices.GetUninitializedObject(objtype));
                FieldInfo[] fldInfos = ReflectionUtils.GetAllFields(objtype);
                BTType[] btTypes = Annotation.GetObjectFieldBTTypes(downNode);
                for (int i = 0; i < fldInfos.Length; i++)
                    if (btTypes[i] == BTType.Dynamic)
                    {
                        Variable varUp = this.mbbUp.Variables.CreateVar(fldInfos[i].FieldType, VariableKind.Local);
                        this.varsHash[new PointerToObjectFieldValue(obj.Obj, fldInfos[i])] = varUp;
                        ptrUpNode = SpecializingVisitor.initVariable(varUp, ptrUpNode);
                    }
                list.Add(obj);
                this.state.Stack.Push(obj);
                upNode = new CallMethod(downNode.Constructor, false, false);
            }
            else
                upNode = new NewObject(downNode.Constructor);
            list.Reverse();
            Value[] args = list.ToArray(typeof(Value)) as Value[];

            this.callMethod(downNode, method, ptrUpNode, upNode, args);
        }
Exemple #7
0
        protected override void VisitNewObject(NewObject upNode, object o)
        {
            State state = o as State;
            ReferenceBTValue obj = AnnotatingVisitor.GetNewBTValue(upNode);
            if (obj == null)
            {
                obj = new ReferenceBTValue(upNode.Constructor.DeclaringType, BTType.Static);
                AnnotatingVisitor.setNewBTValue(upNode, obj);
                obj.Creators[this].AddCreator(upNode);
            }
            ParameterValues paramVals = state.Stack.Perform_CreateObject(upNode.Constructor, obj);
            AnnotatingVisitor.patchUpParamVals(paramVals);

            this.callMethod(upNode, paramVals, null, false);
            state.Stack.Push(obj);
        }
Exemple #8
0
 protected override void VisitNewObject(NewObject upNode, object o)
 {
     DepthContainer cnt = o as DepthContainer;
     cnt.Depth += ParameterValues.GetParametersNumber(upNode.Constructor) - 2;
 }
Exemple #9
0
 protected internal override void VisitNewObject(NewObject node, object data)
 {
     if(HasPseudoParameter(node))
         generator.Emit(OpCodes.Ldnull);
     generator.Emit(OpCodes.Newobj, node.Constructor);
     AddTask(node.Next,null);
 }