UNPKG

897 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var Printer_1 = require("../Printer");
4var util_1 = require("../util");
5function 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}
18exports.printOneOfDecl = printOneOfDecl;
19//# sourceMappingURL=oneof.js.map
\No newline at end of file