Class: IV::Phonic::AST::Property

Inherits:
Node
  • Object
show all
Defined in:
lib/iv/phonic/ast.rb

Direct Known Subclasses

DataProperty, GetterProperty, SetterProperty

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#begin_position, #end_position, #program, #source

Constructor Details

#initialize(parent, prop) ⇒ Property

Returns a new instance of Property.



440
441
442
443
444
# File 'lib/iv/phonic/ast.rb', line 440

def initialize parent, prop
  super parent, prop
  @key = Identifier.new self, prop[:key]
  @value = Expression.as self, prop[:value]
end

Class Method Details

.as(parent, expr) ⇒ Object



437
438
439
# File 'lib/iv/phonic/ast.rb', line 437

def self.as parent, expr
  return PropertyType2Class[expr[:kind]].new parent, expr
end