Permalink
Browse files

Fix a nasty bug within FoldPassthroughAssignments.

  • Loading branch information...
1 parent a6e5000 commit bb5f5dcbc67752edd4deb7b7fa44de7d661523cb @whitequark committed Aug 18, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/furnace-avm2/transform/fold_passthrough_assignments.rb
View
6 lib/furnace-avm2/transform/fold_passthrough_assignments.rb
@@ -4,6 +4,12 @@ class FoldPassthroughAssignments
def transform(cfg)
cfg.nodes.each do |block|
block.metadata.sets.each do |id|
+ # Skip if not referenced. Otherwise, code with possible
+ # side effects will be removed.
+ unless block.metadata.gets.include? id
+ next
+ end
+
# All references should be contained in the same
# block as the definition.
if block.targets.any? { |t| t.metadata.live.include? id }

0 comments on commit bb5f5dc

Please sign in to comment.