rlang 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,17 +18,18 @@ class WType
18
18
  include Log
19
19
 
20
20
  WASM_TYPE_MAP = {
21
- I64: Type::I64,
22
- I32: Type::I32,
23
- F64: Type::F64,
24
- F32: Type::F32
21
+ UI64: Type::UI64,
22
+ I64: Type::I64,
23
+ UI32: Type::UI32,
24
+ I32: Type::I32,
25
+ F64: Type::F64,
26
+ F32: Type::F32
25
27
  }
26
28
 
27
29
  # Implicit Type cast order in decreasing order of precedence
28
30
  # Class types have precedence over default integer type
29
31
  # because of pointer arithmetics
30
- # TODO: :Class should be inserted before WType::DEFAULT
31
- CAST_PRECEDENCE = [:F64, :F32, :I64, :Class, :I32]
32
+ CAST_PRECEDENCE = [:F64, :F32, :UI64, :I64, :Class, :UI32, :I32]
32
33
 
33
34
  attr_reader :name
34
35
 
@@ -79,6 +80,10 @@ class WType
79
80
  WASM_TYPE_MAP.has_key? @name
80
81
  end
81
82
 
83
+ def signed?
84
+ self.native? && WASM_TYPE_MAP[@name].signed?
85
+ end
86
+
82
87
  def blank?
83
88
  @name == :none || @name == :nil
84
89
  end
@@ -128,6 +133,7 @@ class WType
128
133
  end
129
134
 
130
135
  DEFAULT = self.new(WASM_TYPE_MAP.key(Type::DEFAULT))
136
+ UNSIGNED_DEFAULT = self.new(WASM_TYPE_MAP.key(Type::UNSIGNED_DEFAULT))
131
137
 
132
138
  end
133
139