private void AnalyzeMethod(Method method, Dictionary <string, ICollection <string> > proofResults) { IMetaDataProvider metadataDecoder = this.analysis_driver.MetaDataProvider; if (!metadataDecoder.HasBody(method)) { return; } if (this.options.Method != null && !metadataDecoder.FullName(method).Contains(this.options.Method)) { return; } var results = new List <string> (); proofResults.Add(method.FullName, results); try { AnalyzeMethodInternal(method, results); } catch (Exception e) { results.Add("Exception: " + e.Message); return; } results.Add(string.Format("Checked {0} assertions", results.Count)); }
public override bool TrySetType(TypeNode expectedType, IMetaDataProvider metaDataProvider, out TypeNode resultType) { if (typeof(T) == typeof(Parameter)) { var p = (Parameter)(object)this.Element; TypeNode type = metaDataProvider.ParameterType(p); this.isManagedPointer = metaDataProvider.IsManagedPointer(type); ResultType = resultType = metaDataProvider.ManagedPointer(type); return(true); } if (typeof(T) == typeof(Field)) { var f = (Field)(object)this.Element; TypeNode type = metaDataProvider.FieldType(f); this.isStatic = metaDataProvider.IsStatic(f); this.isManagedPointer = metaDataProvider.IsManagedPointer(type); ResultType = resultType = metaDataProvider.ManagedPointer(type); TypeNode declaringType = metaDataProvider.DeclaringType(f); if (metaDataProvider.IsManagedPointer(expectedType)) { expectedType = metaDataProvider.ElementType(expectedType); } expectedType = metaDataProvider.Unspecialized(expectedType); if (!metaDataProvider.IsStatic(f) && declaringType.Equals(expectedType) && (!metaDataProvider.DerivesFrom(expectedType, declaringType) || !metaDataProvider.IsProtected(f) && !metaDataProvider.IsPublic(f))) { this.castTo = metaDataProvider.FullName(declaringType); } return(true); } if (typeof(T) == typeof(Local)) { var local = (Local)(object)this.Element; TypeNode type = metaDataProvider.LocalType(local); this.isManagedPointer = metaDataProvider.IsManagedPointer(type); ResultType = resultType = metaDataProvider.ManagedPointer(type); return(true); } if (typeof(T) == typeof(Method)) { var method = (Method)(object)this.Element; ResultType = resultType = !IsAddressOf ? metaDataProvider.ReturnType(method) : metaDataProvider.ManagedPointer(metaDataProvider.ReturnType(method)); if (metaDataProvider.IsManagedPointer(expectedType)) { expectedType = metaDataProvider.ElementType(expectedType); } expectedType = metaDataProvider.Unspecialized(expectedType); TypeNode declaringType = metaDataProvider.DeclaringType(method); if (!metaDataProvider.IsStatic(method) && declaringType.Equals(expectedType) && (!metaDataProvider.DerivesFrom(expectedType, declaringType) || !metaDataProvider.IsProtected(method) && !metaDataProvider.IsPublic(method))) { this.castTo = metaDataProvider.FullName(declaringType); } return(true); } ResultType = resultType = default(TypeNode); return(false); }