Class: Peruby::Op::Undef

Inherits:
Base
  • Object
show all
Defined in:
lib/peruby/op/call.rb

Overview

undef with optional deterministic blessed-reference release.

Instance Method Summary collapse

Methods inherited from Base

#argument_cells, #local_slot, #lvalue, #run_subroutine, #to_callable, #warning_directive?

Constructor Details

#initialize(expression) ⇒ Undef

Returns a new instance of Undef.



366
367
368
# File 'lib/peruby/op/call.rb', line 366

def initialize(expression)
  @expression = expression
end

Instance Method Details

#run(env, _context) ⇒ Object



370
371
372
373
374
375
# File 'lib/peruby/op/call.rb', line 370

def run(env, _context)
  cell = @expression.lvalue(env, :scalar)
  env.runtime.release(cell.get)
  cell.set(nil)
  nil
end