Class: Type::Numeric
Instance Method Summary
collapse
Instance Method Details
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/rlang/parser/ext/type.rb', line 67
def type
if self.is_a? Integer
if self <= I32::MAX
'i32'
elsif self <= I64::MAX
'i64'
else
raise "Integer value too large #{self}"
end
elsif self.is_a? Float
if self <= F32::MAX
'f32'
elsif self <= F64::MAX
'f64'
else
raise "Float value too large #{self}"
end
else
raise "Unknown value type #{self.class} for #{self}"
end
end
|