34 lines
877 B
JavaScript
34 lines
877 B
JavaScript
// Metro module 1330 (f1331).
|
|
import { MESSAGE_TYPE } from "./Module1318";
|
|
import { reflectionScalarDefault } from "./Module1328";
|
|
export function reflectionCreate(a0) {
|
|
const r0 = {};
|
|
Object.defineProperty(r0, MESSAGE_TYPE, {
|
|
enumerable: false,
|
|
value: a0
|
|
});
|
|
for (const field of a0.fields) {
|
|
const localName = field.localName;
|
|
if (!field.opt) {
|
|
const oneof = field.oneof;
|
|
if (oneof) {
|
|
r0[field.oneof] = {
|
|
oneofKind: void 0
|
|
};
|
|
} else if (field.repeat) {
|
|
r0[localName] = [];
|
|
} else {
|
|
const kind = field.kind;
|
|
if (kind === "scalar") {
|
|
r0[localName] = reflectionScalarDefault(field.T, field.L);
|
|
} else if (kind === "enum") {
|
|
r0[localName] = 0;
|
|
} else if (kind === "map") {
|
|
r0[localName] = {};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return r0;
|
|
}
|