extractSideEffect

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

extractSideEffect
(
,
const char* name
,,,
bool alwaysCopy = false
)

Parameters

sc
Type: Scope*

scope

name
Type: char*

name for temporary variable

e0

a new side effect part will be appended to it.

e

original expression

alwaysCopy
Type: bool

if true, build new temporary variable even if e is trivial.

Return Value

When e is trivial and alwaysCopy == false, e itself is returned. Otherwise, a new VarExp is returned. Note: e's lvalue-ness will be handled well by STCref or STCrvalue.

Meta