本文整理汇总了C#中Boo.Lang.Compiler.Ast.MemberReferenceExpression.Annotate方法的典型用法代码示例。如果您正苦于以下问题:C# MemberReferenceExpression.Annotate方法的具体用法?C# MemberReferenceExpression.Annotate怎么用?C# MemberReferenceExpression.Annotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.MemberReferenceExpression
的用法示例。
在下文中一共展示了MemberReferenceExpression.Annotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryToResolveMemberAsExtension
private IEntity TryToResolveMemberAsExtension(MemberReferenceExpression node)
{
IEntity extension = NameResolutionService.ResolveExtension(GetReferenceNamespace(node), node.Name);
if (null != extension)
node.Annotate(ResolvedAsExtensionAnnotation);
return extension;
}
示例2: BindNullableOperation
bool BindNullableOperation(BinaryExpression node)
{
if (!IsNullableOperation(node))
return false;
if (BinaryOperatorType.ReferenceEquality == node.Operator)
{
node.Operator = BinaryOperatorType.Equality;
return BindNullableComparison(node);
}
else if (BinaryOperatorType.ReferenceInequality == node.Operator)
{
node.Operator = BinaryOperatorType.Inequality;
return BindNullableComparison(node);
}
IType lhs = GetExpressionType(node.Left);
IType rhs = GetExpressionType(node.Right);
bool lhsIsNullable = TypeSystemServices.IsNullable(lhs);
bool rhsIsNullable = TypeSystemServices.IsNullable(rhs);
if (BinaryOperatorType.Assign == node.Operator)
{
if (lhsIsNullable)
{
if (rhsIsNullable)
return false;
BindNullableInitializer(node, node.Right, lhs);
return false;
}
}
if (lhsIsNullable)
{
MemberReferenceExpression mre = new MemberReferenceExpression(node.Left, "Value");
node.Replace(node.Left, mre);
Visit(mre);
mre.Annotate("nullableTarget", true);
}
if (rhsIsNullable)
{
MemberReferenceExpression mre = new MemberReferenceExpression(node.Right, "Value");
node.Replace(node.Right, mre);
Visit(mre);
mre.Annotate("nullableTarget", true);
}
return false;
}