Class: Chelsy::Operator::Subscription

Inherits:
Postfix show all
Defined in:
lib/chelsy/ast.rb

Overview

=== 6.5.2.1 Array subscripting

Instance Attribute Summary collapse

Attributes inherited from Unary

#operand

Attributes inherited from Element

#fragments, #post_fragments

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

precedence

Constructor Details

#initialize(subscriptee, index, **rest) ⇒ Subscription

Returns a new instance of Subscription.



594
595
596
597
# File 'lib/chelsy/ast.rb', line 594

def initialize(subscriptee, index, **rest)
  @index = Syntax::Expr.ensure(index)
  super subscriptee, **rest
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



590
591
592
# File 'lib/chelsy/ast.rb', line 590

def index
  @index
end

Class Method Details

.operatorObject



592
# File 'lib/chelsy/ast.rb', line 592

def self.operator; :"[]" end

Instance Method Details

#subscripteeObject



599
# File 'lib/chelsy/ast.rb', line 599

def subscriptee; operand end