protected internal Binary(NRefactory.BinaryOperatorExpression binaryOperatorExpression, IScope scope, INRefcatoryExpressionVisitor visitor) : base(scope, visitor) { _binaryOperatorExpression = binaryOperatorExpression; Left = binaryOperatorExpression.Left.AcceptVisitor(Visitor, ParentScope); Right = binaryOperatorExpression.Right.AcceptVisitor(Visitor, ParentScope); _binaryOperationType = GetBinaryOperator(binaryOperatorExpression.Operator); _promotionDecisions = BinaryNumericPromotionDecision.Decide(Left.Type, Right.Type); InternalType = binaryOperatorExpression.GetBinaryOperationType(_promotionDecisions, Left.Type); }
internal BinaryExpressionEmitter(BinaryOperatorExpression binaryOperatorExpression, ILGenerator ilGenerator, IOpCodeIndexer instructionIndexer, IAstVisitor <ILGenerator, AstNode> visitor, List <LocalBuilder> locals) : base(binaryOperatorExpression, ilGenerator, instructionIndexer, visitor, locals) { var leftTypeInformation = Node.Left.Annotation <TypeInformation>(); var rightTypeInformation = Node.Right.Annotation <TypeInformation>(); if (leftTypeInformation != null && rightTypeInformation != null) { _leftType = leftTypeInformation.InferredType.GetActualType(); _rightType = rightTypeInformation.InferredType.GetActualType(); _promotionDecisions = BinaryNumericPromotionDecision.Decide(_leftType, _rightType); Type = Node.GetBinaryOperationType(_promotionDecisions, _leftType); _emitAction = EmitBinaryExpression; } else { _emitAction = EmitTernaryConditionalExpression; } }