@@ -46,22 +46,22 @@ static bool ToWasmValue(const Number& value,
46
46
classid_t type,
47
47
wasmer_value_t * out) {
48
48
switch (type) {
49
- case kFfiInt32Cid :
49
+ case kWasmInt32Cid :
50
50
if (!value.IsInteger ()) return false ;
51
51
out->tag = wasmer_value_tag::WASM_I32;
52
52
out->value .I32 = Integer::Cast (value).AsInt64Value ();
53
53
return true ;
54
- case kFfiInt64Cid :
54
+ case kWasmInt64Cid :
55
55
if (!value.IsInteger ()) return false ;
56
56
out->tag = wasmer_value_tag::WASM_I64;
57
57
out->value .I64 = Integer::Cast (value).AsInt64Value ();
58
58
return true ;
59
- case kFfiFloatCid :
59
+ case kWasmFloatCid :
60
60
if (!value.IsDouble ()) return false ;
61
61
out->tag = wasmer_value_tag::WASM_F32;
62
62
out->value .F32 = Double::Cast (value).value ();
63
63
return true ;
64
- case kFfiDoubleCid :
64
+ case kWasmDoubleCid :
65
65
if (!value.IsDouble ()) return false ;
66
66
out->tag = wasmer_value_tag::WASM_F64;
67
67
out->value .F64 = Double::Cast (value).value ();
@@ -137,7 +137,7 @@ class WasmMemory {
137
137
138
138
class WasmImports {
139
139
public:
140
- WasmImports (std::unique_ptr<char []> module_name)
140
+ explicit WasmImports (std::unique_ptr<char []> module_name)
141
141
: _module_name(std::move(module_name)) {}
142
142
143
143
~WasmImports () {
@@ -195,7 +195,7 @@ class WasmFunction {
195
195
classid_t ret,
196
196
const wasmer_export_func_t * fn)
197
197
: _args(std::move(args)), _ret(ret), _fn(fn) {}
198
- bool IsVoid () const { return _ret == kFfiVoidCid ; }
198
+ bool IsVoid () const { return _ret == kWasmVoidCid ; }
199
199
const MallocGrowableArray<classid_t >& args () const { return _args; }
200
200
201
201
bool SignatureMatches (const MallocGrowableArray<classid_t >& dart_args,
@@ -219,11 +219,11 @@ class WasmFunction {
219
219
}
220
220
221
221
void Print (std::ostream& o, const char * name) const {
222
- PrintFfiType (o, _ret);
222
+ PrintDartType (o, _ret);
223
223
o << ' ' << name << ' (' ;
224
224
for (intptr_t i = 0 ; i < _args.length (); ++i) {
225
225
if (i > 0 ) o << " , " ;
226
- PrintFfiType (o, _args[i]);
226
+ PrintDartType (o, _args[i]);
227
227
}
228
228
o << ' )' ;
229
229
}
@@ -233,21 +233,21 @@ class WasmFunction {
233
233
const classid_t _ret;
234
234
const wasmer_export_func_t * _fn;
235
235
236
- static void PrintFfiType (std::ostream& o, classid_t type) {
236
+ static void PrintDartType (std::ostream& o, classid_t type) {
237
237
switch (type) {
238
- case kFfiInt32Cid :
238
+ case kWasmInt32Cid :
239
239
o << " i32" ;
240
240
break ;
241
- case kFfiInt64Cid :
241
+ case kWasmInt64Cid :
242
242
o << " i64" ;
243
243
break ;
244
- case kFfiFloatCid :
244
+ case kWasmFloatCid :
245
245
o << " f32" ;
246
246
break ;
247
- case kFfiDoubleCid :
247
+ case kWasmDoubleCid :
248
248
o << " f64" ;
249
249
break ;
250
- case kFfiVoidCid :
250
+ case kWasmVoidCid :
251
251
o << " void" ;
252
252
break ;
253
253
}
@@ -317,16 +317,16 @@ class WasmInstance {
317
317
wasmer_exports_t * _exports;
318
318
MallocDirectChainedHashMap<CStringKeyValueTrait<WasmFunction*>> _functions;
319
319
320
- static classid_t ToFfiType (wasmer_value_tag wasm_type) {
320
+ static classid_t ToDartType (wasmer_value_tag wasm_type) {
321
321
switch (wasm_type) {
322
322
case wasmer_value_tag::WASM_I32:
323
- return kFfiInt32Cid ;
323
+ return kWasmInt32Cid ;
324
324
case wasmer_value_tag::WASM_I64:
325
- return kFfiInt64Cid ;
325
+ return kWasmInt64Cid ;
326
326
case wasmer_value_tag::WASM_F32:
327
- return kFfiFloatCid ;
327
+ return kWasmFloatCid ;
328
328
case wasmer_value_tag::WASM_F64:
329
- return kFfiDoubleCid ;
329
+ return kWasmDoubleCid ;
330
330
}
331
331
FATAL (" Unknown WASM type" );
332
332
return 0 ;
@@ -340,7 +340,7 @@ class WasmInstance {
340
340
ASSERT (num_rets <= 1 );
341
341
wasmer_value_tag wasm_ret;
342
342
ThrowIfFailed (wasmer_export_func_returns (fn, &wasm_ret, num_rets));
343
- classid_t ret = num_rets == 0 ? kFfiVoidCid : ToFfiType (wasm_ret);
343
+ classid_t ret = num_rets == 0 ? kWasmVoidCid : ToDartType (wasm_ret);
344
344
345
345
uint32_t num_args;
346
346
ThrowIfFailed (wasmer_export_func_params_arity (fn, &num_args));
@@ -349,7 +349,7 @@ class WasmInstance {
349
349
ThrowIfFailed (wasmer_export_func_params (fn, wasm_args.get (), num_args));
350
350
MallocGrowableArray<classid_t > args;
351
351
for (intptr_t i = 0 ; i < num_args; ++i) {
352
- args.Add (ToFfiType (wasm_args[i]));
352
+ args.Add (ToDartType (wasm_args[i]));
353
353
}
354
354
355
355
wasmer_byte_array name_bytes = wasmer_export_name (exp );
0 commit comments