Class: WAG::Param

Inherits:
Object
  • Object
show all
Includes:
Encodable
Defined in:
lib/wag/param.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Encodable

#to_wasm, #to_wat

Constructor Details

#initialize(type, label = nil) ⇒ Param

Returns a new instance of Param.



9
10
11
12
# File 'lib/wag/param.rb', line 9

def initialize(type, label = nil)
  @type = WAG::Type.from(type)
  @label = WAG::Label.from(label) if label
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



7
8
9
# File 'lib/wag/param.rb', line 7

def label
  @label
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/wag/param.rb', line 7

def type
  @type
end

Instance Method Details

#to_sexprObject



14
15
16
17
18
# File 'lib/wag/param.rb', line 14

def to_sexpr
  return [:param, label.to_sexpr, type.to_sexpr] if label

  [:param, type.to_sexpr]
end