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.

callSideEffectLevel
int callSideEffectLevel(Type t)
Undocumented in source. Be warned that the author may not have intended to support it.
copyToTemp
VarDeclaration copyToTemp(StorageClass stc, 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, char[] name, Expression e0, Expression e, bool alwaysCopy)

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

hasSideEffect
bool hasSideEffect(Expression e, bool assumeImpureCalls)

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