private bool UnderAnalysis(Method method) { if (assembliesUnderAnalysis.Contains(md.DeclaringModuleName(md.DeclaringType(method)))) { return(true); } return(false); }
static MethodDefinitionName Translate <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(Method method, IOutput output, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder) { Type declaringType = mdDecoder.DeclaringType(method); TypeDefinitionName tdefName = Translate(declaringType, output, mdDecoder); TypeName resultTdefName = TranslateToTypeName(mdDecoder.ReturnType(method), output, mdDecoder); ParameterDefinitionName[] argTdefNames = Translate(mdDecoder.Parameters(method), method, output, mdDecoder); var name = mdDecoder.Name(method); if (name == "Finalize") { name = "~" + mdDecoder.Name(declaringType).Split(new char[] { '`' }, 2)[0]; } return(MethodDefinitionName.FromTypeMethod(0, tdefName, mdDecoder.IsStatic(method), name, null, resultTdefName, argTdefNames)); }
public override Domain Newobj <ArgList>(APC pc, Method ctor, Variable dest, ArgList args, Domain data) { IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> decoder = this.methodDriver.MetaDataDecoder; string fullName = decoder.FullName(ctor); Type enumerableType = decoder.DeclaringType(ctor); Debug.Assert(enumerableType != null); foreach (Method m in decoder.Methods(enumerableType)) { if (decoder.Name(m) == "MoveNext") { this.moveNext = m; this.fieldsHold = FunctionalMap <string, int> .Empty; // DebugHelper.WriteLine("Find the desired MoveNext Method:{0}", m); break; } } return(base.Newobj <ArgList>(pc, ctor, dest, args, data)); }
public static string CanonicalMethodName(Method method, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> decoder) { StringBuilder sb = new StringBuilder(); CanonicalTypeDefName(decoder.DeclaringType(method), sb, decoder); sb.AppendFormat(".{0}(", decoder.Name(method)); var parameters = decoder.Parameters(method); for (int i = 0; i < parameters.Count; i++) { Type parameterType = decoder.ParameterType(parameters[i]); CanonicalTypeRefName(parameterType, sb, decoder); if (i < parameters.Count - 1) { sb.Append(','); } } sb.Append(')'); return(sb.ToString()); }
internal static MaskedWarnings GetMaskedWarningsFor(Set <string> mask, Method method, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder) { Contract.Requires(mask != null); Contract.Requires(mdDecoder != null); Contract.Ensures(Contract.Result <MaskedWarnings>() != null); // Add Type attributes var typeAttrib = mdDecoder.GetAttributes(mdDecoder.DeclaringType(method)); Contract.Assume(typeAttrib != null); foreach (var attrib in typeAttrib) { string dummy; TryAddAttribute(mask, attrib, mdDecoder, out dummy); } // Save the mask for the warnings as we use it later var methodMask = new Set <string>(); // Add Method attributes var methodAttrib = mdDecoder.GetAttributes(method); Contract.Assume(methodAttrib != null); foreach (var attrib in methodAttrib) { string attribName; if (TryAddAttribute(mask, attrib, mdDecoder, out attribName)) { methodMask.Add(attribName); } } Contract.Assume(methodMask.Count <= mask.Count); return(new MaskedWarnings(mask, methodMask)); }