Class: IRScopeRegistry
- Inherits:
-
Object
- Object
- IRScopeRegistry
- Defined in:
- lib/jruby_visualizer/ir_scope_registry.rb
Overview
Registry for IRScopes, to access them by key without nesting of scopes
Instance Attribute Summary collapse
-
#scopes ⇒ Object
readonly
Returns the value of attribute scopes.
Instance Method Summary collapse
- #clear ⇒ Object
- #fill_registry(ir_scope) ⇒ Object
-
#initialize(root_scope) ⇒ IRScopeRegistry
constructor
A new instance of IRScopeRegistry.
Constructor Details
#initialize(root_scope) ⇒ IRScopeRegistry
Returns a new instance of IRScopeRegistry.
27 28 29 30 |
# File 'lib/jruby_visualizer/ir_scope_registry.rb', line 27 def initialize(root_scope) @scopes = {} fill_registry(root_scope) end |
Instance Attribute Details
#scopes ⇒ Object (readonly)
Returns the value of attribute scopes.
25 26 27 |
# File 'lib/jruby_visualizer/ir_scope_registry.rb', line 25 def scopes @scopes end |
Instance Method Details
#clear ⇒ Object
37 38 39 |
# File 'lib/jruby_visualizer/ir_scope_registry.rb', line 37 def clear @scopes = {} end |
#fill_registry(ir_scope) ⇒ Object
32 33 34 35 |
# File 'lib/jruby_visualizer/ir_scope_registry.rb', line 32 def fill_registry(ir_scope) @scopes[ir_scope.key] = ir_scope ir_scope.lexical_scopes.each { |lex_scope| fill_registry(lex_scope) } end |