File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 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
324324// https://webassembly.github.io/spec/core/binary/modules.html#import-section
325325struct Import
326326{
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+
327348 std::string module ;
328349 std::string name;
329350 ExternalKind kind = ExternalKind::Function;
330- union
351+ union Desc
331352 {
332- TypeIdx function_type_index = 0 ;
353+ Desc () : function_type_index (0 ) {}
354+ TypeIdx function_type_index;
333355 Memory memory;
334356 GlobalType global;
335357 Table table;
You can’t perform that action at this time.
0 commit comments