示例#1
0
 protected MethodContractSubroutine(SubroutineFacade subroutineFacade,
                                    Method method,
                                    SimpleSubroutineBuilder <Label> builder,
                                    Label startLabel) : base(subroutineFacade, startLabel, builder)
 {
     this.method = method;
 }
示例#2
0
 protected SubroutineBase(SubroutineFacade subroutineFacade)
 {
     this.SubroutineFacade = subroutineFacade;
     this.entry            = new EntryBlock <Label> (this, ref this.BlockIdGenerator);
     this.exit             = new EntryExitBlock <Label> (this, ref this.BlockIdGenerator);
     this.exception_exit   = new CatchFilterEntryBlock <Label> (this, ref this.BlockIdGenerator);
 }
示例#3
0
 public EnsuresSubroutine(SubroutineFacade subroutineFacade,
                          Method method, IImmutableSet <Subroutine> inherited) : base(subroutineFacade, method)
 {
     this.inferred_old_label_reverse_map = new Dictionary <int, Pair <CFGBlock, TypeNode> > ();
     AddSuccessor(Entry, EdgeTag.Entry, Exit);
     AddBaseEnsures(Entry, Exit, inherited);
     Commit();
 }
示例#4
0
 public EnsuresSubroutine(SubroutineFacade subroutineFacade,
                          Method method,
                          SimpleSubroutineBuilder <Label> builder, Label startLabel, IImmutableSet <Subroutine> inherited)
     : base(subroutineFacade, method, builder, startLabel)
 {
     this.inferred_old_label_reverse_map = new Dictionary <int, Pair <CFGBlock, TypeNode> > ();
     AddBaseEnsures(Entry, GetTargetBlock(startLabel), inherited);
 }
示例#5
0
 public SimpleSubroutine(int stackDelta, SubroutineFacade subroutineFacade,
                         Label startLabel, SimpleSubroutineBuilder <Label> builder)
     : base(subroutineFacade, startLabel, builder)
 {
     this.stack_delta = stackDelta;
     builder.BuildBlocks(startLabel, this);
     Commit();
 }
示例#6
0
 public RequiresSubroutine(SubroutineFacade subroutineFacade,
                           Method method,
                           SimpleSubroutineBuilder <TLabel> builder,
                           TLabel entryLabel,
                           IImmutableSet <Subroutine> inheritedRequires)
     : base(subroutineFacade, method, builder, entryLabel)
 {
     AddBaseRequires(this.GetTargetBlock(entryLabel), inheritedRequires);
 }
示例#7
0
 public RequiresSubroutine(SubroutineFacade subroutineFacade,
                           Method method,
                           IImmutableSet <Subroutine> inherited)
     : base(subroutineFacade, method)
 {
     AddSuccessor(Entry, EdgeTag.Entry, Exit);
     AddBaseRequires(Exit, inherited);
     Commit();
 }
示例#8
0
        protected SubroutineBase(SubroutineFacade SubroutineFacade,
                                 Label startLabel, SubroutineBuilder <Label> builder)
            : this(SubroutineFacade)
        {
            this.StartLabel           = startLabel;
            Builder                   = builder;
            CodeProvider              = builder.CodeProvider;
            this.entry_after_requires = GetTargetBlock(startLabel);

            AddSuccessor(this.entry, EdgeTag.Entry, this.entry_after_requires);
        }
示例#9
0
        public MethodSubroutine(SubroutineFacade SubroutineFacade,
                                Method method, Label startLabel,
                                SubroutineWithHandlersBuilder <Label, Handler> builder) : base(SubroutineFacade, startLabel, builder)
        {
            this.method = method;
            IMetaDataProvider metaDataProvider = this.SubroutineFacade.MetaDataProvider;

            builder.BuildBlocks(startLabel, this);
            BlockWithLabels <Label> targetBlock = GetTargetBlock(startLabel);

            Commit();

            TypeNode   type      = metaDataProvider.DeclaringType(method);
            Subroutine invariant = this.SubroutineFacade.GetInvariant(type);

            if (invariant != null && !metaDataProvider.IsConstructor(method) && !metaDataProvider.IsStatic(method))
            {
                AddEdgeSubroutine(Entry, targetBlock, invariant, EdgeTag.Entry);
                Subroutine requires = this.SubroutineFacade.GetRequires(method);
                if (requires != null)
                {
                    AddEdgeSubroutine(Entry, targetBlock, requires, EdgeTag.Entry);
                }
            }
            else
            {
                AddEdgeSubroutine(Entry, targetBlock, this.SubroutineFacade.GetRequires(method), EdgeTag.Entry);
            }

            if (this.blocks_ending_in_return_point == null)
            {
                return;
            }

            Subroutine ensures = this.SubroutineFacade.GetEnsures(method);
            bool       putInvariantAfterExit = !metaDataProvider.IsStatic(method) &&
                                               !metaDataProvider.IsFinalizer(method) && !metaDataProvider.IsDispose(method);

            foreach (var block in this.blocks_ending_in_return_point)
            {
                if (putInvariantAfterExit)
                {
                    AddEdgeSubroutine(block, Exit, invariant, EdgeTag.Exit);
                }
                AddEdgeSubroutine(block, Exit, ensures, EdgeTag.Exit);
            }

            if (ensures != null)
            {
                throw new NotImplementedException();
            }

            this.blocks_ending_in_return_point = null;
        }
 protected FaultFinallySubroutineBase(SubroutineFacade subroutineFacade, Label startLabel, SubroutineBuilder <Label> builder)
     : base(subroutineFacade, startLabel, builder)
 {
 }
示例#11
0
 protected MethodContractSubroutine(SubroutineFacade subroutineFacade,
                                    Method method) : base(subroutineFacade)
 {
     this.method = method;
 }
示例#12
0
 public MethodSubroutine(SubroutineFacade subroutineFacade, Method method)
     : base(subroutineFacade)
 {
     this.method = method;
 }
示例#13
0
 public OldValueSubroutine(SubroutineFacade subroutineFacade, Method method,
                           SimpleSubroutineBuilder <TLabel> builder, TLabel startLabel)
     : base(subroutineFacade, method, builder, startLabel)
 {
 }
示例#14
0
 protected SubroutineWithHandlers(SubroutineFacade subroutineFacade,
                                  Label startLabel,
                                  SubroutineBuilder <Label> builder)
     : base(subroutineFacade, startLabel, builder)
 {
 }
示例#15
0
 protected SubroutineWithHandlers(SubroutineFacade subroutineFacade)
     : base(subroutineFacade)
 {
 }
示例#16
0
 public FaultSubroutine(SubroutineFacade subroutineFacade, Label startLabel,
                        SubroutineBuilder <Label> builder) : base(subroutineFacade, startLabel, builder)
 {
 }