本文整理汇总了C#中MemberReferenceExpression.Annotation方法的典型用法代码示例。如果您正苦于以下问题:C# MemberReferenceExpression.Annotation方法的具体用法?C# MemberReferenceExpression.Annotation怎么用?C# MemberReferenceExpression.Annotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberReferenceExpression
的用法示例。
在下文中一共展示了MemberReferenceExpression.Annotation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMemberReferenceExpression
public override StringBuilder VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, int data)
{
var result = new StringBuilder();
if (!(memberReferenceExpression.Target is ThisReferenceExpression))
result.Append(memberReferenceExpression.Target.AcceptVisitor(this, data)).Append(".");
var def = memberReferenceExpression.Annotation<IMemberDefinition>();
if (def != null)
return result.Append(Shader.ResolveName(def));
var fref = memberReferenceExpression.Annotation<FieldReference>();
if (fref != null)
return result.Append(Shader.ResolveName(fref.Resolve()));
throw new NotImplementedException();
}
示例2: VisitMemberReferenceExpression
public virtual void VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression)
{
DebugExpression(memberReferenceExpression);
StartNode(memberReferenceExpression);
memberReferenceExpression.Target.AcceptVisitor(this);
WriteToken(Roles.Dot, BoxedTextColor.Operator);
WriteIdentifier(memberReferenceExpression.MemberNameToken, CSharpMetadataTextColorProvider.Instance.GetColor(memberReferenceExpression.MemberNameToken.Annotation<object>() ?? memberReferenceExpression.Annotation<object>()));
WriteTypeArguments(memberReferenceExpression.TypeArguments, CodeBracesRangeFlags.AngleBrackets);
EndNode(memberReferenceExpression);
}
示例3: VisitMemberReferenceExpression
public virtual void VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression)
{
DebugExpression(memberReferenceExpression);
StartNode(memberReferenceExpression);
memberReferenceExpression.Target.AcceptVisitor(this);
WriteToken(Roles.Dot);
WriteIdentifier(memberReferenceExpression.MemberNameToken, TextTokenHelper.GetTextTokenType(memberReferenceExpression.MemberNameToken.Annotation<object>() ?? memberReferenceExpression.Annotation<object>()));
WriteTypeArguments(memberReferenceExpression.TypeArguments);
EndNode(memberReferenceExpression);
}
示例4: GetTargetTypeRef
TypeReference GetTargetTypeRef (MemberReferenceExpression memberReferenceExpression)
{
var pd = memberReferenceExpression.Annotation<PropertyDefinition> ();
if (pd != null) {
return pd.DeclaringType;
}
var fd = memberReferenceExpression.Annotation<FieldDefinition> ();
if (fd == null)
fd = memberReferenceExpression.Annotation<FieldReference> () as FieldDefinition;
if (fd != null) {
return fd.DeclaringType;
}
return GetTypeRef (memberReferenceExpression.Target);
}
示例5: VisitMemberReferenceExpression
public override void VisitMemberReferenceExpression (MemberReferenceExpression memberReferenceExpression)
{
base.VisitMemberReferenceExpression (memberReferenceExpression);
var s = memberReferenceExpression.Target as BaseReferenceExpression;
if (s != null) {
if (memberReferenceExpression.Annotation<PropertyDefinition>() != null ||
memberReferenceExpression.Annotation<PropertyReference>() != null) {
memberReferenceExpression.Target = new ThisReferenceExpression ();
}
}
}
示例6: VisitMemberReferenceExpression
public override void VisitMemberReferenceExpression(MemberReferenceExpression e)
{
var md = e.Annotation<MethodDefinition>();
if (md != null && md.IsPrivate && md.IsCompilerGenerated())
{
//public override void OnMasterMouseLeave(ModifierMouseArgs e)
//{
// this.TB(ModifierGroup.YB, e);
//}
//
//[CompilerGenerated]
//private static void YB(IChartModifier x, ModifierEventArgsBase y)
//{
// x.OnMasterMouseLeave((ModifierMouseArgs)y);
//}
//
//====>
//public override void OnMasterMouseLeave(ModifierMouseArgs e)
//{
// this.TB((x, y) => x.OnMasterMouseLeave((ModifierMouseArgs)y), e);
//}
var td = e.Ancestors.OfType<TypeDeclaration>().FirstOrDefault();
if (td != null)
{
var method = td.Members.OfType<MethodDeclaration>().FirstOrDefault(x => x.Annotation<MethodDefinition>() == md);
if (method != null)
{
LambdaExpression le = new LambdaExpression();
var body = method.Body;
if (body.Statements.Count == 1)
{
le.Body = TryReduceLambdaBody(body.Statements.First()).Detach();
}
else
{
le.Body = body.Detach();
}
// 设置 Lambda 函数参数
if (method.Parameters.Count > 0)
{
var prmNames = new[] { "x", "y", "z", "u", "v", "w", "m", "n", "p", "q", "r", "s", "t" };
var usedNames = new HashSet<string>(body.Descendants.OfType<IdentifierExpression>().Select(x => x.Identifier).Distinct());
var index = 0;
foreach (var x in method.Parameters)
{
var pn = index < prmNames.Length ? prmNames[index] : "e" + index.ToString();
index++;
while (usedNames.Contains(pn))
{
pn = index < prmNames.Length ? prmNames[index] : "e" + index.ToString();
index++;
}
foreach (var r in le.Body.Descendants.OfType<IdentifierExpression>().Where(r => r.Identifier == x.Name))
{
r.Identifier = pn;
}
le.Parameters.Add(new ParameterDeclaration(pn));
}
}
DelayRemove(method);
e.ReplaceWith(le);
}
}
}
base.VisitMemberReferenceExpression(e);
}