Beispiel #1
0
            public IEnumerable <Constant> GetConstants(Instruction instruction, IVariable var)
            {
                if (!ConstantPropagationSetAnalysis.IsConstantType(var.Type, host))
                {
                    return(null);
                }

                var domain    = info[instruction];
                var varDomain = domain.Constants(var);

                if (varDomain.IsTop)
                {
                    return(null);
                }
                if (varDomain.IsBottom)
                {
                    return(new HashSet <Constant>());
                }

                return(new HashSet <Constant>(varDomain.Elements));
            }
Beispiel #2
0
            public IEnumerable <Constant> GetConstants(Instruction instruction, IFieldAccess field)
            {
                if (!ConstantPropagationSetAnalysis.IsConstantType(field.Type, host))
                {
                    return(null);
                }

                var domain      = info[instruction];
                var fieldDomain = domain.Constants(field);

                if (fieldDomain.IsTop)
                {
                    return(null);
                }
                if (fieldDomain.IsBottom)
                {
                    return(new HashSet <Constant>());
                }

                return(new HashSet <Constant>(fieldDomain.Elements));
            }
Beispiel #3
0
 private bool IsConstantType(ITypeReference tref)
 {
     return(ConstantPropagationSetAnalysis.IsConstantType(tref, parent.Host));
 }