Exemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////////

        public override VCExpr VisitBoogieFunctionOp(VCExprNAry node, VariableBindings bindings)
        {
            Contract.Requires((bindings != null));
            Contract.Requires((node != null));
            Contract.Ensures(Contract.Result <VCExpr>() != null);
            OpTypesPair originalOpTypes = OriginalOpTypes(node);
            OpTypesPair newOpTypes;

            if (!NewOpCache.TryGetValue(originalOpTypes, out newOpTypes))
            {
                Function /*!*/
                    oriFun = ((VCExprBoogieFunctionOp)node.Op).Func;
                Contract.Assert(oriFun != null);
                List <Type /*!*/> /*!*/
                inferredTypeArgs = new List <Type /*!*/>();
                foreach (Type /*!*/ t in node.TypeArguments)
                {
                    Contract.Assert(t != null);
//          inferredTypeArgs.Add(AxBuilder.MapTypeAbstracter.AbstractMapTypeRecursively(t));
                    inferredTypeArgs.Add(t);
                }

                VCExprOp /*!*/
                    newOp = Gen.BoogieFunctionOp(AxBuilderArguments.Typed2Untyped(oriFun));
                newOpTypes = new OpTypesPair(newOp, inferredTypeArgs);

                NewOpCache.Add(originalOpTypes, newOpTypes);
            }

            return(AssembleOpExpression(newOpTypes, node, bindings));
        }
Exemplo n.º 2
0
        private OpTypesPair TypesPairForSelectStore(VCExprNAry /*!*/ node, Function /*!*/ untypedOp,
                                                    // instantiation of the abstract map type parameters
                                                    List <Type> /*!*/ abstractionInstantiation)
        {
            Contract.Requires(node != null);
            Contract.Requires(untypedOp != null);
            Contract.Requires(abstractionInstantiation != null);

            List <Type /*!*/> /*!*/
            inferredTypeArgs = new List <Type /*!*/>();

            foreach (Type /*!*/ t in node.TypeArguments)
            {
                Contract.Assert(t != null);
//        inferredTypeArgs.Add(AxBuilder.MapTypeAbstracter.AbstractMapTypeRecursively(t));
                inferredTypeArgs.Add(t);
            }

            foreach (Type /*!*/ t in abstractionInstantiation)
            {
                Contract.Assert(t != null);
                inferredTypeArgs.Add(t);
            }

            Contract.Assert(untypedOp.InParams.Count == inferredTypeArgs.Count + node.Arity);
            return(new OpTypesPair(Gen.BoogieFunctionOp(untypedOp), inferredTypeArgs));
        }