Class: Peruby::Op::Group

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

Overview

Parenthesized expression, retained for Perl's (LIST) reference semantics.

Instance Method Summary collapse

Methods inherited from Base

#local_slot, #run_subroutine, #to_callable, #warning_directive?

Constructor Details

#initialize(expression) ⇒ Group

Returns a new instance of Group.



41
42
43
# File 'lib/peruby/op/expression.rb', line 41

def initialize(expression)
  @expression = expression
end

Instance Method Details

#aggregate(env, kind) ⇒ Object



48
# File 'lib/peruby/op/expression.rb', line 48

def aggregate(env, kind) = @expression.aggregate(env, kind)

#argument_cells(env) ⇒ Object



47
# File 'lib/peruby/op/expression.rb', line 47

def argument_cells(env) = @expression.argument_cells(env)

#lvalue(env, context) ⇒ Object



46
# File 'lib/peruby/op/expression.rb', line 46

def lvalue(env, context) = @expression.lvalue(env, context)

#references(env, context) ⇒ Object



50
51
52
53
# File 'lib/peruby/op/expression.rb', line 50

def references(env, context)
  values = @expression.argument_cells(env).map { |cell| Scalar.new(Ref.new(cell)) }
  context == :list ? values : values.last&.get
end

#run(env, context) ⇒ Object



45
# File 'lib/peruby/op/expression.rb', line 45

def run(env, context) = @expression.run(env, context)