We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
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()); } }); }
The text was updated successfully, but these errors were encountered:
This should work, but until it is fixed you can just used a typedef to get the type you want in the union.
Sorry, something went wrong.
No branches or pull requests
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:
Generated Go:
Generated Rust:
Generated JS:
The text was updated successfully, but these errors were encountered: