mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-01 06:31:37 +00:00
Fix 64-bit numeric enum values in typescript (#7135)
* Fix 64-bit default numeric enum values in typescript If you had a default value that wasn't a valid enum value (e.g., a zero if you used a bit_flag setting, like you get with AdvancedFeatures in reflection.fbs), we weren't using BigInt. * Run generate_code.py * [DART] Handle deprecated fields & invalid enum defaults * Update .NET test
This commit is contained in:
32
tests/MyGame/Example/LongEnum.go
Normal file
32
tests/MyGame/Example/LongEnum.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import "strconv"
|
||||
|
||||
type LongEnum uint64
|
||||
|
||||
const (
|
||||
LongEnumLongOne LongEnum = 2
|
||||
LongEnumLongTwo LongEnum = 4
|
||||
LongEnumLongBig LongEnum = 1099511627776
|
||||
)
|
||||
|
||||
var EnumNamesLongEnum = map[LongEnum]string{
|
||||
LongEnumLongOne: "LongOne",
|
||||
LongEnumLongTwo: "LongTwo",
|
||||
LongEnumLongBig: "LongBig",
|
||||
}
|
||||
|
||||
var EnumValuesLongEnum = map[string]LongEnum{
|
||||
"LongOne": LongEnumLongOne,
|
||||
"LongTwo": LongEnumLongTwo,
|
||||
"LongBig": LongEnumLongBig,
|
||||
}
|
||||
|
||||
func (v LongEnum) String() string {
|
||||
if s, ok := EnumNamesLongEnum[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "LongEnum(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
Reference in New Issue
Block a user