public ScrubContractClass(ExtractorVisitor parent, Class contractClass, TypeNode originalType)
        {
            Contract.Requires(TypeNode.IsCompleteTemplate(contractClass));
            Contract.Requires(TypeNode.IsCompleteTemplate(originalType));

            this.parent = parent;
            this.contractClass = contractClass;
            this.abstractClass = originalType;
        }
示例#2
0
 private AutoPropFinder(ExtractorVisitor parent, TypeNode containingType, Expression invariantCondition)
 {
     this.parent = parent;
     this.containingType = HelperMethods.Unspecialize(containingType);
     this.invariantCondition = invariantCondition;
 }
示例#3
0
            public static List<Property> FindAutoProperty(ExtractorVisitor parent, TypeNode containingType,
                Expression expression, out List<Member> referencedMembers)
            {
                var v = new AutoPropFinder(parent, containingType, expression);
                v.VisitExpression(expression);

                referencedMembers = v.referencedMembers;
                return v.foundAutoProperties;
            }
示例#4
0
            public static void Transform(ExtractorVisitor parent, Property autoProp, Invariant invariant,
                out Requires req, out Ensures ens)
            {
                var makeReq = new ChangePropertyInvariantIntoRequiresEnsures(parent, autoProp);
                req = makeReq.MakeRequires(invariant.Condition);

                var makeEns = new ChangePropertyInvariantIntoRequiresEnsures(parent, autoProp);
                ens = makeEns.MakeEnsures(invariant.Condition);

                ens.SourceContext = invariant.SourceContext;
                ens.PostCondition.SourceContext = ens.SourceContext;
                ens.ILOffset = invariant.ILOffset;

                if (ens.SourceConditionText == null)
                {
                    ens.SourceConditionText = invariant.SourceConditionText;
                }

                req.SourceContext = invariant.SourceContext;
                req.Condition.SourceContext = req.SourceContext;
                req.ILOffset = invariant.ILOffset;

                if (req.SourceConditionText == null)
                {
                    req.SourceConditionText = invariant.SourceConditionText;
                }
            }
示例#5
0
 private ChangePropertyInvariantIntoRequiresEnsures(ExtractorVisitor parent, Property autoProp)
     : base(autoProp.DeclaringType.DeclaringModule, autoProp.DeclaringType)
 {
     this.autoProp = autoProp;
     this.parent = parent;
 }