本文整理汇总了C#中Mono.Cecil.Cil.VariableReference.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# VariableReference.Resolve方法的具体用法?C# VariableReference.Resolve怎么用?C# VariableReference.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.Cil.VariableReference
的用法示例。
在下文中一共展示了VariableReference.Resolve方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsStackVariable
private bool IsStackVariable(VariableReference varRef)
{
return methodContext.StackData.VariableToDefineUseInfo.ContainsKey(varRef.Resolve());
}
示例2: GetVariableName
protected string GetVariableName(VariableReference variable)
{
VariableDefinition variableDefinition = variable.Resolve();
string result;
if (!GetCurrentMethodContext().VariableDefinitionToNameMap.TryGetValue(variableDefinition, out result))
{
result = variableDefinition.Name;
}
return result;
}
示例3: RemoveVariable
public void RemoveVariable (VariableReference reference)
{
RemoveVariable (reference.Resolve ());
}
示例4: TryResolve
/// <summary>
/// A cecil variable reference will be directed to this method.
/// </summary>
/// <param name="item">Cecil reference.</param>
/// <param name="resolvedItem">Output parameter that will be populated with the resolved cecil definition.</param>
/// <returns><c>true</c></returns>
private static bool TryResolve(VariableReference item, out object resolvedItem)
{
resolvedItem = item.Resolve();
return true;
}
示例5: IsTempVariable
private bool IsTempVariable(VariableReference variable)
{
var name = methodContext.VariableDefinitionToNameMap[variable.Resolve()];
if (name.StartsWith("CS$") ||
name.StartsWith("VB$") ||
name.IndexOf("__init") > 0 ||
name.StartsWith("stackVariable") ||
name.StartsWith("exception_"))
{
return true;
}
return false;
}
示例6: RemoveVariable
internal void RemoveVariable(VariableReference reference)
{
RemoveVariable(reference.Resolve());
}
示例7: GetIdentifierReference
private Expression GetIdentifierReference(VariableReference identifierReference, ref Expression target)
{
MethodInvocationExpression targetInvocation = target as MethodInvocationExpression;
if (targetInvocation != null && targetInvocation.MethodExpression.MethodDefinition != null &&
targetInvocation.MethodExpression.MethodDefinition.IsStatic &&
(targetInvocation.MethodExpression.MethodDefinition.DeclaringType.FullName == "System.Linq.Enumerable" ||
targetInvocation.MethodExpression.MethodDefinition.DeclaringType.FullName == "System.Linq.Queryable") &&
targetInvocation.MethodExpression.Method.Name == "Cast")
{
target = targetInvocation.Arguments[0];
methodContext.UndeclaredLinqVariables.Remove(identifierReference.Resolve());
return new VariableDeclarationExpression(identifierReference.Resolve(), null);
}
return new VariableReferenceExpression(identifierReference, null);
}