main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
852 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | const codegen_1 = require("../../compile/codegen");
|
---|
| 4 | const util_1 = require("../../compile/util");
|
---|
| 5 | const equal_1 = require("../../runtime/equal");
|
---|
| 6 | const error = {
|
---|
| 7 | message: "must be equal to constant",
|
---|
| 8 | params: ({ schemaCode }) => (0, codegen_1._) `{allowedValue: ${schemaCode}}`,
|
---|
| 9 | };
|
---|
| 10 | const def = {
|
---|
| 11 | keyword: "const",
|
---|
| 12 | $data: true,
|
---|
| 13 | error,
|
---|
| 14 | code(cxt) {
|
---|
| 15 | const { gen, data, $data, schemaCode, schema } = cxt;
|
---|
| 16 | if ($data || (schema && typeof schema == "object")) {
|
---|
| 17 | cxt.fail$data((0, codegen_1._) `!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);
|
---|
| 18 | }
|
---|
| 19 | else {
|
---|
| 20 | cxt.fail((0, codegen_1._) `${schema} !== ${data}`);
|
---|
| 21 | }
|
---|
| 22 | },
|
---|
| 23 | };
|
---|
| 24 | exports.default = def;
|
---|
| 25 | //# sourceMappingURL=const.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.