Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
ddmd.sideeffect
Compiler implementation of the
D programming language.
Authors:
License:
Source: sideeffect.d
- bool
isTrivialExp
(Expressione
); - 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
- bool
hasSideEffect
(Expressione
); - Determine if Expression has any side effects.
- int
callSideEffectLevel
(FuncDeclarationf
); - Determine if the call of
f
, or function type or delegate type t1, has any side effects.Returns:0 has any side effects 1 nothrow + constant purity 2 nothrow + strong purity - bool
discardValue
(Expressione
); - The result of this expression will be discarded. Print error messages if the operation has no side effects (and hence is meaningless).Returns:
true
if expression has no side effects - VarDeclaration
copyToTemp
(StorageClassstc
, const char*name
, Expressione
); - Build a temporary variable to copy the value of
e
into.Parameters:StorageClass stc
storage classes will be added to the made temporary variable char* name
name
for temporary variableExpression e
original expression Returns:Newly created temporary variable. - Expression
extractSideEffect
(Scope*sc
, const char*name
, ref Expressione0
, Expressione
, boolalwaysCopy
= false); - Build a temporary variable to extract
e
's evaluation, ife
is not trivial.Parameters:Scope* sc
scope char* name
name
for temporary variableExpression e0
a new side effect part will be appended to it. Expression e
original expression bool alwaysCopy
if true
, build new temporary variable even ife
is trivial.Returns:Whene
is trivial andalwaysCopy
==false
,e
itself is returned. Otherwise, a new VarExp is returned.Note:
e
's lvalue-ness will be handled well by STCref or STCrvalue.
Copyright © 1999-2017 by the D Language Foundation | Page generated by
Ddoc on Wed Jul 19 22:16:47 2017