本文整理汇总了C#中Boo.Lang.Compiler.Ast.Expression.ContainsAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.ContainsAnnotation方法的具体用法?C# Expression.ContainsAnnotation怎么用?C# Expression.ContainsAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.Expression
的用法示例。
在下文中一共展示了Expression.ContainsAnnotation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InferResult
private void InferResult(Expression expr, string name, LexicalInfo lexicalInfo, bool useElementType)
{
if (expr == null)
return;
// Prevent creating an infinite number of InferredReturnTypes in inferring cycles
IReturnType returnType;
if (expr.ContainsAnnotation("DomReturnType")) {
returnType = (IReturnType)expr["DomReturnType"];
} else {
returnType = new BooInferredReturnType(expr, resolver.CallingClass);
expr.Annotate("DomReturnType", returnType);
}
if (useElementType)
returnType = new ElementReturnType(resolver.ProjectContent, returnType);
result = new DefaultField.LocalVariableField(returnType, name,
new DomRegion(lexicalInfo.Line, lexicalInfo.Column),
resolver.CallingClass);
}
示例2: FindNullableExpressions
private IEnumerable<Expression> FindNullableExpressions(Expression exp)
{
if (exp.ContainsAnnotation("nullableTarget"))
{
yield return ((MemberReferenceExpression) exp).Target;
}
else
{
BinaryExpression bex = exp as BinaryExpression;
if (null != bex)
{
foreach (Expression inner in FindNullableExpressions(bex.Left))
yield return inner;
foreach (Expression inner in FindNullableExpressions(bex.Right))
yield return inner;
}
}
}
示例3: IsConstant
static bool IsConstant(Expression e)
{
if (e.NodeType == NodeType.UnaryExpression)
return IsConstant(((UnaryExpression)e).Operand);
if (e.NodeType == NodeType.BinaryExpression)
{
var be = (BinaryExpression)e;
if (AstUtil.GetBinaryOperatorKind(be) == BinaryOperatorKind.Logical)
return IsConstant(be.Left) && IsConstant(be.Right);
}
if ((e as LiteralExpression) != null
&& !e.ContainsAnnotation(ConstantFolding.FoldedExpression))
return true;
if (IsImplicitCallable(e))
return true;
if (IsConstantInternalField(e.Entity as IField, e))
return true;
return false;
}