Source code

Revision control

Copy as Markdown

Other Tools

// generated by diplomat-tool
import wasm from "./diplomat-wasm.mjs";
import * as diplomatRuntime from "./diplomat-runtime.mjs";
/**
*/
export class CalendarDateFromFieldsError {
#value = undefined;
static #values = new Map([
["Unknown", 0],
["OutOfRange", 1],
["UnknownEra", 2],
["MonthCodeInvalidSyntax", 3],
["MonthCodeNotInCalendar", 4],
["MonthCodeNotInYear", 5],
["InconsistentYear", 6],
["InconsistentMonth", 7],
["NotEnoughFields", 8]
]);
static getAllEntries() {
return CalendarDateFromFieldsError.#values.entries();
}
#internalConstructor(value) {
if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
// We pass in two internalConstructor arguments to create *new*
// instances of this type, otherwise the enums are treated as singletons.
if (arguments[1] === diplomatRuntime.internalConstructor ) {
this.#value = arguments[2];
return this;
}
return CalendarDateFromFieldsError.#objectValues[arguments[1]];
}
if (value instanceof CalendarDateFromFieldsError) {
return value;
}
let intVal = CalendarDateFromFieldsError.#values.get(value);
// Nullish check, checks for null or undefined
if (intVal != null) {
return CalendarDateFromFieldsError.#objectValues[intVal];
}
throw TypeError(value + " is not a CalendarDateFromFieldsError and does not correspond to any of its enumerator values.");
}
/** @internal */
static fromValue(value) {
return new CalendarDateFromFieldsError(value);
}
get value(){
return [...CalendarDateFromFieldsError.#values.keys()][this.#value];
}
/** @internal */
get ffiValue(){
return this.#value;
}
static #objectValues = [
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 8),
];
static Unknown = CalendarDateFromFieldsError.#objectValues[0];
static OutOfRange = CalendarDateFromFieldsError.#objectValues[1];
static UnknownEra = CalendarDateFromFieldsError.#objectValues[2];
static MonthCodeInvalidSyntax = CalendarDateFromFieldsError.#objectValues[3];
static MonthCodeNotInCalendar = CalendarDateFromFieldsError.#objectValues[4];
static MonthCodeNotInYear = CalendarDateFromFieldsError.#objectValues[5];
static InconsistentYear = CalendarDateFromFieldsError.#objectValues[6];
static InconsistentMonth = CalendarDateFromFieldsError.#objectValues[7];
static NotEnoughFields = CalendarDateFromFieldsError.#objectValues[8];
constructor(value) {
return this.#internalConstructor(...arguments)
}
}