本文整理汇总了C#中System.Compiler.Method.SetDelayedContract方法的典型用法代码示例。如果您正苦于以下问题:C# Method.SetDelayedContract方法的具体用法?C# Method.SetDelayedContract怎么用?C# Method.SetDelayedContract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Compiler.Method
的用法示例。
在下文中一共展示了Method.SetDelayedContract方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMethod
public override Method VisitMethod(Method method)
{
if (method == null) return null;
if (visitedMethods.ContainsKey(method))
return method;
base.VisitMethod(method);
method.SetDelayedContract((m, dummy) =>
{
// cleanup contracts for clousot
this.CleanupRequires(method);
this.CleanupEnsures(method);
// this.CleanupBody(method.Body);
});
return method;
}
示例2: VisitMethod
public override Method VisitMethod(Method method)
{
if (method == null) return null;
Contract.Assume(method.Template == null);
Contract.Assume(TypeNode.IsCompleteTemplate(method.DeclaringType));
if (this.contractNodes.IsObjectInvariantMethod(method))
{
ExtractInvariantsFromMethod(method);
return method;
}
if (!this.IncludeModels && HelperMethods.HasAttribute(method.Attributes, ContractNodes.ModelAttributeName))
return null;
// skip iterator movenext methods
if (HelperMethods.IsCompilerGenerated(method.DeclaringType) &&
method.Name != null && method.Name.Name == "MoveNext")
{
// generated MoveNext method, skip it.
return method;
}
// Keep track of visited methods
if (visitedMethods.ContainsKey(method))
return method;
visitedMethods.Add(method, method);
var scrubber = this.currentScrubber;
if (scrubber != null)
{
method.SetDelayedContract((m, dummy) =>
{
scrubber.VisitMethod(m);
ExtractContractsForMethod(m, dummy);
});
}
else
{
method.SetDelayedContract(ExtractContractsForMethod);
}
return method;
}