Class: Oinky::Model::DerivedType

Inherits:
Object
  • Object
show all
Defined in:
lib/oinky/compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(basetype, instancetype) ⇒ DerivedType

Returns a new instance of DerivedType.



47
48
49
50
# File 'lib/oinky/compiler.rb', line 47

def initialize(basetype, instancetype)
  @basetype = basetype
  @instancetype = instancetype
end

Instance Method Details

#instance_type(lang) ⇒ Object



51
52
53
54
# File 'lib/oinky/compiler.rb', line 51

def instance_type(lang)
  return @instancetype if @instancetype.is_a? String
  return @instancetype[lang]
end

#oinky_typeObject



55
56
57
58
# File 'lib/oinky/compiler.rb', line 55

def oinky_type
  return @basetype if @basetype.is_a? Symbol
  return @basetype.oinky_type
end

#value_from_variant(src_exp, emitter) ⇒ Object

This can be overriden by any derived type. By default we just build from the base type.



61
62
63
# File 'lib/oinky/compiler.rb', line 61

def value_from_variant(src_exp, emitter)
  emitter.value_from_variant(src_exp, oinky_type)
end