dmd.sideeffect
Find side-effects of expressions.
License
Source: sideeffect.d
Documentation: https://dlang.org/phobos/dmd_sideeffect.html
- 
  DeclarationboolisTrivialExp(Expressione);Front-end expression rewriting should create temporary variables for non trivial sub-expressions in order to: - save evaluation order
- prevent sharing of sub-expression in AST
 
- 
  DeclarationboolhasSideEffect(Expressione, boolassumeImpureCalls= false);Determine if Expression has any side effects. ParametersExpressionethe expression boolassumeImpureCallswhether function calls should always be assumed to be impure ( e.g. debug is allowed to violate purity)
- 
  DeclarationintcallSideEffectLevel(FuncDeclarationf);Determine if the call of f, or function type or delegate type t1, has any side effects.Return Value0 has any side effects 1 nothrow + strongly pure 2 nothrow + strongly pure + only immutable indirections in the return type 
- 
  DeclarationbooldiscardValue(Expressione);The result of this expression will be discarded. Print error messages if the operation has no side effects (and hence is meaningless). Return Valuetrueif expression has no side effects
- 
  DeclarationVarDeclarationcopyToTemp(StorageClassstc, const char[]name, Expressione);Build a temporary variable to copy the value of einto.ParametersStorageClassstcstorage classes will be added to the made temporary variable char[]namenamefor temporary variableExpressioneoriginal expression Return ValueNewly created temporary variable. 
- 
  DeclarationExpressionextractSideEffect(Scope*sc, const char[]name, ref Expressione0, Expressione, boolalwaysCopy= false);Build a temporary variable to extract e's evaluation, ifeis not trivial.ParametersScope*scscope char[]namenamefor temporary variableExpressione0a new side effect part will be appended to it. Expressioneoriginal expression boolalwaysCopyif true, build new temporary variable even ifeis trivial.Return ValueWhen eis trivial andalwaysCopy==false,eitself is returned. Otherwise, a new VarExp is returned.Note: e's lvalue-ness will be handled well by STC.ref_ or STC.rvalue.