File tree 1 file changed +24
-2
lines changed
1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -324,12 +324,34 @@ enum class ExternalKind : uint8_t
324
324
// https://webassembly.github.io/spec/core/binary/modules.html#import-section
325
325
struct Import
326
326
{
327
+ Import () = default ;
328
+ Import (const Import& other) : module(other.module), name(other.name), kind(other.kind)
329
+ {
330
+ switch (other.kind )
331
+ {
332
+ case ExternalKind::Function:
333
+ desc.function_type_index = other.desc .function_type_index ;
334
+ break ;
335
+ case ExternalKind::Table:
336
+ desc.table = other.desc .table ;
337
+ break ;
338
+ case ExternalKind::Memory:
339
+ desc.memory = other.desc .memory ;
340
+ break ;
341
+ case ExternalKind::Global:
342
+ desc.global = other.desc .global ;
343
+ break ;
344
+ }
345
+ }
346
+ // TODO needs move constructor
347
+
327
348
std::string module;
328
349
std::string name;
329
350
ExternalKind kind = ExternalKind::Function;
330
- union
351
+ union Desc
331
352
{
332
- TypeIdx function_type_index = 0 ;
353
+ Desc () : function_type_index (0 ) {}
354
+ TypeIdx function_type_index;
333
355
Memory memory;
334
356
GlobalType global;
335
357
Table table;
You can’t perform that action at this time.
0 commit comments