BinaryOp

dotty.tools.sjs.ir.Trees.BinaryOp
See theBinaryOp companion object
sealed case class BinaryOp(op: Code, lhs: Tree, rhs: Tree)(implicit pos: Position) extends Tree

Binary operation.

All binary operations follow common evaluation steps:

  1. Let lhsValue be the result of evaluating lhs.
  2. Let rhsValue be the result of evaluating rhs.
  3. Perform an operation that depends on op, lhsValue and rhsValue.

Unless lhsValue throws, rhsValue will therefore always be evaluated, even if the operation op would throw based only on lhsValue.

The integer dividing operators (Int_/, Int_%, Long_/ and Long_%) throw an ArithmeticException when their right-hand-side is 0. That exception is not subject to undefined behavior.

String_charAt throws a StringIndexOutOfBoundsException.

The Class_x operations take a jl.Class! as lhs, i.e., a non-nullable jl.Class. Class_isAssignableFrom also takes a jl.Class! as rhs.

  • Class_isInstance and Class_isAssignableFrom are pure.
  • Class_cast throws a CCE if its second argument is non-null and not an instance of the class represented by its first argument.
  • Class_newArray throws a NegativeArraySizeException if its second argument is negative and an IllegalArgumentException if its first argument is classOf[Unit].

Otherwise, binary operations preserve pureness.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Tree
class IRNode
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product
def show: String

Attributes

Inherited from:
IRNode

Concrete fields

val tpe: Type

Implicits

Implicits

implicit val pos: Position