James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | import { Monster as MyGameExample2Monster } from '../../my-game/example2/monster'; |
| 3 | import { Monster } from '../../my-game/example/monster'; |
| 4 | import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum'; |
| 5 | export var Any; |
| 6 | (function (Any) { |
| 7 | Any[Any["NONE"] = 0] = "NONE"; |
| 8 | Any[Any["Monster"] = 1] = "Monster"; |
| 9 | Any[Any["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum"; |
| 10 | Any[Any["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster"; |
| 11 | })(Any || (Any = {})); |
| 12 | export function unionToAny(type, accessor) { |
| 13 | switch (Any[type]) { |
| 14 | case 'NONE': return null; |
| 15 | case 'Monster': return accessor(new Monster()); |
| 16 | case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum()); |
| 17 | case 'MyGame_Example2_Monster': return accessor(new MyGameExample2Monster()); |
| 18 | default: return null; |
| 19 | } |
| 20 | } |
| 21 | export function unionListToAny(type, accessor, index) { |
| 22 | switch (Any[type]) { |
| 23 | case 'NONE': return null; |
| 24 | case 'Monster': return accessor(index, new Monster()); |
| 25 | case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum()); |
| 26 | case 'MyGame_Example2_Monster': return accessor(index, new MyGameExample2Monster()); |
| 27 | default: return null; |
| 28 | } |
| 29 | } |