Class: RVM::Interpreter::Return
- Inherits:
-
Object
- Object
- RVM::Interpreter::Return
- Defined in:
- lib/rvm/interpreter.rb
Overview
Represents the return statement, it throws a ReturnException
which can be caught to have the function or block return what they wish.
Instance Method Summary collapse
- #data_type ⇒ Object
- #execute(env) ⇒ Object
-
#initialize(val, pos = nil) ⇒ Return
constructor
A new instance of Return.
Constructor Details
#initialize(val, pos = nil) ⇒ Return
Returns a new instance of Return.
492 493 494 495 |
# File 'lib/rvm/interpreter.rb', line 492 def initialize val, pos = nil @val = val @pos = pos end |
Instance Method Details
#data_type ⇒ Object
497 498 499 |
# File 'lib/rvm/interpreter.rb', line 497 def data_type :any end |
#execute(env) ⇒ Object
501 502 503 |
# File 'lib/rvm/interpreter.rb', line 501 def execute env raise ReturnException.new(@val.execute(env)) end |