-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Describe the bug
When a Union switch is defined with an array as the object for one of the case statements the generated code does not always keep the list.
Go and Rust do not ever seem to keep the list, but Javascript seems to work for some types.
I tested with 3 types of arrays, Opaque, strings, and unsigned hyper.
To Reproduce
Example IDL definition:
enum CategoryType
{
NONE = 0,
BYTES = 1,
STRINGS = 2,
INTS = 3
};
union Category switch (CategoryType Type)
{
case NONE:
void;
case BYTES:
opaque bytes<>;
case STRINGS:
string strings<>;
case INTS:
unsigned hyper ints<>;
};
Generated Go:
// Category generated union
type Category struct {
Type CategoryType
Bytes *byte
Strings *string
Ints *uint64
}
Generated Rust:
#[derive(PartialEq, Clone, Debug, XDROut, XDRIn)]
pub enum Category {
NONE(()),
BYTES(u8),
STRINGS(String),
INTS(u64),
}
Generated JS:
function Category() {
return new _xdrJsSerialize2.default.Union(CategoryType(), {
"NONE": () => {
return new _xdrJsSerialize2.default.Void();
},
"BYTES": () => {
return new _xdrJsSerialize2.default.VarOpaque(2147483647);
},
"STRINGS": () => {
return new _xdrJsSerialize2.default.Str('', 2147483647);
},
"INTS": () => {
return new _xdrJsSerialize2.default.VarArray(2147483647, () => new _xdrJsSerialize2.default.UHyper());
}
});
}
Metadata
Metadata
Assignees
Labels
No labels