1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var Printer_1 = require("../Printer");
|
4 | var util_1 = require("../util");
|
5 | function printOneOfDecl(oneOfDecl, oneOfFields, indentLevel) {
|
6 | var printer = new Printer_1.Printer(indentLevel);
|
7 | printer.printEmptyLn();
|
8 | var oneOfDeclName = oneOfDecl.getName() || util_1.throwError("Missing one_of name");
|
9 | printer.printLn("export enum " + util_1.oneOfName(oneOfDeclName) + "Case {");
|
10 | printer.printIndentedLn(oneOfDeclName.toUpperCase() + "_NOT_SET = 0,");
|
11 | oneOfFields.forEach(function (field) {
|
12 | var fieldName = field.getName() || util_1.throwError("Missing field name");
|
13 | printer.printIndentedLn(fieldName.toUpperCase() + " = " + field.getNumber() + ",");
|
14 | });
|
15 | printer.printLn("}");
|
16 | return printer.output;
|
17 | }
|
18 | exports.printOneOfDecl = printOneOfDecl;
|
19 |
|
\ | No newline at end of file |