Class: WAG::FunctionType

Inherits:
Function show all
Defined in:
lib/wag/function_type.rb

Instance Attribute Summary

Attributes inherited from Function

#label, #params

Instance Method Summary collapse

Methods inherited from Function

#initialize, #param, #result

Methods included from Encodable

#to_wasm, #to_wat

Methods included from Instructable

#f32, #f64, #i32, #i64, #local, #memory

Constructor Details

This class inherits a constructor from WAG::Function

Instance Method Details

#to_sexprObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/wag/function_type.rb', line 5

def to_sexpr
  [:type].tap do |type|
    type.push(@label.to_sexpr) if @label
    [:func].tap do |func|
      func.concat(@params.map(&:to_sexpr)) unless @params.empty?
      func.push(@result.to_sexpr) if @result
      type.push(func)
    end
  end
end