Example #1
0
        private LispList <Pair <EdgeTag, Subroutine> > InsertInvariant(CFGBlock from, LispList <Pair <EdgeTag, Subroutine> > list,
                                                                       Method calledMethod, ref TypeNode type,
                                                                       LispList <Edge <CFGBlock, EdgeTag> > context)
        {
            IMetaDataProvider metadataDecoder = this.SubroutineFacade.MetaDataProvider;

            Property property;

            if (metadataDecoder.IsPropertySetter(calledMethod, out property) &&
                (metadataDecoder.IsAutoPropertyMember(calledMethod) || WithinConstructor(from, context)))
            {
                return(list);
            }

            if (metadataDecoder.IsConstructor(calledMethod))
            {
                type = metadataDecoder.DeclaringType(calledMethod);
            }

            Subroutine invariant = this.SubroutineFacade.GetInvariant(type);

            if (invariant != null)
            {
                var methodCallBlock = from as MethodCallBlock <Label>;
                if (methodCallBlock != null)
                {
                    EdgeTag first = methodCallBlock.IsNewObj ? EdgeTag.AfterNewObj : EdgeTag.AfterCall;
                    return(list.Cons(new Pair <EdgeTag, Subroutine> (first, invariant)));
                }
            }

            return(list);
        }