Class: IV::Phonic::AST::IndexAccess

Inherits:
Expression show all
Defined in:
lib/iv/phonic/ast.rb

Instance Method Summary collapse

Methods inherited from Expression

as

Methods inherited from Node

#begin_position, #end_position, #program, #source

Constructor Details

#initialize(parent, expr) ⇒ IndexAccess

Returns a new instance of IndexAccess.



485
486
487
488
489
# File 'lib/iv/phonic/ast.rb', line 485

def initialize parent, expr
  super parent, expr
  @target = Expression.as self, expr[:target]
  @key = Expression.as self, expr[:key]
end

Instance Method Details

#to_sourceObject



491
492
493
# File 'lib/iv/phonic/ast.rb', line 491

def to_source
  "#{@target.to_source}[#{@key.to_source}]"
end