Ejemplo n.º 1
0
        private IImmutableSet <Subroutine> GetInheritedRequires(Method method)
        {
            IImmutableSet <Subroutine> result = ImmutableSet <Subroutine> .Empty();

            if (MetaDataProvider.IsVirtual(method) && ContractProvider.CanInheritContracts(method))
            {
                Method rootMethod;
                if (MetaDataProvider.TryGetRootMethod(method, out rootMethod))
                {
                    Subroutine sub = Get(MetaDataProvider.Unspecialized(method));
                    if (sub != null)
                    {
                        result = result.Add(sub);
                    }
                }
                foreach (Method implMethod in MetaDataProvider.ImplementedMethods(method))
                {
                    Subroutine sub = Get(MetaDataProvider.Unspecialized(implMethod));
                    if (sub != null)
                    {
                        result = result.Add(sub);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        private IImmutableSet <Subroutine> GetInheritedEnsures(Method method)
        {
            IImmutableSet <Subroutine> result = ImmutableSet <Subroutine> .Empty();

            if (MetaDataProvider.IsVirtual(method) && ContractProvider.CanInheritContracts(method))
            {
                foreach (Method implementedMethod in MetaDataProvider.OverridenAndImplementedMethods(method))
                {
                    Subroutine subroutine = Get(MetaDataProvider.Unspecialized(implementedMethod));
                    if (subroutine != null)
                    {
                        result = result.Add(subroutine);
                    }
                }
            }
            return(result);
        }