dmd.arrayop
Implement array operations, such as a[] = b[] + c[].
Specification: Array Operations
License
Source: arrayop.d
Documentation: https://dlang.org/phobos/dmd_arrayop.html
-
Declaration
boolisArrayOpValid(Expressione);Check that there are no uses of arrays without [].
-
Declaration
ExpressionarrayOp(BinExpe, Scope*sc);
ExpressionarrayOp(BinAssignExpe, Scope*sc);Construct the array operation expression, call object.arrayOp!(tiargs)(args).
Discussion
Encode operand types and operations into tiargs using reverse polish notation (RPN) to preserve precedence. Unary operations are prefixed with "u" (
e.g. "u~"). Pass operand values (slices or scalars) as args.
Scalar expression sub-trees ofare evaluated before calling into druntime to hoist them out of the loop. This is a valid evaluation order as the actual array operations have no side-effect.e -
Declaration
boolisArrayOpImplicitCast(TypeDArraytfrom, TypeDArraytto);Some implicit casting can be performed by the arrayOp template.
Parameters
TypeDArraytfromtype converting from
TypeDArrayttotype converting to
Return Value
trueif can be performed by arrayOp -
Declaration
boolisUnaArrayOp(EXPop);Test if expression is a unary array
op. -
Declaration
boolisBinArrayOp(EXPop);Test if expression is a binary array
op. -
Declaration
boolisBinAssignArrayOp(EXPop);Test if expression is a binary assignment array
op. -
Declaration
boolisArrayOpOperand(Expressione);Test if operand is a valid array op operand.
-
Declaration
ErrorExparrayOpInvalidError(Expressione);Print error message about invalid array operation.
Parameters
Expressioneexpression with the invalid array operation
Return Value
instance of ErrorExp