本文整理汇总了C#中Boo.Lang.Compiler.Ast.BinaryExpression.Annotate方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryExpression.Annotate方法的具体用法?C# BinaryExpression.Annotate怎么用?C# BinaryExpression.Annotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.BinaryExpression
的用法示例。
在下文中一共展示了BinaryExpression.Annotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnBinaryExpression
public override void OnBinaryExpression(BinaryExpression node)
{
if (node.ContainsAnnotation("AssignsAreAttributes_visited"))
return;
if (node.Operator == BinaryOperatorType.Assign)
{
var name = node.Left.expand();
var value = node.Right.expand();
Element.SetAttributeValue(name,value.Replace("_QUOTED_USD_","$"));
}
else{
base.OnBinaryExpression(node);
}
node.Annotate("AssignsAreAttributes_visited");
}
示例2: BindPointerArithmeticOperator
bool BindPointerArithmeticOperator(BinaryExpression node, IType left, IType right)
{
if (!left.IsPointer || !TypeSystemServices.IsPrimitiveNumber(right))
return false;
switch (node.Operator)
{
case BinaryOperatorType.Addition:
case BinaryOperatorType.Subtraction:
if (node.ContainsAnnotation("pointerSizeNormalized"))
return true;
BindExpressionType(node, left);
int size = TypeSystemServices.SizeOf(left);
if (size == 1)
return true; //no need for normalization
//normalize RHS wrt size of pointer
IntegerLiteralExpression literal = node.Right as IntegerLiteralExpression;
Expression normalizedRhs = (null != literal)
? (Expression)
new IntegerLiteralExpression(literal.Value * size)
: (Expression)
new BinaryExpression(BinaryOperatorType.Multiply,
node.Right,
new IntegerLiteralExpression(size));
node.Replace(node.Right, normalizedRhs);
Visit(node.Right);
node.Annotate("pointerSizeNormalized", size);
return true;
}
return false;
}