This repository has been archived by the owner on Jun 20, 2019. It is now read-only.
Bug 228: Second pass at reducing the number of temporaries created. #221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improves upon #219 by refactoring the checks for
COMPOUND_EXPRinto a routine that recursively iterates all expressions, splitting the result from the rest of the expression.There are a few more cases that are caught too, including component references, and when generating constructors for array and struct literals, both when using
new()and without.The compiler also now extracts the temporary object from constructor expressions in
build_expr_dtor(), which elides a temporary of the call result being made.Finally,
add_stmt()both now recursively addsCOMPOUND_EXPRexpressions as separate statements, and checks for side effects in all statements to be written. This removes a lot of noise from common rewrites where((e1, e2), e3)is generated, but only the first and last expression actually do anything.