public static MethodRegressionOutcomes GetOutcomes <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(Method method, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder) { if (mdDecoder.GetMethodHashAttributeFlags(method).HasFlag(MethodHashAttributeFlags.IgnoreRegression)) { return(new IgnoreRegressionOutcomes()); } var outcomes = new Set <string>(); foreach (Attribute attr in mdDecoder.GetAttributes(method)) { var attrType = mdDecoder.AttributeType(attr); if (mdDecoder.Name(attrType) != "RegressionOutcomeAttribute") { continue; } var posArgs = mdDecoder.PositionalArguments(attr); if (posArgs.Count == 0) { var outcome = (ProofOutcome)(byte)GetNamedArgOrDefault <int, Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(mdDecoder, "Outcome", attr); // at some places we have "this.x" instead of "x", both should be treated equal. string msg = ((string)mdDecoder.NamedArgument("Message", attr)).Replace("this.", string.Empty); int primaryOffset = GetNamedArgOrDefault <int, Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(mdDecoder, "PrimaryILOffset", attr); int methodOffset = GetNamedArgOrDefault <int, Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(mdDecoder, "MethodILOffset", attr); outcomes.Add(CanonicalFormat(outcome, msg, primaryOffset, methodOffset)); } else { outcomes.Add((string)posArgs[0]); } } return(new MethodRegressionOutcomes(outcomes)); }
public static bool MethodHashAttributeFirstInOrder <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>( this IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> metaDataDecoder, Method method) { Contract.Requires(metaDataDecoder != null); return(metaDataDecoder.GetMethodHashAttributeFlags(method).HasFlag(MethodHashAttributeFlags.FirstInOrder)); }
public static int GetReanalyisCountIfAny <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(Method method, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder) { if (mdDecoder.GetMethodHashAttributeFlags(method).HasFlag(MethodHashAttributeFlags.IgnoreRegression)) { return(0); } foreach (Attribute attr in mdDecoder.GetAttributes(method)) { Type attrType = mdDecoder.AttributeType(attr); if (mdDecoder.Name(attrType) != "RegressionReanalysisCountAttribute") { continue; } var posArgs = mdDecoder.PositionalArguments(attr); if (posArgs.Count != 0) { return((int)posArgs[0]); } } return(0); }