Class: Opal::Rewriters::ForRewriter::LocalVariableAssigns

Inherits:
Base
  • Object
show all
Defined in:
lib/opal/rewriters/for_rewriter.rb

Overview

rubocop:enable Layout/MultilineMethodCallBraceLayout,Layout/MultilineArrayBraceLayout

Constant Summary

Constants inherited from Base

Base::DUMMY_LOCATION

Instance Attribute Summary collapse

Attributes inherited from Base

#current_node

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#append_to_body, #begin_with_stmts, #dynamic!, #error, #on_top, #prepend_to_body, #process, s, #s, #stmts_of

Constructor Details

#initializeLocalVariableAssigns

Returns a new instance of LocalVariableAssigns.



93
94
95
# File 'lib/opal/rewriters/for_rewriter.rb', line 93

def initialize
  @result = Set.new
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



85
86
87
# File 'lib/opal/rewriters/for_rewriter.rb', line 85

def result
  @result
end

Class Method Details

.find(node) ⇒ Object



87
88
89
90
91
# File 'lib/opal/rewriters/for_rewriter.rb', line 87

def self.find(node)
  processor = new
  processor.process(node)
  processor.result.to_a
end

Instance Method Details

#on_lvasgn(node) ⇒ Object



97
98
99
100
101
# File 'lib/opal/rewriters/for_rewriter.rb', line 97

def on_lvasgn(node)
  name, _ = *node
  result << name
  super
end