本文整理汇总了C#中IMethodDefinition.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodDefinition.ToString方法的具体用法?C# IMethodDefinition.ToString怎么用?C# IMethodDefinition.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodDefinition
的用法示例。
在下文中一共展示了IMethodDefinition.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MethodIdentifier
public MethodIdentifier(IMethodDefinition method)
: base(method.ContainingTypeDefinition as INamedTypeDefinition)
{
_methodSignature = method.ToString();
}
示例2: GetMethodSignature
private static string GetMethodSignature(IMethodDefinition pDefinition)
{
// TODO: Fix for ByReference parameters that may make this not unique
return pDefinition.ToString();
}
示例3: GlobalPolyVerifcationRsd
protected void GlobalPolyVerifcationRsd(IMethodDefinition method, InstrumentationInformation instrInfo, string type, string name, GlobalPolyInfo polyInfo)
{
var methodStatements = ((BasicBlock)((Microsoft.Cci.ILToCodeModel.SourceMethodBody)method.Body).Block).Statements;
var int32Type = _host.PlatformType.SystemInt32;
var rsdField = GetRsdField(method, name, type);
if (polyInfo.AllContractsRequiredAvailable)
{
var candPolys = new List<string>();
var conds = new List<string>();
conds.AddRange(GetMethodRequiresExprs(method));
foreach (var poly in polyInfo.DirectQuantityLoops)
{
candPolys.Add(poly.Poly);
conds.Add(poly.Cond);
}
foreach (var poly in polyInfo.QuantityTransferLoops)
{
candPolys.Add(poly.Poly);
conds.Add(poly.Cond);
}
if (polyInfo.DirectQuantity > 0)
{
candPolys.Add(polyInfo.DirectQuantity.ToString());
}
candPolys.AddRange(polyInfo.QuantityTransfer);
if (candPolys.Count > 0)
{
var candPoly = string.Join(" + ", candPolys);
//find rsd contracts for the type and compare with candPoly
var methodName = method.ToString();
if (_memoryContractsInformation.MethodsRsdContractsWithConds.ContainsKey(methodName))
{
var methodRsdContracts = _memoryContractsInformation.MethodsRsdContractsWithConds[methodName];
//methodName -> rsd name -> type of rsd -> cond -> contract (string expr + code model expr)
//public Dictionary<string, Dictionary<string, Dictionary<ITypeReference, Dictionary<string, Tuple<string, IExpression>>>>> MethodsRsdContractsWithConds = new Dictionary<string, Dictionary<string, Dictionary<ITypeReference, Dictionary<string, Tuple<string, IExpression>>>>>();
foreach (var rsdName in methodRsdContracts.Keys)
{
foreach (var rsdType in methodRsdContracts[rsdName].Keys)
{
if (rsdName == name && rsdType.ToString() == type)
{
foreach (var contractCond in methodRsdContracts[rsdName][rsdType].Keys)
{
var methodContract = methodRsdContracts[rsdName][rsdType][contractCond].Item1;
var methodContractExpressionObject = methodRsdContracts[rsdName][rsdType][contractCond].Item2;
//see if candPoly <= methodContract
string cond;
var newConds = new List<string>();
newConds.AddRange(conds);
if (contractCond != "true")
{
newConds.Add(contractCond);
}
if (PolytopesCalculator.LowerOrEqual(candPoly, methodContract, newConds, GetMethodFreeVars(method), out cond))
{
//insert the statement: if (cond) Contract.Assume(candPoly <= methodContract);
var condExpr = ExpressionGenerator.GenerateExpressionFromString(cond, _host, method);
if (condExpr != null)
{
InsertStatementAtBottom(methodStatements,
new ConditionalStatement()
{
Condition = condExpr,
TrueBranch =
new AssumeStatement()
{
Condition =
new LessThanOrEqual()
{
LeftOperand = new BoundExpression()
{
Definition = rsdField,
Type = rsdField.Type
},
RightOperand = methodContractExpressionObject,
Type = _host.PlatformType.SystemBoolean,
}
},
FalseBranch = new EmptyStatement()
});
}
}
}
}
}
}
}
}
}
}