コード例 #1
0
ファイル: AbsyQuant.cs プロジェクト: amaurremi/boogie
        public override void Resolve(ResolutionContext rc)
        {
            //Contract.Requires(rc != null);

            if (Dummies.Count != Rhss.Count)
            {
                rc.Error(this.tok, "number of left-hand sides does not match number of right-hand sides");
            }

            foreach (var e in Rhss)
            {
                e.Resolve(rc);
            }

            rc.PushVarContext();
            foreach (var v in Dummies)
            {
                Contract.Assert(v != null);
                v.Register(rc);
                v.Resolve(rc);
            }
            for (QKeyValue kv = this.Attributes; kv != null; kv = kv.Next)
            {
                kv.Resolve(rc);
            }
            Body.Resolve(rc);
            rc.PopVarContext();
        }
コード例 #2
0
        public override void Resolve(ResolutionContext rc)
        {
            //Contract.Requires(rc != null);
            if (rc.TriggerMode)
            {
                rc.Error(this, "quantifiers are not allowed in triggers");
            }

            int previousTypeBinderState = rc.TypeBinderState;

            try
            {
                foreach (TypeVariable /*!*/ v in TypeParameters)
                {
                    Contract.Assert(v != null);
                    rc.AddTypeBinder(v);
                }

                rc.PushVarContext();
                foreach (Variable /*!*/ v in Dummies)
                {
                    Contract.Assert(v != null);
                    v.Register(rc);
                    v.Resolve(rc);
                }

                for (QKeyValue kv = this.Attributes; kv != null; kv = kv.Next)
                {
                    kv.Resolve(rc);
                }

                this.ResolveTriggers(rc);
                Body.Resolve(rc);
                rc.PopVarContext();

                // establish a canonical order of the type parameters
                this.TypeParameters = Type.SortTypeParams(TypeParameters,
                                                          new List <Type>(Dummies.Select(Item => Item.TypedIdent.Type).ToArray()), null);
            }
            finally
            {
                rc.TypeBinderState = previousTypeBinderState;
            }
        }