Class: TypeProf::Core::LocalEnv
- Inherits:
-
Object
- Object
- TypeProf::Core::LocalEnv
- Defined in:
- lib/typeprof/core/env.rb
Instance Attribute Summary collapse
-
#break_vtx ⇒ Object
readonly
Returns the value of attribute break_vtx.
-
#cref ⇒ Object
readonly
Returns the value of attribute cref.
-
#locals ⇒ Object
readonly
Returns the value of attribute locals.
-
#next_boxes ⇒ Object
readonly
Returns the value of attribute next_boxes.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#return_boxes ⇒ Object
readonly
Returns the value of attribute return_boxes.
Instance Method Summary collapse
- #add_next_box(box) ⇒ Object
- #add_return_box(box) ⇒ Object
- #apply_read_filter(genv, node, name, vtx) ⇒ Object
- #exist_var?(name) ⇒ Boolean
- #get_break_vtx ⇒ Object
- #get_var(name) ⇒ Object
-
#initialize(path, cref, locals, return_boxes) ⇒ LocalEnv
constructor
A new instance of LocalEnv.
- #new_var(name, node) ⇒ Object
- #pop_read_filter(name) ⇒ Object
- #push_read_filter(name, type) ⇒ Object
- #set_var(name, vtx) ⇒ Object
Constructor Details
#initialize(path, cref, locals, return_boxes) ⇒ LocalEnv
Returns a new instance of LocalEnv.
280 281 282 283 284 285 286 287 288 |
# File 'lib/typeprof/core/env.rb', line 280 def initialize(path, cref, locals, return_boxes) @path = path @cref = cref @locals = locals @return_boxes = return_boxes @break_vtx = nil @next_boxes = [] @filters = {} end |
Instance Attribute Details
#break_vtx ⇒ Object (readonly)
Returns the value of attribute break_vtx.
290 291 292 |
# File 'lib/typeprof/core/env.rb', line 290 def break_vtx @break_vtx end |
#cref ⇒ Object (readonly)
Returns the value of attribute cref.
290 291 292 |
# File 'lib/typeprof/core/env.rb', line 290 def cref @cref end |
#locals ⇒ Object (readonly)
Returns the value of attribute locals.
290 291 292 |
# File 'lib/typeprof/core/env.rb', line 290 def locals @locals end |
#next_boxes ⇒ Object (readonly)
Returns the value of attribute next_boxes.
290 291 292 |
# File 'lib/typeprof/core/env.rb', line 290 def next_boxes @next_boxes end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
290 291 292 |
# File 'lib/typeprof/core/env.rb', line 290 def path @path end |
#return_boxes ⇒ Object (readonly)
Returns the value of attribute return_boxes.
290 291 292 |
# File 'lib/typeprof/core/env.rb', line 290 def return_boxes @return_boxes end |
Instance Method Details
#add_next_box(box) ⇒ Object
312 313 314 |
# File 'lib/typeprof/core/env.rb', line 312 def add_next_box(box) @next_boxes << box end |
#add_return_box(box) ⇒ Object
308 309 310 |
# File 'lib/typeprof/core/env.rb', line 308 def add_return_box(box) @return_boxes << box end |
#apply_read_filter(genv, node, name, vtx) ⇒ Object
329 330 331 332 333 334 335 336 337 |
# File 'lib/typeprof/core/env.rb', line 329 def apply_read_filter(genv, node, name, vtx) if @filters[name] && !@filters[name].empty? case @filters[name].last when :non_nil return NilFilter.new(genv, node, vtx, false).next_vtx end end vtx end |
#exist_var?(name) ⇒ Boolean
304 305 306 |
# File 'lib/typeprof/core/env.rb', line 304 def exist_var?(name) !!@locals[name] end |
#get_break_vtx ⇒ Object
316 317 318 |
# File 'lib/typeprof/core/env.rb', line 316 def get_break_vtx @break_vtx ||= Vertex.new(:break_vtx) end |
#get_var(name) ⇒ Object
300 301 302 |
# File 'lib/typeprof/core/env.rb', line 300 def get_var(name) @locals[name] || raise("#{ name }") end |
#new_var(name, node) ⇒ Object
292 293 294 |
# File 'lib/typeprof/core/env.rb', line 292 def new_var(name, node) @locals[name] = Vertex.new(node) end |
#pop_read_filter(name) ⇒ Object
325 326 327 |
# File 'lib/typeprof/core/env.rb', line 325 def pop_read_filter(name) (@filters[name] ||= []).pop end |
#push_read_filter(name, type) ⇒ Object
321 322 323 |
# File 'lib/typeprof/core/env.rb', line 321 def push_read_filter(name, type) (@filters[name] ||= []) << type end |
#set_var(name, vtx) ⇒ Object
296 297 298 |
# File 'lib/typeprof/core/env.rb', line 296 def set_var(name, vtx) @locals[name] = vtx end |