dmd.opover

Handles operator overloading.

Specification: Operator Overloading

Members

Functions

build_overload
Expression build_overload(Loc loc, Scope* sc, Expression ethis, Expression earg, Dsymbol d)

Utility to build a function call out of this reference and argument.

inferApplyArgTypes
bool inferApplyArgTypes(ForeachStatement fes, Scope* sc, Dsymbol sapply)

Given array of foreach parameters and an aggregate type, find best opApply overload, if any of the parameter types are missing, attempt to infer them from the aggregate type.

inferForeachAggregate
bool inferForeachAggregate(Scope* sc, bool isForeach, Expression feaggr, Dsymbol sapply)

Figure out what is being foreach'd over by looking at the ForeachAggregate.

isCommutative
bool isCommutative(EXP op)

Determine if operands of binary op can be reversed to fit operator overload.

opToArg
Objects* opToArg(Scope* sc, EXP op)

Helper function to turn operator into template argument list

op_overload
Expression op_overload(Expression e, Scope* sc, EXP* pop)

Operator overload. Check for operator overload, if so, replace with function call.

search_function
Dsymbol search_function(ScopeDsymbol ad, Identifier funcid)

Search for function funcid in aggregate ad.

Meta