dmd.sideeffect

Find side-effects of expressions.

Members

Functions

callSideEffectLevel
int callSideEffectLevel(FuncDeclaration f)

Determine if the call of f, or function type or delegate type t1, has any side effects.

copyToTemp
VarDeclaration copyToTemp(StorageClass stc, const char[] name, Expression e)

Build a temporary variable to copy the value of e into.

discardValue
bool discardValue(Expression e)

The result of this expression will be discarded. Print error messages if the operation has no side effects (and hence is meaningless).

extractSideEffect
Expression extractSideEffect(Scope* sc, const char[] name, ref Expression e0, Expression e, bool alwaysCopy = false)

Build a temporary variable to extract e's evaluation, if e is not trivial.

hasSideEffect
bool hasSideEffect(Expression e)

Determine if Expression has any side effects.

isTrivialExp
bool isTrivialExp(Expression e)

Front-end expression rewriting should create temporary variables for non trivial sub-expressions in order to: 1. save evaluation order 2. prevent sharing of sub-expression in AST

Meta