@sourcemeta/blaze 16.7.0 → 16.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/describe.mjs +12 -5
- package/index.mjs +262 -262
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
CONTROL_JUMP, CONTROL_DYNAMIC_ANCHOR_JUMP
|
|
7
7
|
} from './opcodes.mjs';
|
|
8
8
|
|
|
9
|
-
const JSON_VERSION =
|
|
9
|
+
const JSON_VERSION = 6;
|
|
10
10
|
const DEPTH_LIMIT = 300;
|
|
11
11
|
const URI_REGEX = /^[a-zA-Z][a-zA-Z0-9+\-.]*:[^\s]*$/;
|
|
12
12
|
|
|
@@ -64,22 +64,22 @@ function resolveInstance(instance, relativeInstanceLocation) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function prepareInstruction(instruction) {
|
|
67
|
-
const wrapper = instruction[
|
|
67
|
+
const wrapper = instruction[6];
|
|
68
68
|
if (wrapper === undefined || wrapper === null) {
|
|
69
|
-
instruction[
|
|
69
|
+
instruction[6] = null;
|
|
70
70
|
} else {
|
|
71
71
|
const typeIndex = wrapper[0];
|
|
72
72
|
if (typeIndex === 0 || wrapper.length === 1) {
|
|
73
|
-
instruction[
|
|
73
|
+
instruction[6] = null;
|
|
74
74
|
} else {
|
|
75
75
|
const payload = wrapper[1];
|
|
76
76
|
switch (typeIndex) {
|
|
77
77
|
case 4:
|
|
78
|
-
instruction[
|
|
78
|
+
instruction[6] = payload[0];
|
|
79
79
|
break;
|
|
80
80
|
case 9:
|
|
81
|
-
try { instruction[
|
|
82
|
-
catch { instruction[
|
|
81
|
+
try { instruction[6] = new RegExp(payload, 'u'); }
|
|
82
|
+
catch { instruction[6] = new RegExp(payload); }
|
|
83
83
|
break;
|
|
84
84
|
case 13: {
|
|
85
85
|
if (Array.isArray(payload)) {
|
|
@@ -87,9 +87,9 @@ function prepareInstruction(instruction) {
|
|
|
87
87
|
for (let index = 0; index < payload.length; index++) {
|
|
88
88
|
object[payload[index][0]] = payload[index][1];
|
|
89
89
|
}
|
|
90
|
-
instruction[
|
|
90
|
+
instruction[6] = object;
|
|
91
91
|
} else {
|
|
92
|
-
instruction[
|
|
92
|
+
instruction[6] = payload;
|
|
93
93
|
}
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
@@ -99,9 +99,9 @@ function prepareInstruction(instruction) {
|
|
|
99
99
|
for (let index = 0; index < payload.length; index++) {
|
|
100
100
|
object[payload[index][0]] = payload[index][1];
|
|
101
101
|
}
|
|
102
|
-
instruction[
|
|
102
|
+
instruction[6] = object;
|
|
103
103
|
} else {
|
|
104
|
-
instruction[
|
|
104
|
+
instruction[6] = payload;
|
|
105
105
|
}
|
|
106
106
|
break;
|
|
107
107
|
}
|
|
@@ -112,19 +112,19 @@ function prepareInstruction(instruction) {
|
|
|
112
112
|
try { regexes[index] = new RegExp(regexes[index], 'u'); }
|
|
113
113
|
catch { regexes[index] = new RegExp(regexes[index]); }
|
|
114
114
|
}
|
|
115
|
-
instruction[
|
|
115
|
+
instruction[6] = payload;
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
118
118
|
default:
|
|
119
|
-
instruction[
|
|
119
|
+
instruction[6] = payload;
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const opcode = instruction[0];
|
|
126
|
-
if (opcode === ASSERTION_EQUALS_ANY && Array.isArray(instruction[
|
|
127
|
-
const values = instruction[
|
|
126
|
+
if (opcode === ASSERTION_EQUALS_ANY && Array.isArray(instruction[6])) {
|
|
127
|
+
const values = instruction[6];
|
|
128
128
|
let allPrimitive = true;
|
|
129
129
|
for (let index = 0; index < values.length; index++) {
|
|
130
130
|
const element = values[index];
|
|
@@ -134,17 +134,17 @@ function prepareInstruction(instruction) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
if (allPrimitive) {
|
|
137
|
-
instruction[
|
|
137
|
+
instruction[6] = { set: new Set(values), values, primitive: true };
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
if (instruction.length <
|
|
141
|
+
if (instruction.length < 8) {
|
|
142
142
|
instruction.push(undefined);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
instruction.push(handlers[opcode] || null);
|
|
146
146
|
|
|
147
|
-
const children = instruction[
|
|
147
|
+
const children = instruction[7];
|
|
148
148
|
if (children) {
|
|
149
149
|
for (let index = 0; index < children.length; index++) {
|
|
150
150
|
prepareInstruction(children[index]);
|
|
@@ -156,12 +156,12 @@ function resolveJumpTargets(instructions, targets) {
|
|
|
156
156
|
for (let index = 0; index < instructions.length; index++) {
|
|
157
157
|
const instruction = instructions[index];
|
|
158
158
|
if (instruction[0] === CONTROL_JUMP) {
|
|
159
|
-
const targetIndex = instruction[
|
|
159
|
+
const targetIndex = instruction[6];
|
|
160
160
|
if (targetIndex < targets.length) {
|
|
161
|
-
instruction[
|
|
161
|
+
instruction[6] = targets[targetIndex];
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
const children = instruction[
|
|
164
|
+
const children = instruction[7];
|
|
165
165
|
if (children) {
|
|
166
166
|
resolveJumpTargets(children, targets);
|
|
167
167
|
}
|
|
@@ -190,11 +190,11 @@ function collectAnchorNames(targets, result) {
|
|
|
190
190
|
function collectAnchorNamesFromInstructions(instructions, result) {
|
|
191
191
|
for (let index = 0; index < instructions.length; index++) {
|
|
192
192
|
const instruction = instructions[index];
|
|
193
|
-
if (instruction[0] === CONTROL_DYNAMIC_ANCHOR_JUMP && typeof instruction[
|
|
194
|
-
result.add(instruction[
|
|
193
|
+
if (instruction[0] === CONTROL_DYNAMIC_ANCHOR_JUMP && typeof instruction[6] === 'string') {
|
|
194
|
+
result.add(instruction[6]);
|
|
195
195
|
}
|
|
196
|
-
if (instruction[
|
|
197
|
-
collectAnchorNamesFromInstructions(instruction[
|
|
196
|
+
if (instruction[7]) {
|
|
197
|
+
collectAnchorNamesFromInstructions(instruction[7], result);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
}
|
|
@@ -236,7 +236,7 @@ function compile(template) {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
template[4] = labels;
|
|
239
|
-
template[
|
|
239
|
+
template[6] = anchors;
|
|
240
240
|
return template;
|
|
241
241
|
}
|
|
242
242
|
|
|
@@ -248,10 +248,10 @@ function emitResolve(varName, instanceExpr, relInstance) {
|
|
|
248
248
|
|
|
249
249
|
function compileInstructionToCode(instruction, captures, visited, budget) {
|
|
250
250
|
if (budget[0] <= 0) { var ci = captures.length; captures.push(instruction); return 'return _fh['+instruction[0]+'](_c['+ci+'],i,d,_t,_v);'; }
|
|
251
|
-
var opcode = instruction[0], ri = instruction[2], value = instruction[
|
|
251
|
+
var opcode = instruction[0], ri = instruction[2], value = instruction[6], children = instruction[7];
|
|
252
252
|
function R(v) { return emitResolve(v, 'i', ri); }
|
|
253
253
|
function inlineCondition(child, tv) {
|
|
254
|
-
var op = child[0], cr = child[2], cv = child[
|
|
254
|
+
var op = child[0], cr = child[2], cv = child[6];
|
|
255
255
|
if (cr.length !== 0) return null;
|
|
256
256
|
switch (op) {
|
|
257
257
|
case 11: return '{if(_es(' + tv + ')!==' + cv + ')return false;}';
|
|
@@ -317,8 +317,8 @@ function compileInstructionToCode(instruction, captures, visited, budget) {
|
|
|
317
317
|
case 61: { var r=R('t'); if(!r)return null; var c=r+TO+'return true;if(!Object.hasOwn(t,'+JSON.stringify(value)+'))return true;'; if(children&&children.length>0)c+=seq(children,'t'); return c+'return true;'; }
|
|
318
318
|
case 62: { var r=R('t'); if(!r)return null; var c=r+'if(!Array.isArray(t)||t.length<='+value+')return true;'; if(children&&children.length>0)c+=seq(children,'t'); return c+'return true;'; }
|
|
319
319
|
case 63: return fb(63); case 64: return fb(64);
|
|
320
|
-
case 65: { var r=R('t'); if(!r)return null; if(!children||children.length===0)return r+'return true;'; var mi=captures.length; captures.push(value); var gf=''; for(var gi=0;gi<children.length;gi++){var gc=children[gi][
|
|
321
|
-
case 66: { var r=R('t'); if(!r)return null; if(!children||children.length===0)return r+'return true;'; var mi=captures.length; captures.push(value); var gf=''; for(var gi=0;gi<children.length;gi++){var gc=children[gi][
|
|
320
|
+
case 65: { var r=R('t'); if(!r)return null; if(!children||children.length===0)return r+'return true;'; var mi=captures.length; captures.push(value); var gf=''; for(var gi=0;gi<children.length;gi++){var gc=children[gi][7]; if(gc&&gc.length>0){gf+='function(i,d,_t,_v){'+lb(gc,'i')+'return true;},';}else{gf+='null,';}} return r+TO+'return true;var __cg=['+gf+'];for(var k in t){var __mi=_c['+mi+'][k];if(__mi!==void 0){var __cf=__cg[__mi];if(__cf&&!__cf(t,d,_t,_v))return false;}}return true;'; }
|
|
321
|
+
case 66: { var r=R('t'); if(!r)return null; if(!children||children.length===0)return r+'return true;'; var mi=captures.length; captures.push(value); var gf=''; for(var gi=0;gi<children.length;gi++){var gc=children[gi][7]; if(gc&&gc.length>0){gf+='function(i,d,_t,_v){'+lb(gc,'i')+'return true;},';}else{gf+='null,';}} return r+TO+'return true;var __cg=['+gf+'];for(var k in t){var __mi=_c['+mi+'][k];if(__mi===void 0)return false;var __cf=__cg[__mi];if(__cf&&!__cf(t,d,_t,_v))return false;}return true;'; }
|
|
322
322
|
case 67: { var r=R('t'); if(!r)return null; if(!children||children.length===0)return r+'return true;'; return r+TO+'return true;for(var k in t){'+lb(children,'t[k]')+'}return true;'; }
|
|
323
323
|
case 68: return fb(68); case 69: return fb(69); case 70: return fb(70); case 71: return fb(71); case 72: return fb(72);
|
|
324
324
|
case 73: return fb(73); case 74: return fb(74); case 75: return fb(75); case 76: return fb(76);
|
|
@@ -534,7 +534,7 @@ class Blaze {
|
|
|
534
534
|
this.callback("post", result, instruction,
|
|
535
535
|
buildJsonPointer(this.evaluatePathTokens, this.evaluatePathLength),
|
|
536
536
|
buildJsonPointer(this.instanceLocationTokens, this.instanceLocationLength),
|
|
537
|
-
isAnnotation ? instruction[
|
|
537
|
+
isAnnotation ? instruction[6] : null);
|
|
538
538
|
if (!this.trackMode) {
|
|
539
539
|
this.popPath(instruction[1].length);
|
|
540
540
|
}
|
|
@@ -561,7 +561,7 @@ class Blaze {
|
|
|
561
561
|
const parentLength = this.instanceLocationLength > 0 ? this.instanceLocationLength - 1 : 0;
|
|
562
562
|
instanceLocation = buildJsonPointer(this.instanceLocationTokens, parentLength);
|
|
563
563
|
}
|
|
564
|
-
let annotationValue = instruction[
|
|
564
|
+
let annotationValue = instruction[6];
|
|
565
565
|
if (opcode === ANNOTATION_BASENAME_TO_PARENT && this.instanceLocationLength > 0) {
|
|
566
566
|
annotationValue = this.instanceLocationTokens[this.instanceLocationLength - 1];
|
|
567
567
|
}
|
|
@@ -896,7 +896,7 @@ function AssertionDefines(instruction, instance, depth, template, evaluator) {
|
|
|
896
896
|
const target = resolveInstance(instance, instruction[2]);
|
|
897
897
|
if (!isObject(target)) return true;
|
|
898
898
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
899
|
-
const __result = Object.hasOwn(target, instruction[
|
|
899
|
+
const __result = Object.hasOwn(target, instruction[6]);
|
|
900
900
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
901
901
|
return __result;
|
|
902
902
|
};
|
|
@@ -908,7 +908,7 @@ function AssertionDefinesStrict(instruction, instance, depth, template, evaluato
|
|
|
908
908
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
909
909
|
return false;
|
|
910
910
|
}
|
|
911
|
-
const __result = Object.hasOwn(target, instruction[
|
|
911
|
+
const __result = Object.hasOwn(target, instruction[6]);
|
|
912
912
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
913
913
|
return __result;
|
|
914
914
|
};
|
|
@@ -917,7 +917,7 @@ function AssertionDefinesAll(instruction, instance, depth, template, evaluator)
|
|
|
917
917
|
const target = resolveInstance(instance, instruction[2]);
|
|
918
918
|
if (!isObject(target)) return true;
|
|
919
919
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
920
|
-
const strings = instruction[
|
|
920
|
+
const strings = instruction[6];
|
|
921
921
|
for (let index = 0; index < strings.length; index++) {
|
|
922
922
|
if (!Object.hasOwn(target, strings[index])) {
|
|
923
923
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -935,7 +935,7 @@ function AssertionDefinesAllStrict(instruction, instance, depth, template, evalu
|
|
|
935
935
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
936
936
|
return false;
|
|
937
937
|
}
|
|
938
|
-
const strings = instruction[
|
|
938
|
+
const strings = instruction[6];
|
|
939
939
|
for (let index = 0; index < strings.length; index++) {
|
|
940
940
|
if (!Object.hasOwn(target, strings[index])) {
|
|
941
941
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -952,7 +952,7 @@ function AssertionDefinesExactly(instruction, instance, depth, template, evaluat
|
|
|
952
952
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
953
953
|
let targetSize = 0;
|
|
954
954
|
for (const key in target) targetSize++;
|
|
955
|
-
const strings = instruction[
|
|
955
|
+
const strings = instruction[6];
|
|
956
956
|
if (targetSize !== strings.length) {
|
|
957
957
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
958
958
|
return false;
|
|
@@ -976,7 +976,7 @@ function AssertionDefinesExactlyStrict(instruction, instance, depth, template, e
|
|
|
976
976
|
}
|
|
977
977
|
let targetSize = 0;
|
|
978
978
|
for (const key in target) targetSize++;
|
|
979
|
-
const strings = instruction[
|
|
979
|
+
const strings = instruction[6];
|
|
980
980
|
if (targetSize !== strings.length) {
|
|
981
981
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
982
982
|
return false;
|
|
@@ -998,7 +998,7 @@ function AssertionDefinesExactlyStrictHash3(instruction, instance, depth, templa
|
|
|
998
998
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
999
999
|
return false;
|
|
1000
1000
|
}
|
|
1001
|
-
const entries = instruction[
|
|
1001
|
+
const entries = instruction[6][0];
|
|
1002
1002
|
let count = 0;
|
|
1003
1003
|
for (const key in target) count++;
|
|
1004
1004
|
if (count !== 3) {
|
|
@@ -1016,7 +1016,7 @@ function AssertionPropertyDependencies(instruction, instance, depth, template, e
|
|
|
1016
1016
|
const target = resolveInstance(instance, instruction[2]);
|
|
1017
1017
|
if (!isObject(target)) return true;
|
|
1018
1018
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1019
|
-
const value = instruction[
|
|
1019
|
+
const value = instruction[6];
|
|
1020
1020
|
for (const property in value) {
|
|
1021
1021
|
if (!Object.hasOwn(target, property)) continue;
|
|
1022
1022
|
const dependencies = value[property];
|
|
@@ -1034,7 +1034,7 @@ function AssertionPropertyDependencies(instruction, instance, depth, template, e
|
|
|
1034
1034
|
function AssertionType(instruction, instance, depth, template, evaluator) {
|
|
1035
1035
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1036
1036
|
const target = resolveInstance(instance, instruction[2]);
|
|
1037
|
-
const expected = instruction[
|
|
1037
|
+
const expected = instruction[6];
|
|
1038
1038
|
const actual = jsonTypeOf(target);
|
|
1039
1039
|
if (actual === expected) {
|
|
1040
1040
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
@@ -1051,7 +1051,7 @@ function AssertionType(instruction, instance, depth, template, evaluator) {
|
|
|
1051
1051
|
function AssertionTypeAny(instruction, instance, depth, template, evaluator) {
|
|
1052
1052
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1053
1053
|
const target = resolveInstance(instance, instruction[2]);
|
|
1054
|
-
const bitmask = instruction[
|
|
1054
|
+
const bitmask = instruction[6];
|
|
1055
1055
|
const typeIndex = jsonTypeOf(target);
|
|
1056
1056
|
if (typeSetTest(bitmask, typeIndex)) {
|
|
1057
1057
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
@@ -1068,7 +1068,7 @@ function AssertionTypeAny(instruction, instance, depth, template, evaluator) {
|
|
|
1068
1068
|
function AssertionTypeStrict(instruction, instance, depth, template, evaluator) {
|
|
1069
1069
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1070
1070
|
const target = resolveInstance(instance, instruction[2]);
|
|
1071
|
-
const __result = effectiveTypeStrictReal(target) === instruction[
|
|
1071
|
+
const __result = effectiveTypeStrictReal(target) === instruction[6];
|
|
1072
1072
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1073
1073
|
return __result;
|
|
1074
1074
|
};
|
|
@@ -1076,7 +1076,7 @@ function AssertionTypeStrict(instruction, instance, depth, template, evaluator)
|
|
|
1076
1076
|
function AssertionTypeStrictAny(instruction, instance, depth, template, evaluator) {
|
|
1077
1077
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1078
1078
|
const target = resolveInstance(instance, instruction[2]);
|
|
1079
|
-
const __result = typeSetTest(instruction[
|
|
1079
|
+
const __result = typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
1080
1080
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1081
1081
|
return __result;
|
|
1082
1082
|
};
|
|
@@ -1084,7 +1084,7 @@ function AssertionTypeStrictAny(instruction, instance, depth, template, evaluato
|
|
|
1084
1084
|
function AssertionNotTypeStrictAny(instruction, instance, depth, template, evaluator) {
|
|
1085
1085
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1086
1086
|
const target = resolveInstance(instance, instruction[2]);
|
|
1087
|
-
const __result = !typeSetTest(instruction[
|
|
1087
|
+
const __result = !typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
1088
1088
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1089
1089
|
return __result;
|
|
1090
1090
|
};
|
|
@@ -1096,7 +1096,7 @@ function AssertionTypeStringBounded(instruction, instance, depth, template, eval
|
|
|
1096
1096
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
1097
1097
|
return false;
|
|
1098
1098
|
}
|
|
1099
|
-
const range = instruction[
|
|
1099
|
+
const range = instruction[6];
|
|
1100
1100
|
const length = unicodeLength(target);
|
|
1101
1101
|
if (length < range[0]) {
|
|
1102
1102
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -1113,7 +1113,7 @@ function AssertionTypeStringBounded(instruction, instance, depth, template, eval
|
|
|
1113
1113
|
function AssertionTypeStringUpper(instruction, instance, depth, template, evaluator) {
|
|
1114
1114
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1115
1115
|
const target = resolveInstance(instance, instruction[2]);
|
|
1116
|
-
const __result = typeof target === 'string' && unicodeLength(target) <= instruction[
|
|
1116
|
+
const __result = typeof target === 'string' && unicodeLength(target) <= instruction[6];
|
|
1117
1117
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1118
1118
|
return __result;
|
|
1119
1119
|
};
|
|
@@ -1125,7 +1125,7 @@ function AssertionTypeArrayBounded(instruction, instance, depth, template, evalu
|
|
|
1125
1125
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
1126
1126
|
return false;
|
|
1127
1127
|
}
|
|
1128
|
-
const range = instruction[
|
|
1128
|
+
const range = instruction[6];
|
|
1129
1129
|
if (target.length < range[0]) {
|
|
1130
1130
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
1131
1131
|
return false;
|
|
@@ -1141,7 +1141,7 @@ function AssertionTypeArrayBounded(instruction, instance, depth, template, evalu
|
|
|
1141
1141
|
function AssertionTypeArrayUpper(instruction, instance, depth, template, evaluator) {
|
|
1142
1142
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1143
1143
|
const target = resolveInstance(instance, instruction[2]);
|
|
1144
|
-
const __result = Array.isArray(target) && target.length <= instruction[
|
|
1144
|
+
const __result = Array.isArray(target) && target.length <= instruction[6];
|
|
1145
1145
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1146
1146
|
return __result;
|
|
1147
1147
|
};
|
|
@@ -1153,7 +1153,7 @@ function AssertionTypeObjectBounded(instruction, instance, depth, template, eval
|
|
|
1153
1153
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
1154
1154
|
return false;
|
|
1155
1155
|
}
|
|
1156
|
-
const range = instruction[
|
|
1156
|
+
const range = instruction[6];
|
|
1157
1157
|
const size = objectSize(target);
|
|
1158
1158
|
if (size < range[0]) {
|
|
1159
1159
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -1174,7 +1174,7 @@ function AssertionTypeObjectUpper(instruction, instance, depth, template, evalua
|
|
|
1174
1174
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
1175
1175
|
return false;
|
|
1176
1176
|
}
|
|
1177
|
-
const __result = objectSize(target) <= instruction[
|
|
1177
|
+
const __result = objectSize(target) <= instruction[6];
|
|
1178
1178
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1179
1179
|
return __result;
|
|
1180
1180
|
};
|
|
@@ -1184,7 +1184,7 @@ function AssertionRegex(instruction, instance, depth, template, evaluator) {
|
|
|
1184
1184
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
1185
1185
|
if (typeof target !== 'string') return true;
|
|
1186
1186
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1187
|
-
const __result = instruction[
|
|
1187
|
+
const __result = instruction[6].test(target);
|
|
1188
1188
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1189
1189
|
return __result;
|
|
1190
1190
|
};
|
|
@@ -1194,7 +1194,7 @@ function AssertionStringSizeLess(instruction, instance, depth, template, evaluat
|
|
|
1194
1194
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
1195
1195
|
if (typeof target !== 'string') return true;
|
|
1196
1196
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1197
|
-
const __result = unicodeLength(target) < instruction[
|
|
1197
|
+
const __result = unicodeLength(target) < instruction[6];
|
|
1198
1198
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1199
1199
|
return __result;
|
|
1200
1200
|
};
|
|
@@ -1204,7 +1204,7 @@ function AssertionStringSizeGreater(instruction, instance, depth, template, eval
|
|
|
1204
1204
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
1205
1205
|
if (typeof target !== 'string') return true;
|
|
1206
1206
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1207
|
-
const __result = unicodeLength(target) > instruction[
|
|
1207
|
+
const __result = unicodeLength(target) > instruction[6];
|
|
1208
1208
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1209
1209
|
return __result;
|
|
1210
1210
|
};
|
|
@@ -1213,7 +1213,7 @@ function AssertionArraySizeLess(instruction, instance, depth, template, evaluato
|
|
|
1213
1213
|
const target = resolveInstance(instance, instruction[2]);
|
|
1214
1214
|
if (!Array.isArray(target)) return true;
|
|
1215
1215
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1216
|
-
const __result = target.length < instruction[
|
|
1216
|
+
const __result = target.length < instruction[6];
|
|
1217
1217
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1218
1218
|
return __result;
|
|
1219
1219
|
};
|
|
@@ -1222,7 +1222,7 @@ function AssertionArraySizeGreater(instruction, instance, depth, template, evalu
|
|
|
1222
1222
|
const target = resolveInstance(instance, instruction[2]);
|
|
1223
1223
|
if (!Array.isArray(target)) return true;
|
|
1224
1224
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1225
|
-
const __result = target.length > instruction[
|
|
1225
|
+
const __result = target.length > instruction[6];
|
|
1226
1226
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1227
1227
|
return __result;
|
|
1228
1228
|
};
|
|
@@ -1231,7 +1231,7 @@ function AssertionObjectSizeLess(instruction, instance, depth, template, evaluat
|
|
|
1231
1231
|
const target = resolveInstance(instance, instruction[2]);
|
|
1232
1232
|
if (!isObject(target)) return true;
|
|
1233
1233
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1234
|
-
const __result = objectSize(target) < instruction[
|
|
1234
|
+
const __result = objectSize(target) < instruction[6];
|
|
1235
1235
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1236
1236
|
return __result;
|
|
1237
1237
|
};
|
|
@@ -1240,7 +1240,7 @@ function AssertionObjectSizeGreater(instruction, instance, depth, template, eval
|
|
|
1240
1240
|
const target = resolveInstance(instance, instruction[2]);
|
|
1241
1241
|
if (!isObject(target)) return true;
|
|
1242
1242
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1243
|
-
const __result = objectSize(target) > instruction[
|
|
1243
|
+
const __result = objectSize(target) > instruction[6];
|
|
1244
1244
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1245
1245
|
return __result;
|
|
1246
1246
|
};
|
|
@@ -1249,10 +1249,10 @@ function AssertionEqual(instruction, instance, depth, template, evaluator) {
|
|
|
1249
1249
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1250
1250
|
let __result;
|
|
1251
1251
|
if (evaluator.propertyTarget !== undefined) {
|
|
1252
|
-
const value = instruction[
|
|
1252
|
+
const value = instruction[6];
|
|
1253
1253
|
__result = typeof value === 'string' && value === evaluator.propertyTarget;
|
|
1254
1254
|
} else {
|
|
1255
|
-
__result = jsonEqual(resolveInstance(instance, instruction[2]), instruction[
|
|
1255
|
+
__result = jsonEqual(resolveInstance(instance, instruction[2]), instruction[6]);
|
|
1256
1256
|
}
|
|
1257
1257
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1258
1258
|
return __result;
|
|
@@ -1260,7 +1260,7 @@ function AssertionEqual(instruction, instance, depth, template, evaluator) {
|
|
|
1260
1260
|
|
|
1261
1261
|
function AssertionEqualsAny(instruction, instance, depth, template, evaluator) {
|
|
1262
1262
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1263
|
-
const value = instruction[
|
|
1263
|
+
const value = instruction[6];
|
|
1264
1264
|
const target = evaluator.propertyTarget !== undefined
|
|
1265
1265
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
1266
1266
|
if (value.primitive) {
|
|
@@ -1289,7 +1289,7 @@ function AssertionEqualsAnyStringHash(instruction, instance, depth, template, ev
|
|
|
1289
1289
|
return false;
|
|
1290
1290
|
}
|
|
1291
1291
|
|
|
1292
|
-
const value = instruction[
|
|
1292
|
+
const value = instruction[6];
|
|
1293
1293
|
const entries = value[0];
|
|
1294
1294
|
const tableOfContents = value[1];
|
|
1295
1295
|
|
|
@@ -1319,7 +1319,7 @@ function AssertionGreaterEqual(instruction, instance, depth, template, evaluator
|
|
|
1319
1319
|
const targetType = typeof target;
|
|
1320
1320
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
1321
1321
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1322
|
-
const __result = target >= instruction[
|
|
1322
|
+
const __result = target >= instruction[6];
|
|
1323
1323
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1324
1324
|
return __result;
|
|
1325
1325
|
};
|
|
@@ -1329,7 +1329,7 @@ function AssertionLessEqual(instruction, instance, depth, template, evaluator) {
|
|
|
1329
1329
|
const targetType = typeof target;
|
|
1330
1330
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
1331
1331
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1332
|
-
const __result = target <= instruction[
|
|
1332
|
+
const __result = target <= instruction[6];
|
|
1333
1333
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1334
1334
|
return __result;
|
|
1335
1335
|
};
|
|
@@ -1339,7 +1339,7 @@ function AssertionGreater(instruction, instance, depth, template, evaluator) {
|
|
|
1339
1339
|
const targetType = typeof target;
|
|
1340
1340
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
1341
1341
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1342
|
-
const __result = target > instruction[
|
|
1342
|
+
const __result = target > instruction[6];
|
|
1343
1343
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1344
1344
|
return __result;
|
|
1345
1345
|
};
|
|
@@ -1349,7 +1349,7 @@ function AssertionLess(instruction, instance, depth, template, evaluator) {
|
|
|
1349
1349
|
const targetType = typeof target;
|
|
1350
1350
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
1351
1351
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1352
|
-
const __result = target < instruction[
|
|
1352
|
+
const __result = target < instruction[6];
|
|
1353
1353
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1354
1354
|
return __result;
|
|
1355
1355
|
};
|
|
@@ -1368,7 +1368,7 @@ function AssertionDivisible(instruction, instance, depth, template, evaluator) {
|
|
|
1368
1368
|
const targetType = typeof target;
|
|
1369
1369
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
1370
1370
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1371
|
-
const __result = isDivisibleBy(target, instruction[
|
|
1371
|
+
const __result = isDivisibleBy(target, instruction[6]);
|
|
1372
1372
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1373
1373
|
return __result;
|
|
1374
1374
|
};
|
|
@@ -1376,7 +1376,7 @@ function AssertionDivisible(instruction, instance, depth, template, evaluator) {
|
|
|
1376
1376
|
function AssertionTypeIntegerBounded(instruction, instance, depth, template, evaluator) {
|
|
1377
1377
|
const target = resolveInstance(instance, instruction[2]);
|
|
1378
1378
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1379
|
-
const range = instruction[
|
|
1379
|
+
const range = instruction[6];
|
|
1380
1380
|
const __result = (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0] && target <= range[1];
|
|
1381
1381
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1382
1382
|
return __result;
|
|
@@ -1385,7 +1385,7 @@ function AssertionTypeIntegerBounded(instruction, instance, depth, template, eva
|
|
|
1385
1385
|
function AssertionTypeIntegerBoundedStrict(instruction, instance, depth, template, evaluator) {
|
|
1386
1386
|
const target = resolveInstance(instance, instruction[2]);
|
|
1387
1387
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1388
|
-
const range = instruction[
|
|
1388
|
+
const range = instruction[6];
|
|
1389
1389
|
const __result = (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0] && target <= range[1];
|
|
1390
1390
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1391
1391
|
return __result;
|
|
@@ -1394,7 +1394,7 @@ function AssertionTypeIntegerBoundedStrict(instruction, instance, depth, templat
|
|
|
1394
1394
|
function AssertionTypeIntegerLowerBound(instruction, instance, depth, template, evaluator) {
|
|
1395
1395
|
const target = resolveInstance(instance, instruction[2]);
|
|
1396
1396
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1397
|
-
const range = instruction[
|
|
1397
|
+
const range = instruction[6];
|
|
1398
1398
|
const __result = (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0];
|
|
1399
1399
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1400
1400
|
return __result;
|
|
@@ -1403,7 +1403,7 @@ function AssertionTypeIntegerLowerBound(instruction, instance, depth, template,
|
|
|
1403
1403
|
function AssertionTypeIntegerLowerBoundStrict(instruction, instance, depth, template, evaluator) {
|
|
1404
1404
|
const target = resolveInstance(instance, instruction[2]);
|
|
1405
1405
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1406
|
-
const range = instruction[
|
|
1406
|
+
const range = instruction[6];
|
|
1407
1407
|
const __result = (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0];
|
|
1408
1408
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1409
1409
|
return __result;
|
|
@@ -1424,7 +1424,7 @@ function AssertionPropertyType(instruction, instance, depth, template, evaluator
|
|
|
1424
1424
|
const target = resolveInstance(instance, instruction[2]);
|
|
1425
1425
|
if (target === undefined) return true;
|
|
1426
1426
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1427
|
-
const expected = instruction[
|
|
1427
|
+
const expected = instruction[6];
|
|
1428
1428
|
const actual = jsonTypeOf(target);
|
|
1429
1429
|
const __result = actual === expected || (expected === Type.Integer && isIntegral(target));
|
|
1430
1430
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
@@ -1436,7 +1436,7 @@ function AssertionPropertyTypeEvaluate(instruction, instance, depth, template, e
|
|
|
1436
1436
|
const target = resolveInstance(instance, instruction[2]);
|
|
1437
1437
|
if (target === undefined) return true;
|
|
1438
1438
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1439
|
-
const expected = instruction[
|
|
1439
|
+
const expected = instruction[6];
|
|
1440
1440
|
const actual = jsonTypeOf(target);
|
|
1441
1441
|
const result = actual === expected || (expected === Type.Integer && isIntegral(target));
|
|
1442
1442
|
if (result && evaluator.trackMode) {
|
|
@@ -1452,7 +1452,7 @@ function AssertionPropertyTypeStrict(instruction, instance, depth, template, eva
|
|
|
1452
1452
|
const target = resolveInstance(instance, instruction[2]);
|
|
1453
1453
|
if (target === undefined) return true;
|
|
1454
1454
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1455
|
-
const __result = effectiveTypeStrictReal(target) === instruction[
|
|
1455
|
+
const __result = effectiveTypeStrictReal(target) === instruction[6];
|
|
1456
1456
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1457
1457
|
return __result;
|
|
1458
1458
|
};
|
|
@@ -1462,7 +1462,7 @@ function AssertionPropertyTypeStrictEvaluate(instruction, instance, depth, templ
|
|
|
1462
1462
|
const target = resolveInstance(instance, instruction[2]);
|
|
1463
1463
|
if (target === undefined) return true;
|
|
1464
1464
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1465
|
-
const result = effectiveTypeStrictReal(target) === instruction[
|
|
1465
|
+
const result = effectiveTypeStrictReal(target) === instruction[6];
|
|
1466
1466
|
if (result && evaluator.trackMode) {
|
|
1467
1467
|
const location = instruction[2];
|
|
1468
1468
|
evaluator.markEvaluated(target, instance, location.length > 0 ? location[location.length - 1] : undefined);
|
|
@@ -1476,7 +1476,7 @@ function AssertionPropertyTypeStrictAny(instruction, instance, depth, template,
|
|
|
1476
1476
|
const target = resolveInstance(instance, instruction[2]);
|
|
1477
1477
|
if (target === undefined) return true;
|
|
1478
1478
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1479
|
-
const __result = typeSetTest(instruction[
|
|
1479
|
+
const __result = typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
1480
1480
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, __result);
|
|
1481
1481
|
return __result;
|
|
1482
1482
|
};
|
|
@@ -1486,7 +1486,7 @@ function AssertionPropertyTypeStrictAnyEvaluate(instruction, instance, depth, te
|
|
|
1486
1486
|
const target = resolveInstance(instance, instruction[2]);
|
|
1487
1487
|
if (target === undefined) return true;
|
|
1488
1488
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1489
|
-
const result = typeSetTest(instruction[
|
|
1489
|
+
const result = typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
1490
1490
|
if (result && evaluator.trackMode) {
|
|
1491
1491
|
const location = instruction[2];
|
|
1492
1492
|
evaluator.markEvaluated(target, instance, location.length > 0 ? location[location.length - 1] : undefined);
|
|
@@ -1503,11 +1503,11 @@ function AssertionArrayPrefix(instruction, instance, depth, template, evaluator)
|
|
|
1503
1503
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
1504
1504
|
return true;
|
|
1505
1505
|
}
|
|
1506
|
-
const children = instruction[
|
|
1506
|
+
const children = instruction[7];
|
|
1507
1507
|
const prefixes = children.length - 1;
|
|
1508
1508
|
const pointer = target.length === prefixes ? prefixes : Math.min(target.length, prefixes) - 1;
|
|
1509
1509
|
const entry = children[pointer];
|
|
1510
|
-
const entryChildren = entry[
|
|
1510
|
+
const entryChildren = entry[7];
|
|
1511
1511
|
if (entryChildren) {
|
|
1512
1512
|
for (let index = 0; index < entryChildren.length; index++) {
|
|
1513
1513
|
if (!evaluateInstruction(entryChildren[index], target, depth + 1, template, evaluator)) {
|
|
@@ -1528,11 +1528,11 @@ function AssertionArrayPrefixEvaluate(instruction, instance, depth, template, ev
|
|
|
1528
1528
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
1529
1529
|
return true;
|
|
1530
1530
|
}
|
|
1531
|
-
const children = instruction[
|
|
1531
|
+
const children = instruction[7];
|
|
1532
1532
|
const prefixes = children.length - 1;
|
|
1533
1533
|
const pointer = target.length === prefixes ? prefixes : Math.min(target.length, prefixes) - 1;
|
|
1534
1534
|
const entry = children[pointer];
|
|
1535
|
-
const entryChildren = entry[
|
|
1535
|
+
const entryChildren = entry[7];
|
|
1536
1536
|
if (entryChildren) {
|
|
1537
1537
|
for (let index = 0; index < entryChildren.length; index++) {
|
|
1538
1538
|
if (!evaluateInstruction(entryChildren[index], target, depth + 1, template, evaluator)) {
|
|
@@ -1561,8 +1561,8 @@ function AssertionObjectPropertiesSimple(instruction, instance, depth, template,
|
|
|
1561
1561
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
1562
1562
|
return false;
|
|
1563
1563
|
}
|
|
1564
|
-
const value = instruction[
|
|
1565
|
-
const children = instruction[
|
|
1564
|
+
const value = instruction[6];
|
|
1565
|
+
const children = instruction[7];
|
|
1566
1566
|
for (let index = 0; index < value.length; index++) {
|
|
1567
1567
|
const entry = value[index];
|
|
1568
1568
|
const name = entry[0];
|
|
@@ -1611,7 +1611,7 @@ function Evaluate(instruction, instance, depth, template, evaluator) {
|
|
|
1611
1611
|
function LogicalNot(instruction, instance, depth, template, evaluator) {
|
|
1612
1612
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1613
1613
|
const target = resolveInstance(instance, instruction[2]);
|
|
1614
|
-
const children = instruction[
|
|
1614
|
+
const children = instruction[7];
|
|
1615
1615
|
if (children) {
|
|
1616
1616
|
for (let index = 0; index < children.length; index++) {
|
|
1617
1617
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) {
|
|
@@ -1627,7 +1627,7 @@ function LogicalNot(instruction, instance, depth, template, evaluator) {
|
|
|
1627
1627
|
function LogicalNotEvaluate(instruction, instance, depth, template, evaluator) {
|
|
1628
1628
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1629
1629
|
const target = resolveInstance(instance, instruction[2]);
|
|
1630
|
-
const children = instruction[
|
|
1630
|
+
const children = instruction[7];
|
|
1631
1631
|
let result = false;
|
|
1632
1632
|
if (children) {
|
|
1633
1633
|
for (let index = 0; index < children.length; index++) {
|
|
@@ -1644,13 +1644,13 @@ function LogicalNotEvaluate(instruction, instance, depth, template, evaluator) {
|
|
|
1644
1644
|
|
|
1645
1645
|
function LogicalOr(instruction, instance, depth, template, evaluator) {
|
|
1646
1646
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1647
|
-
const children = instruction[
|
|
1647
|
+
const children = instruction[7];
|
|
1648
1648
|
if (!children || children.length === 0) {
|
|
1649
1649
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
1650
1650
|
return true;
|
|
1651
1651
|
}
|
|
1652
1652
|
const target = resolveInstance(instance, instruction[2]);
|
|
1653
|
-
const exhaustive = instruction[
|
|
1653
|
+
const exhaustive = instruction[6];
|
|
1654
1654
|
let result = false;
|
|
1655
1655
|
if (exhaustive) {
|
|
1656
1656
|
for (let index = 0; index < children.length; index++) {
|
|
@@ -1678,7 +1678,7 @@ function LogicalOr(instruction, instance, depth, template, evaluator) {
|
|
|
1678
1678
|
function LogicalAnd(instruction, instance, depth, template, evaluator) {
|
|
1679
1679
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1680
1680
|
const target = resolveInstance(instance, instruction[2]);
|
|
1681
|
-
const children = instruction[
|
|
1681
|
+
const children = instruction[7];
|
|
1682
1682
|
if (children) {
|
|
1683
1683
|
for (let index = 0; index < children.length; index++) {
|
|
1684
1684
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) {
|
|
@@ -1694,8 +1694,8 @@ function LogicalAnd(instruction, instance, depth, template, evaluator) {
|
|
|
1694
1694
|
function LogicalXor(instruction, instance, depth, template, evaluator) {
|
|
1695
1695
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1696
1696
|
const target = resolveInstance(instance, instruction[2]);
|
|
1697
|
-
const exhaustive = instruction[
|
|
1698
|
-
const children = instruction[
|
|
1697
|
+
const exhaustive = instruction[6];
|
|
1698
|
+
const children = instruction[7];
|
|
1699
1699
|
let result = true;
|
|
1700
1700
|
let hasMatched = false;
|
|
1701
1701
|
if (children) {
|
|
@@ -1720,10 +1720,10 @@ function LogicalXor(instruction, instance, depth, template, evaluator) {
|
|
|
1720
1720
|
|
|
1721
1721
|
function LogicalCondition(instruction, instance, depth, template, evaluator) {
|
|
1722
1722
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1723
|
-
const value = instruction[
|
|
1723
|
+
const value = instruction[6];
|
|
1724
1724
|
const thenStart = value[0];
|
|
1725
1725
|
const elseStart = value[1];
|
|
1726
|
-
const children = instruction[
|
|
1726
|
+
const children = instruction[7];
|
|
1727
1727
|
const childrenSize = children ? children.length : 0;
|
|
1728
1728
|
|
|
1729
1729
|
const target = resolveInstance(instance, instruction[2]);
|
|
@@ -1774,9 +1774,9 @@ function LogicalCondition(instruction, instance, depth, template, evaluator) {
|
|
|
1774
1774
|
|
|
1775
1775
|
function LogicalWhenType(instruction, instance, depth, template, evaluator) {
|
|
1776
1776
|
const target = resolveInstance(instance, instruction[2]);
|
|
1777
|
-
if (jsonTypeOf(target) !== instruction[
|
|
1777
|
+
if (jsonTypeOf(target) !== instruction[6]) return true;
|
|
1778
1778
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1779
|
-
const children = instruction[
|
|
1779
|
+
const children = instruction[7];
|
|
1780
1780
|
if (children) {
|
|
1781
1781
|
for (let index = 0; index < children.length; index++) {
|
|
1782
1782
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) {
|
|
@@ -1792,9 +1792,9 @@ function LogicalWhenType(instruction, instance, depth, template, evaluator) {
|
|
|
1792
1792
|
function LogicalWhenDefines(instruction, instance, depth, template, evaluator) {
|
|
1793
1793
|
const target = resolveInstance(instance, instruction[2]);
|
|
1794
1794
|
if (!isObject(target)) return true;
|
|
1795
|
-
if (!Object.hasOwn(target, instruction[
|
|
1795
|
+
if (!Object.hasOwn(target, instruction[6])) return true;
|
|
1796
1796
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1797
|
-
const children = instruction[
|
|
1797
|
+
const children = instruction[7];
|
|
1798
1798
|
if (children) {
|
|
1799
1799
|
for (let index = 0; index < children.length; index++) {
|
|
1800
1800
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) {
|
|
@@ -1809,9 +1809,9 @@ function LogicalWhenDefines(instruction, instance, depth, template, evaluator) {
|
|
|
1809
1809
|
|
|
1810
1810
|
function LogicalWhenArraySizeGreater(instruction, instance, depth, template, evaluator) {
|
|
1811
1811
|
const target = resolveInstance(instance, instruction[2]);
|
|
1812
|
-
if (!Array.isArray(target) || target.length <= instruction[
|
|
1812
|
+
if (!Array.isArray(target) || target.length <= instruction[6]) return true;
|
|
1813
1813
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1814
|
-
const children = instruction[
|
|
1814
|
+
const children = instruction[7];
|
|
1815
1815
|
if (children) {
|
|
1816
1816
|
for (let index = 0; index < children.length; index++) {
|
|
1817
1817
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) {
|
|
@@ -1832,7 +1832,7 @@ function LoopPropertiesUnevaluated(instruction, instance, depth, template, evalu
|
|
|
1832
1832
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
1833
1833
|
return true;
|
|
1834
1834
|
}
|
|
1835
|
-
const children = instruction[
|
|
1835
|
+
const children = instruction[7];
|
|
1836
1836
|
for (const key in target) {
|
|
1837
1837
|
if (evaluator.trackMode && evaluator.isEvaluated(target[key], target, key)) continue;
|
|
1838
1838
|
if (evaluator.callbackMode) evaluator.pushInstanceToken(key);
|
|
@@ -1860,11 +1860,11 @@ function LoopPropertiesUnevaluatedExcept(instruction, instance, depth, template,
|
|
|
1860
1860
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
1861
1861
|
return true;
|
|
1862
1862
|
}
|
|
1863
|
-
const filter = instruction[
|
|
1863
|
+
const filter = instruction[6];
|
|
1864
1864
|
const filterStrings = filter[0];
|
|
1865
1865
|
const filterPrefixes = filter[1];
|
|
1866
1866
|
const filterRegexes = filter[2];
|
|
1867
|
-
const children = instruction[
|
|
1867
|
+
const children = instruction[7];
|
|
1868
1868
|
for (const key in target) {
|
|
1869
1869
|
if (filterStrings.has(key)) continue;
|
|
1870
1870
|
let matched = false;
|
|
@@ -1899,12 +1899,12 @@ function LoopPropertiesMatch(instruction, instance, depth, template, evaluator)
|
|
|
1899
1899
|
const target = resolveInstance(instance, instruction[2]);
|
|
1900
1900
|
if (!isObject(target)) return true;
|
|
1901
1901
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1902
|
-
const children = instruction[
|
|
1902
|
+
const children = instruction[7];
|
|
1903
1903
|
for (const key in target) {
|
|
1904
|
-
const index = instruction[
|
|
1904
|
+
const index = instruction[6][key];
|
|
1905
1905
|
if (index === undefined) continue;
|
|
1906
1906
|
const subinstruction = children[index];
|
|
1907
|
-
const subchildren = subinstruction[
|
|
1907
|
+
const subchildren = subinstruction[7];
|
|
1908
1908
|
if (subchildren) {
|
|
1909
1909
|
for (let childIndex = 0; childIndex < subchildren.length; childIndex++) {
|
|
1910
1910
|
if (!evaluateInstruction(subchildren[childIndex], target, depth + 1, template, evaluator)) {
|
|
@@ -1922,15 +1922,15 @@ function LoopPropertiesMatchClosed(instruction, instance, depth, template, evalu
|
|
|
1922
1922
|
const target = resolveInstance(instance, instruction[2]);
|
|
1923
1923
|
if (!isObject(target)) return true;
|
|
1924
1924
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1925
|
-
const children = instruction[
|
|
1925
|
+
const children = instruction[7];
|
|
1926
1926
|
for (const key in target) {
|
|
1927
|
-
const index = instruction[
|
|
1927
|
+
const index = instruction[6][key];
|
|
1928
1928
|
if (index === undefined) {
|
|
1929
1929
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
1930
1930
|
return false;
|
|
1931
1931
|
}
|
|
1932
1932
|
const subinstruction = children[index];
|
|
1933
|
-
const subchildren = subinstruction[
|
|
1933
|
+
const subchildren = subinstruction[7];
|
|
1934
1934
|
if (subchildren) {
|
|
1935
1935
|
for (let childIndex = 0; childIndex < subchildren.length; childIndex++) {
|
|
1936
1936
|
if (!evaluateInstruction(subchildren[childIndex], target, depth + 1, template, evaluator)) {
|
|
@@ -1948,7 +1948,7 @@ function LoopProperties(instruction, instance, depth, template, evaluator) {
|
|
|
1948
1948
|
const target = resolveInstance(instance, instruction[2]);
|
|
1949
1949
|
if (!isObject(target)) return true;
|
|
1950
1950
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1951
|
-
const children = instruction[
|
|
1951
|
+
const children = instruction[7];
|
|
1952
1952
|
for (const key in target) {
|
|
1953
1953
|
evaluator.propertyParent = target;
|
|
1954
1954
|
evaluator.propertyKey = key;
|
|
@@ -1974,7 +1974,7 @@ function LoopPropertiesEvaluate(instruction, instance, depth, template, evaluato
|
|
|
1974
1974
|
const target = resolveInstance(instance, instruction[2]);
|
|
1975
1975
|
if (!isObject(target)) return true;
|
|
1976
1976
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
1977
|
-
const children = instruction[
|
|
1977
|
+
const children = instruction[7];
|
|
1978
1978
|
for (const key in target) {
|
|
1979
1979
|
evaluator.propertyParent = target;
|
|
1980
1980
|
evaluator.propertyKey = key;
|
|
@@ -2001,8 +2001,8 @@ function LoopPropertiesRegex(instruction, instance, depth, template, evaluator)
|
|
|
2001
2001
|
const target = resolveInstance(instance, instruction[2]);
|
|
2002
2002
|
if (!isObject(target)) return true;
|
|
2003
2003
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2004
|
-
const regex = instruction[
|
|
2005
|
-
const children = instruction[
|
|
2004
|
+
const regex = instruction[6];
|
|
2005
|
+
const children = instruction[7];
|
|
2006
2006
|
for (const key in target) {
|
|
2007
2007
|
regex.lastIndex = 0;
|
|
2008
2008
|
if (!regex.test(key)) continue;
|
|
@@ -2030,8 +2030,8 @@ function LoopPropertiesRegexClosed(instruction, instance, depth, template, evalu
|
|
|
2030
2030
|
const target = resolveInstance(instance, instruction[2]);
|
|
2031
2031
|
if (!isObject(target)) return true;
|
|
2032
2032
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2033
|
-
const regex = instruction[
|
|
2034
|
-
const children = instruction[
|
|
2033
|
+
const regex = instruction[6];
|
|
2034
|
+
const children = instruction[7];
|
|
2035
2035
|
for (const key in target) {
|
|
2036
2036
|
regex.lastIndex = 0;
|
|
2037
2037
|
if (!regex.test(key)) {
|
|
@@ -2062,8 +2062,8 @@ function LoopPropertiesStartsWith(instruction, instance, depth, template, evalua
|
|
|
2062
2062
|
const target = resolveInstance(instance, instruction[2]);
|
|
2063
2063
|
if (!isObject(target)) return true;
|
|
2064
2064
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2065
|
-
const prefix = instruction[
|
|
2066
|
-
const children = instruction[
|
|
2065
|
+
const prefix = instruction[6];
|
|
2066
|
+
const children = instruction[7];
|
|
2067
2067
|
for (const key in target) {
|
|
2068
2068
|
if (!key.startsWith(prefix)) continue;
|
|
2069
2069
|
evaluator.propertyParent = target;
|
|
@@ -2090,11 +2090,11 @@ function LoopPropertiesExcept(instruction, instance, depth, template, evaluator)
|
|
|
2090
2090
|
const target = resolveInstance(instance, instruction[2]);
|
|
2091
2091
|
if (!isObject(target)) return true;
|
|
2092
2092
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2093
|
-
const filter = instruction[
|
|
2093
|
+
const filter = instruction[6];
|
|
2094
2094
|
const filterStrings = filter[0];
|
|
2095
2095
|
const filterPrefixes = filter[1];
|
|
2096
2096
|
const filterRegexes = filter[2];
|
|
2097
|
-
const children = instruction[
|
|
2097
|
+
const children = instruction[7];
|
|
2098
2098
|
for (const key in target) {
|
|
2099
2099
|
if (filterStrings.has(key)) continue;
|
|
2100
2100
|
let matched = false;
|
|
@@ -2131,7 +2131,7 @@ function LoopPropertiesType(instruction, instance, depth, template, evaluator) {
|
|
|
2131
2131
|
const target = resolveInstance(instance, instruction[2]);
|
|
2132
2132
|
if (!isObject(target)) return true;
|
|
2133
2133
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2134
|
-
const expected = instruction[
|
|
2134
|
+
const expected = instruction[6];
|
|
2135
2135
|
for (const key in target) {
|
|
2136
2136
|
const actual = jsonTypeOf(target[key]);
|
|
2137
2137
|
if (actual !== expected && !(expected === Type.Integer && isIntegral(target[key]))) {
|
|
@@ -2147,7 +2147,7 @@ function LoopPropertiesTypeEvaluate(instruction, instance, depth, template, eval
|
|
|
2147
2147
|
const target = resolveInstance(instance, instruction[2]);
|
|
2148
2148
|
if (!isObject(target)) return true;
|
|
2149
2149
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2150
|
-
const expected = instruction[
|
|
2150
|
+
const expected = instruction[6];
|
|
2151
2151
|
for (const key in target) {
|
|
2152
2152
|
const actual = jsonTypeOf(target[key]);
|
|
2153
2153
|
if (actual !== expected && !(expected === Type.Integer && isIntegral(target[key]))) {
|
|
@@ -2167,7 +2167,7 @@ function LoopPropertiesExactlyTypeStrict(instruction, instance, depth, template,
|
|
|
2167
2167
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
2168
2168
|
return false;
|
|
2169
2169
|
}
|
|
2170
|
-
const value = instruction[
|
|
2170
|
+
const value = instruction[6];
|
|
2171
2171
|
const names = new Set(value[1]);
|
|
2172
2172
|
let count = 0;
|
|
2173
2173
|
for (const key in target) {
|
|
@@ -2189,7 +2189,7 @@ function LoopPropertiesExactlyTypeStrictHash(instruction, instance, depth, templ
|
|
|
2189
2189
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
2190
2190
|
return false;
|
|
2191
2191
|
}
|
|
2192
|
-
const value = instruction[
|
|
2192
|
+
const value = instruction[6];
|
|
2193
2193
|
const entries = value[1][0];
|
|
2194
2194
|
const expectedCount = entries.length;
|
|
2195
2195
|
let count = 0;
|
|
@@ -2218,7 +2218,7 @@ function LoopPropertiesTypeStrict(instruction, instance, depth, template, evalua
|
|
|
2218
2218
|
const target = resolveInstance(instance, instruction[2]);
|
|
2219
2219
|
if (!isObject(target)) return true;
|
|
2220
2220
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2221
|
-
const expected = instruction[
|
|
2221
|
+
const expected = instruction[6];
|
|
2222
2222
|
for (const key in target) {
|
|
2223
2223
|
if (effectiveTypeStrictReal(target[key]) !== expected) {
|
|
2224
2224
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -2233,7 +2233,7 @@ function LoopPropertiesTypeStrictEvaluate(instruction, instance, depth, template
|
|
|
2233
2233
|
const target = resolveInstance(instance, instruction[2]);
|
|
2234
2234
|
if (!isObject(target)) return true;
|
|
2235
2235
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2236
|
-
const expected = instruction[
|
|
2236
|
+
const expected = instruction[6];
|
|
2237
2237
|
for (const key in target) {
|
|
2238
2238
|
if (effectiveTypeStrictReal(target[key]) !== expected) {
|
|
2239
2239
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -2249,7 +2249,7 @@ function LoopPropertiesTypeStrictAny(instruction, instance, depth, template, eva
|
|
|
2249
2249
|
const target = resolveInstance(instance, instruction[2]);
|
|
2250
2250
|
if (!isObject(target)) return true;
|
|
2251
2251
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2252
|
-
const bitmask = instruction[
|
|
2252
|
+
const bitmask = instruction[6];
|
|
2253
2253
|
for (const key in target) {
|
|
2254
2254
|
if (!typeSetTest(bitmask, effectiveTypeStrictReal(target[key]))) {
|
|
2255
2255
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -2264,7 +2264,7 @@ function LoopPropertiesTypeStrictAnyEvaluate(instruction, instance, depth, templ
|
|
|
2264
2264
|
const target = resolveInstance(instance, instruction[2]);
|
|
2265
2265
|
if (!isObject(target)) return true;
|
|
2266
2266
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2267
|
-
const bitmask = instruction[
|
|
2267
|
+
const bitmask = instruction[6];
|
|
2268
2268
|
for (const key in target) {
|
|
2269
2269
|
if (!typeSetTest(bitmask, effectiveTypeStrictReal(target[key]))) {
|
|
2270
2270
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -2280,7 +2280,7 @@ function LoopKeys(instruction, instance, depth, template, evaluator) {
|
|
|
2280
2280
|
const target = resolveInstance(instance, instruction[2]);
|
|
2281
2281
|
if (!isObject(target)) return true;
|
|
2282
2282
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2283
|
-
const children = instruction[
|
|
2283
|
+
const children = instruction[7];
|
|
2284
2284
|
for (const key in target) {
|
|
2285
2285
|
if (evaluator.callbackMode) evaluator.pushInstanceToken(key);
|
|
2286
2286
|
const previousPropertyTarget = evaluator.propertyTarget;
|
|
@@ -2306,7 +2306,7 @@ function LoopItems(instruction, instance, depth, template, evaluator) {
|
|
|
2306
2306
|
const target = resolveInstance(instance, instruction[2]);
|
|
2307
2307
|
if (!Array.isArray(target)) return true;
|
|
2308
2308
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2309
|
-
const children = instruction[
|
|
2309
|
+
const children = instruction[7];
|
|
2310
2310
|
for (let index = 0; index < target.length; index++) {
|
|
2311
2311
|
if (evaluator.callbackMode) evaluator.pushInstanceToken(index);
|
|
2312
2312
|
if (children) {
|
|
@@ -2326,10 +2326,10 @@ function LoopItems(instruction, instance, depth, template, evaluator) {
|
|
|
2326
2326
|
|
|
2327
2327
|
function LoopItemsFrom(instruction, instance, depth, template, evaluator) {
|
|
2328
2328
|
const target = resolveInstance(instance, instruction[2]);
|
|
2329
|
-
const startIndex = instruction[
|
|
2329
|
+
const startIndex = instruction[6];
|
|
2330
2330
|
if (!Array.isArray(target) || startIndex >= target.length) return true;
|
|
2331
2331
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2332
|
-
const children = instruction[
|
|
2332
|
+
const children = instruction[7];
|
|
2333
2333
|
for (let index = startIndex; index < target.length; index++) {
|
|
2334
2334
|
if (evaluator.callbackMode) evaluator.pushInstanceToken(index);
|
|
2335
2335
|
if (children) {
|
|
@@ -2355,7 +2355,7 @@ function LoopItemsUnevaluated(instruction, instance, depth, template, evaluator)
|
|
|
2355
2355
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
2356
2356
|
return true;
|
|
2357
2357
|
}
|
|
2358
|
-
const children = instruction[
|
|
2358
|
+
const children = instruction[7];
|
|
2359
2359
|
for (let index = 0; index < target.length; index++) {
|
|
2360
2360
|
if (evaluator.trackMode && evaluator.isEvaluated(target[index], target, index)) continue;
|
|
2361
2361
|
if (evaluator.callbackMode) evaluator.pushInstanceToken(index);
|
|
@@ -2379,7 +2379,7 @@ function LoopItemsType(instruction, instance, depth, template, evaluator) {
|
|
|
2379
2379
|
const target = resolveInstance(instance, instruction[2]);
|
|
2380
2380
|
if (!Array.isArray(target)) return true;
|
|
2381
2381
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2382
|
-
const expected = instruction[
|
|
2382
|
+
const expected = instruction[6];
|
|
2383
2383
|
for (let index = 0; index < target.length; index++) {
|
|
2384
2384
|
const actual = jsonTypeOf(target[index]);
|
|
2385
2385
|
if (actual !== expected && !(expected === Type.Integer && isIntegral(target[index]))) {
|
|
@@ -2395,7 +2395,7 @@ function LoopItemsTypeStrict(instruction, instance, depth, template, evaluator)
|
|
|
2395
2395
|
const target = resolveInstance(instance, instruction[2]);
|
|
2396
2396
|
if (!Array.isArray(target)) return true;
|
|
2397
2397
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2398
|
-
const expected = instruction[
|
|
2398
|
+
const expected = instruction[6];
|
|
2399
2399
|
for (let index = 0; index < target.length; index++) {
|
|
2400
2400
|
if (effectiveTypeStrictReal(target[index]) !== expected) {
|
|
2401
2401
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -2410,7 +2410,7 @@ function LoopItemsTypeStrictAny(instruction, instance, depth, template, evaluato
|
|
|
2410
2410
|
const target = resolveInstance(instance, instruction[2]);
|
|
2411
2411
|
if (!Array.isArray(target)) return true;
|
|
2412
2412
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2413
|
-
const bitmask = instruction[
|
|
2413
|
+
const bitmask = instruction[6];
|
|
2414
2414
|
for (let index = 0; index < target.length; index++) {
|
|
2415
2415
|
if (!typeSetTest(bitmask, effectiveTypeStrictReal(target[index]))) {
|
|
2416
2416
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
@@ -2428,8 +2428,8 @@ function LoopItemsPropertiesExactlyTypeStrictHash(instruction, instance, depth,
|
|
|
2428
2428
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
2429
2429
|
return false;
|
|
2430
2430
|
}
|
|
2431
|
-
const expectedType = instruction[
|
|
2432
|
-
const entries = instruction[
|
|
2431
|
+
const expectedType = instruction[6][0];
|
|
2432
|
+
const entries = instruction[6][1][0];
|
|
2433
2433
|
const expectedCount = entries.length;
|
|
2434
2434
|
for (let index = 0; index < target.length; index++) {
|
|
2435
2435
|
const item = target[index];
|
|
@@ -2464,8 +2464,8 @@ function LoopItemsIntegerBounded(instruction, instance, depth, template, evaluat
|
|
|
2464
2464
|
const target = resolveInstance(instance, instruction[2]);
|
|
2465
2465
|
if (!Array.isArray(target) || target.length === 0) return true;
|
|
2466
2466
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2467
|
-
const minimum = instruction[
|
|
2468
|
-
const maximum = instruction[
|
|
2467
|
+
const minimum = instruction[6][0];
|
|
2468
|
+
const maximum = instruction[6][1];
|
|
2469
2469
|
for (let index = 0; index < target.length; index++) {
|
|
2470
2470
|
const element = target[index];
|
|
2471
2471
|
const elementType = typeof element;
|
|
@@ -2483,7 +2483,7 @@ function LoopItemsIntegerBounded(instruction, instance, depth, template, evaluat
|
|
|
2483
2483
|
};
|
|
2484
2484
|
|
|
2485
2485
|
function LoopItemsIntegerBoundedSized(instruction, instance, depth, template, evaluator) {
|
|
2486
|
-
const value = instruction[
|
|
2486
|
+
const value = instruction[6];
|
|
2487
2487
|
const minimum = value[0][0];
|
|
2488
2488
|
const maximum = value[0][1];
|
|
2489
2489
|
const minimumSize = value[1][0];
|
|
@@ -2514,13 +2514,13 @@ function LoopItemsIntegerBoundedSized(instruction, instance, depth, template, ev
|
|
|
2514
2514
|
function LoopContains(instruction, instance, depth, template, evaluator) {
|
|
2515
2515
|
const target = resolveInstance(instance, instruction[2]);
|
|
2516
2516
|
if (!Array.isArray(target)) return true;
|
|
2517
|
-
const range = instruction[
|
|
2517
|
+
const range = instruction[6];
|
|
2518
2518
|
const minimum = range[0];
|
|
2519
2519
|
const maximum = range[1];
|
|
2520
2520
|
const isExhaustive = range[2];
|
|
2521
2521
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2522
2522
|
|
|
2523
|
-
const children = instruction[
|
|
2523
|
+
const children = instruction[7];
|
|
2524
2524
|
let result = minimum === 0;
|
|
2525
2525
|
let matchCount = 0;
|
|
2526
2526
|
for (let index = 0; index < target.length; index++) {
|
|
@@ -2553,7 +2553,7 @@ function LoopContains(instruction, instance, depth, template, evaluator) {
|
|
|
2553
2553
|
};
|
|
2554
2554
|
|
|
2555
2555
|
function ControlGroup(instruction, instance, depth, template, evaluator) {
|
|
2556
|
-
const children = instruction[
|
|
2556
|
+
const children = instruction[7];
|
|
2557
2557
|
if (children) {
|
|
2558
2558
|
for (let index = 0; index < children.length; index++) {
|
|
2559
2559
|
if (!evaluateInstruction(children[index], instance, depth + 1, template, evaluator)) return false;
|
|
@@ -2565,8 +2565,8 @@ function ControlGroup(instruction, instance, depth, template, evaluator) {
|
|
|
2565
2565
|
function ControlGroupWhenDefines(instruction, instance, depth, template, evaluator) {
|
|
2566
2566
|
const target = resolveInstance(instance, instruction[2]);
|
|
2567
2567
|
if (!isObject(target)) return true;
|
|
2568
|
-
if (!Object.hasOwn(target, instruction[
|
|
2569
|
-
const children = instruction[
|
|
2568
|
+
if (!Object.hasOwn(target, instruction[6])) return true;
|
|
2569
|
+
const children = instruction[7];
|
|
2570
2570
|
if (children) {
|
|
2571
2571
|
for (let index = 0; index < children.length; index++) {
|
|
2572
2572
|
if (!evaluateInstruction(children[index], instance, depth + 1, template, evaluator)) return false;
|
|
@@ -2577,8 +2577,8 @@ function ControlGroupWhenDefines(instruction, instance, depth, template, evaluat
|
|
|
2577
2577
|
|
|
2578
2578
|
function ControlGroupWhenDefinesDirect(instruction, instance, depth, template, evaluator) {
|
|
2579
2579
|
if (!isObject(instance)) return true;
|
|
2580
|
-
if (!Object.hasOwn(instance, instruction[
|
|
2581
|
-
const children = instruction[
|
|
2580
|
+
if (!Object.hasOwn(instance, instruction[6])) return true;
|
|
2581
|
+
const children = instruction[7];
|
|
2582
2582
|
if (children) {
|
|
2583
2583
|
for (let index = 0; index < children.length; index++) {
|
|
2584
2584
|
if (!evaluateInstruction(children[index], instance, depth + 1, template, evaluator)) return false;
|
|
@@ -2588,8 +2588,8 @@ function ControlGroupWhenDefinesDirect(instruction, instance, depth, template, e
|
|
|
2588
2588
|
};
|
|
2589
2589
|
|
|
2590
2590
|
function ControlGroupWhenType(instruction, instance, depth, template, evaluator) {
|
|
2591
|
-
if (jsonTypeOf(instance) !== instruction[
|
|
2592
|
-
const children = instruction[
|
|
2591
|
+
if (jsonTypeOf(instance) !== instruction[6]) return true;
|
|
2592
|
+
const children = instruction[7];
|
|
2593
2593
|
if (children) {
|
|
2594
2594
|
for (let index = 0; index < children.length; index++) {
|
|
2595
2595
|
if (!evaluateInstruction(children[index], instance, depth + 1, template, evaluator)) return false;
|
|
@@ -2600,7 +2600,7 @@ function ControlGroupWhenType(instruction, instance, depth, template, evaluator)
|
|
|
2600
2600
|
|
|
2601
2601
|
function ControlEvaluate(instruction, instance, depth, template, evaluator) {
|
|
2602
2602
|
if (evaluator.trackMode) {
|
|
2603
|
-
const target = resolveInstance(instance, instruction[
|
|
2603
|
+
const target = resolveInstance(instance, instruction[6]);
|
|
2604
2604
|
evaluator.markEvaluated(target, evaluator.propertyParent, evaluator.propertyKey);
|
|
2605
2605
|
}
|
|
2606
2606
|
return true;
|
|
@@ -2609,14 +2609,14 @@ function ControlEvaluate(instruction, instance, depth, template, evaluator) {
|
|
|
2609
2609
|
function ControlDynamicAnchorJump(instruction, instance, depth, template, evaluator) {
|
|
2610
2610
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2611
2611
|
const resolved = resolveInstance(instance, instruction[2]);
|
|
2612
|
-
const anchor = instruction[
|
|
2612
|
+
const anchor = instruction[6];
|
|
2613
2613
|
|
|
2614
2614
|
if (!evaluator.resources) {
|
|
2615
2615
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, false);
|
|
2616
2616
|
return false;
|
|
2617
2617
|
}
|
|
2618
2618
|
|
|
2619
|
-
const anchors = template[
|
|
2619
|
+
const anchors = template[6];
|
|
2620
2620
|
for (let index = 0; index < evaluator.resources.length; index++) {
|
|
2621
2621
|
const jumpTarget = anchors.get(evaluator.resources[index] + ':' + anchor);
|
|
2622
2622
|
if (jumpTarget !== undefined) {
|
|
@@ -2637,7 +2637,7 @@ function ControlDynamicAnchorJump(instruction, instance, depth, template, evalua
|
|
|
2637
2637
|
|
|
2638
2638
|
function ControlJump(instruction, instance, depth, template, evaluator) {
|
|
2639
2639
|
if (evaluator.callbackMode) evaluator.callbackPush(instruction);
|
|
2640
|
-
const jumpTarget = instruction[
|
|
2640
|
+
const jumpTarget = instruction[6];
|
|
2641
2641
|
if (!jumpTarget) {
|
|
2642
2642
|
if (evaluator.callbackMode) evaluator.callbackPop(instruction, true);
|
|
2643
2643
|
return true;
|
|
@@ -2760,7 +2760,7 @@ function AssertionTypeArrayBounded_fast(instruction, instance, depth, template,
|
|
|
2760
2760
|
const relInstance = instruction[2];
|
|
2761
2761
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2762
2762
|
if (!Array.isArray(target)) return false;
|
|
2763
|
-
const range = instruction[
|
|
2763
|
+
const range = instruction[6];
|
|
2764
2764
|
if (target.length < range[0]) return false;
|
|
2765
2765
|
if (range[1] !== null && target.length > range[1]) return false;
|
|
2766
2766
|
return true;
|
|
@@ -2770,7 +2770,7 @@ function LoopItemsTypeStrictAny_fast(instruction, instance, depth, template, eva
|
|
|
2770
2770
|
const relInstance = instruction[2];
|
|
2771
2771
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2772
2772
|
if (!Array.isArray(target)) return true;
|
|
2773
|
-
const bitmask = instruction[
|
|
2773
|
+
const bitmask = instruction[6];
|
|
2774
2774
|
for (let index = 0; index < target.length; index++) {
|
|
2775
2775
|
if (!typeSetTest(bitmask, effectiveTypeStrictReal(target[index]))) return false;
|
|
2776
2776
|
}
|
|
@@ -2781,19 +2781,19 @@ function AssertionPropertyTypeStrict_fast(instruction, instance, depth, template
|
|
|
2781
2781
|
if (!isObject(instance)) return true;
|
|
2782
2782
|
const target = resolveInstance(instance, instruction[2]);
|
|
2783
2783
|
if (target === undefined) return true;
|
|
2784
|
-
return effectiveTypeStrictReal(target) === instruction[
|
|
2784
|
+
return effectiveTypeStrictReal(target) === instruction[6];
|
|
2785
2785
|
}
|
|
2786
2786
|
|
|
2787
2787
|
function AssertionTypeStrict_fast(instruction, instance, depth, template, evaluator) {
|
|
2788
2788
|
const relInstance = instruction[2];
|
|
2789
2789
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2790
|
-
return effectiveTypeStrictReal(target) === instruction[
|
|
2790
|
+
return effectiveTypeStrictReal(target) === instruction[6];
|
|
2791
2791
|
}
|
|
2792
2792
|
|
|
2793
2793
|
function AssertionDefinesAllStrict_fast(instruction, instance, depth, template, evaluator) {
|
|
2794
2794
|
const target = resolveInstance(instance, instruction[2]);
|
|
2795
2795
|
if (!isObject(target)) return false;
|
|
2796
|
-
const strings = instruction[
|
|
2796
|
+
const strings = instruction[6];
|
|
2797
2797
|
for (let index = 0; index < strings.length; index++) {
|
|
2798
2798
|
if (!Object.hasOwn(target, strings[index])) return false;
|
|
2799
2799
|
}
|
|
@@ -2802,22 +2802,22 @@ function AssertionDefinesAllStrict_fast(instruction, instance, depth, template,
|
|
|
2802
2802
|
|
|
2803
2803
|
function AssertionEqual_fast(instruction, instance, depth, template, evaluator) {
|
|
2804
2804
|
if (evaluator.propertyTarget !== undefined) {
|
|
2805
|
-
const value = instruction[
|
|
2805
|
+
const value = instruction[6];
|
|
2806
2806
|
return typeof value === 'string' && value === evaluator.propertyTarget;
|
|
2807
2807
|
}
|
|
2808
|
-
return jsonEqual(resolveInstance(instance, instruction[2]), instruction[
|
|
2808
|
+
return jsonEqual(resolveInstance(instance, instruction[2]), instruction[6]);
|
|
2809
2809
|
}
|
|
2810
2810
|
|
|
2811
2811
|
function LoopPropertiesMatch_fast(instruction, instance, depth, template, evaluator) {
|
|
2812
2812
|
const relInstance = instruction[2];
|
|
2813
2813
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2814
2814
|
if (!isObject(target)) return true;
|
|
2815
|
-
const children = instruction[
|
|
2815
|
+
const children = instruction[7];
|
|
2816
2816
|
for (const key in target) {
|
|
2817
|
-
const index = instruction[
|
|
2817
|
+
const index = instruction[6][key];
|
|
2818
2818
|
if (index === undefined) continue;
|
|
2819
2819
|
const subinstruction = children[index];
|
|
2820
|
-
const subchildren = subinstruction[
|
|
2820
|
+
const subchildren = subinstruction[7];
|
|
2821
2821
|
if (subchildren) {
|
|
2822
2822
|
for (let childIndex = 0; childIndex < subchildren.length; childIndex++) {
|
|
2823
2823
|
if (!evaluateInstruction(subchildren[childIndex], target, depth + 1, template, evaluator)) return false;
|
|
@@ -2828,11 +2828,11 @@ function LoopPropertiesMatch_fast(instruction, instance, depth, template, evalua
|
|
|
2828
2828
|
}
|
|
2829
2829
|
|
|
2830
2830
|
function LogicalOr_fast(instruction, instance, depth, template, evaluator) {
|
|
2831
|
-
const children = instruction[
|
|
2831
|
+
const children = instruction[7];
|
|
2832
2832
|
if (!children || children.length === 0) return true;
|
|
2833
2833
|
const relInstance = instruction[2];
|
|
2834
2834
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2835
|
-
const exhaustive = instruction[
|
|
2835
|
+
const exhaustive = instruction[6];
|
|
2836
2836
|
let result = false;
|
|
2837
2837
|
if (exhaustive) {
|
|
2838
2838
|
for (let index = 0; index < children.length; index++) {
|
|
@@ -2851,7 +2851,7 @@ function LogicalOr_fast(instruction, instance, depth, template, evaluator) {
|
|
|
2851
2851
|
}
|
|
2852
2852
|
|
|
2853
2853
|
function ControlJump_fast(instruction, instance, depth, template, evaluator) {
|
|
2854
|
-
const jumpTarget = instruction[
|
|
2854
|
+
const jumpTarget = instruction[6];
|
|
2855
2855
|
if (!jumpTarget) return true;
|
|
2856
2856
|
const relInstance = instruction[2];
|
|
2857
2857
|
const resolved = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
@@ -2866,7 +2866,7 @@ function AssertionEqualsAnyStringHash_fast(instruction, instance, depth, templat
|
|
|
2866
2866
|
? evaluator.propertyTarget
|
|
2867
2867
|
: resolveInstance(instance, instruction[2]);
|
|
2868
2868
|
if (typeof target !== 'string') return false;
|
|
2869
|
-
const value = instruction[
|
|
2869
|
+
const value = instruction[6];
|
|
2870
2870
|
const entries = value[0];
|
|
2871
2871
|
const tableOfContents = value[1];
|
|
2872
2872
|
const stringSize = target.length;
|
|
@@ -2883,8 +2883,8 @@ function AssertionEqualsAnyStringHash_fast(instruction, instance, depth, templat
|
|
|
2883
2883
|
function LogicalXor_fast(instruction, instance, depth, template, evaluator) {
|
|
2884
2884
|
const relInstance = instruction[2];
|
|
2885
2885
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2886
|
-
const exhaustive = instruction[
|
|
2887
|
-
const children = instruction[
|
|
2886
|
+
const exhaustive = instruction[6];
|
|
2887
|
+
const children = instruction[7];
|
|
2888
2888
|
let result = true;
|
|
2889
2889
|
let hasMatched = false;
|
|
2890
2890
|
if (children) {
|
|
@@ -2907,14 +2907,14 @@ function LogicalXor_fast(instruction, instance, depth, template, evaluator) {
|
|
|
2907
2907
|
|
|
2908
2908
|
function AssertionDefinesStrict_fast(instruction, instance, depth, template, evaluator) {
|
|
2909
2909
|
const target = resolveInstance(instance, instruction[2]);
|
|
2910
|
-
return isObject(target) && Object.hasOwn(target, instruction[
|
|
2910
|
+
return isObject(target) && Object.hasOwn(target, instruction[6]);
|
|
2911
2911
|
}
|
|
2912
2912
|
|
|
2913
2913
|
function LoopItems_fast(instruction, instance, depth, template, evaluator) {
|
|
2914
2914
|
const relInstance = instruction[2];
|
|
2915
2915
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2916
2916
|
if (!Array.isArray(target)) return true;
|
|
2917
|
-
const children = instruction[
|
|
2917
|
+
const children = instruction[7];
|
|
2918
2918
|
for (let index = 0; index < target.length; index++) {
|
|
2919
2919
|
if (children) {
|
|
2920
2920
|
for (let childIndex = 0; childIndex < children.length; childIndex++) {
|
|
@@ -2929,12 +2929,12 @@ function LoopPropertiesMatchClosed_fast(instruction, instance, depth, template,
|
|
|
2929
2929
|
const relInstance = instruction[2];
|
|
2930
2930
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2931
2931
|
if (!isObject(target)) return true;
|
|
2932
|
-
const children = instruction[
|
|
2932
|
+
const children = instruction[7];
|
|
2933
2933
|
for (const key in target) {
|
|
2934
|
-
const index = instruction[
|
|
2934
|
+
const index = instruction[6][key];
|
|
2935
2935
|
if (index === undefined) return false;
|
|
2936
2936
|
const subinstruction = children[index];
|
|
2937
|
-
const subchildren = subinstruction[
|
|
2937
|
+
const subchildren = subinstruction[7];
|
|
2938
2938
|
if (subchildren) {
|
|
2939
2939
|
for (let childIndex = 0; childIndex < subchildren.length; childIndex++) {
|
|
2940
2940
|
if (!evaluateInstruction(subchildren[childIndex], target, depth + 1, template, evaluator)) return false;
|
|
@@ -2947,7 +2947,7 @@ function LoopPropertiesMatchClosed_fast(instruction, instance, depth, template,
|
|
|
2947
2947
|
function LogicalAnd_fast(instruction, instance, depth, template, evaluator) {
|
|
2948
2948
|
const relInstance = instruction[2];
|
|
2949
2949
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2950
|
-
const children = instruction[
|
|
2950
|
+
const children = instruction[7];
|
|
2951
2951
|
if (children) {
|
|
2952
2952
|
for (let index = 0; index < children.length; index++) {
|
|
2953
2953
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) return false;
|
|
@@ -2960,7 +2960,7 @@ function AssertionTypeStringBounded_fast(instruction, instance, depth, template,
|
|
|
2960
2960
|
const relInstance = instruction[2];
|
|
2961
2961
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2962
2962
|
if (typeof target !== 'string') return false;
|
|
2963
|
-
const range = instruction[
|
|
2963
|
+
const range = instruction[6];
|
|
2964
2964
|
const length = unicodeLength(target);
|
|
2965
2965
|
if (length < range[0]) return false;
|
|
2966
2966
|
return range[1] === null || length <= range[1];
|
|
@@ -2969,7 +2969,7 @@ function AssertionTypeStringBounded_fast(instruction, instance, depth, template,
|
|
|
2969
2969
|
function AssertionPropertyDependencies_fast(instruction, instance, depth, template, evaluator) {
|
|
2970
2970
|
const target = resolveInstance(instance, instruction[2]);
|
|
2971
2971
|
if (!isObject(target)) return true;
|
|
2972
|
-
const value = instruction[
|
|
2972
|
+
const value = instruction[6];
|
|
2973
2973
|
for (const property in value) {
|
|
2974
2974
|
if (!Object.hasOwn(target, property)) continue;
|
|
2975
2975
|
const dependencies = value[property];
|
|
@@ -2983,17 +2983,17 @@ function AssertionPropertyDependencies_fast(instruction, instance, depth, templa
|
|
|
2983
2983
|
function AssertionTypeAny_fast(instruction, instance, depth, template, evaluator) {
|
|
2984
2984
|
const relInstance = instruction[2];
|
|
2985
2985
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
2986
|
-
const bitmask = instruction[
|
|
2986
|
+
const bitmask = instruction[6];
|
|
2987
2987
|
const typeIndex = jsonTypeOf(target);
|
|
2988
2988
|
if (typeSetTest(bitmask, typeIndex)) return true;
|
|
2989
2989
|
return typeSetTest(bitmask, Type.Integer) && isIntegral(target);
|
|
2990
2990
|
}
|
|
2991
2991
|
|
|
2992
2992
|
function LogicalCondition_fast(instruction, instance, depth, template, evaluator) {
|
|
2993
|
-
const value = instruction[
|
|
2993
|
+
const value = instruction[6];
|
|
2994
2994
|
const thenStart = value[0];
|
|
2995
2995
|
const elseStart = value[1];
|
|
2996
|
-
const children = instruction[
|
|
2996
|
+
const children = instruction[7];
|
|
2997
2997
|
const childrenSize = children ? children.length : 0;
|
|
2998
2998
|
const relInstance = instruction[2];
|
|
2999
2999
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
@@ -3038,11 +3038,11 @@ function LoopPropertiesExcept_fast(instruction, instance, depth, template, evalu
|
|
|
3038
3038
|
const relInstance = instruction[2];
|
|
3039
3039
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3040
3040
|
if (!isObject(target)) return true;
|
|
3041
|
-
const filter = instruction[
|
|
3041
|
+
const filter = instruction[6];
|
|
3042
3042
|
const filterStrings = filter[0];
|
|
3043
3043
|
const filterPrefixes = filter[1];
|
|
3044
3044
|
const filterRegexes = filter[2];
|
|
3045
|
-
const children = instruction[
|
|
3045
|
+
const children = instruction[7];
|
|
3046
3046
|
for (const key in target) {
|
|
3047
3047
|
if (filterStrings.has(key)) continue;
|
|
3048
3048
|
let matched = false;
|
|
@@ -3076,14 +3076,14 @@ function AssertionRegex_fast(instruction, instance, depth, template, evaluator)
|
|
|
3076
3076
|
const target = evaluator.propertyTarget !== undefined
|
|
3077
3077
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
3078
3078
|
if (typeof target !== 'string') return true;
|
|
3079
|
-
return instruction[
|
|
3079
|
+
return instruction[6].test(target);
|
|
3080
3080
|
}
|
|
3081
3081
|
|
|
3082
3082
|
function LoopProperties_fast(instruction, instance, depth, template, evaluator) {
|
|
3083
3083
|
const relInstance = instruction[2];
|
|
3084
3084
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3085
3085
|
if (!isObject(target)) return true;
|
|
3086
|
-
const children = instruction[
|
|
3086
|
+
const children = instruction[7];
|
|
3087
3087
|
for (const key in target) {
|
|
3088
3088
|
evaluator.propertyParent = target;
|
|
3089
3089
|
evaluator.propertyKey = key;
|
|
@@ -3105,14 +3105,14 @@ function LoopProperties_fast(instruction, instance, depth, template, evaluator)
|
|
|
3105
3105
|
function AssertionDefines_fast(instruction, instance, depth, template, evaluator) {
|
|
3106
3106
|
const target = resolveInstance(instance, instruction[2]);
|
|
3107
3107
|
if (!isObject(target)) return true;
|
|
3108
|
-
return Object.hasOwn(target, instruction[
|
|
3108
|
+
return Object.hasOwn(target, instruction[6]);
|
|
3109
3109
|
}
|
|
3110
3110
|
|
|
3111
3111
|
function LogicalWhenType_fast(instruction, instance, depth, template, evaluator) {
|
|
3112
3112
|
const relInstance = instruction[2];
|
|
3113
3113
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3114
|
-
if (jsonTypeOf(target) !== instruction[
|
|
3115
|
-
const children = instruction[
|
|
3114
|
+
if (jsonTypeOf(target) !== instruction[6]) return true;
|
|
3115
|
+
const children = instruction[7];
|
|
3116
3116
|
if (children) {
|
|
3117
3117
|
for (let index = 0; index < children.length; index++) {
|
|
3118
3118
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) return false;
|
|
@@ -3124,8 +3124,8 @@ function LogicalWhenType_fast(instruction, instance, depth, template, evaluator)
|
|
|
3124
3124
|
function LogicalWhenDefines_fast(instruction, instance, depth, template, evaluator) {
|
|
3125
3125
|
const target = resolveInstance(instance, instruction[2]);
|
|
3126
3126
|
if (!isObject(target)) return true;
|
|
3127
|
-
if (!Object.hasOwn(target, instruction[
|
|
3128
|
-
const children = instruction[
|
|
3127
|
+
if (!Object.hasOwn(target, instruction[6])) return true;
|
|
3128
|
+
const children = instruction[7];
|
|
3129
3129
|
if (children) {
|
|
3130
3130
|
for (let index = 0; index < children.length; index++) {
|
|
3131
3131
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) return false;
|
|
@@ -3140,12 +3140,12 @@ function LoopContains_fast(instruction, instance, depth, template, evaluator) {
|
|
|
3140
3140
|
const relInstance = instruction[2];
|
|
3141
3141
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3142
3142
|
if (!Array.isArray(target)) return true;
|
|
3143
|
-
const range = instruction[
|
|
3143
|
+
const range = instruction[6];
|
|
3144
3144
|
const minimum = range[0];
|
|
3145
3145
|
const maximum = range[1];
|
|
3146
3146
|
const isExhaustive = range[2];
|
|
3147
3147
|
if (minimum === 0 && target.length === 0) return true;
|
|
3148
|
-
const children = instruction[
|
|
3148
|
+
const children = instruction[7];
|
|
3149
3149
|
let matchCount = 0;
|
|
3150
3150
|
for (let index = 0; index < target.length; index++) {
|
|
3151
3151
|
let subresult = true;
|
|
@@ -3169,7 +3169,7 @@ function LoopContains_fast(instruction, instance, depth, template, evaluator) {
|
|
|
3169
3169
|
function LogicalNot_fast(instruction, instance, depth, template, evaluator) {
|
|
3170
3170
|
const relInstance = instruction[2];
|
|
3171
3171
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3172
|
-
const children = instruction[
|
|
3172
|
+
const children = instruction[7];
|
|
3173
3173
|
if (children) {
|
|
3174
3174
|
for (let index = 0; index < children.length; index++) {
|
|
3175
3175
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) return true;
|
|
@@ -3182,7 +3182,7 @@ function LoopItemsType_fast(instruction, instance, depth, template, evaluator) {
|
|
|
3182
3182
|
const relInstance = instruction[2];
|
|
3183
3183
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3184
3184
|
if (!Array.isArray(target)) return true;
|
|
3185
|
-
const expected = instruction[
|
|
3185
|
+
const expected = instruction[6];
|
|
3186
3186
|
for (let index = 0; index < target.length; index++) {
|
|
3187
3187
|
const actual = jsonTypeOf(target[index]);
|
|
3188
3188
|
if (actual !== expected && !(expected === Type.Integer && isIntegral(target[index]))) return false;
|
|
@@ -3194,7 +3194,7 @@ function LoopItemsTypeStrict_fast(instruction, instance, depth, template, evalua
|
|
|
3194
3194
|
const relInstance = instruction[2];
|
|
3195
3195
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3196
3196
|
if (!Array.isArray(target)) return true;
|
|
3197
|
-
const expected = instruction[
|
|
3197
|
+
const expected = instruction[6];
|
|
3198
3198
|
for (let index = 0; index < target.length; index++) {
|
|
3199
3199
|
if (effectiveTypeStrictReal(target[index]) !== expected) return false;
|
|
3200
3200
|
}
|
|
@@ -3202,7 +3202,7 @@ function LoopItemsTypeStrict_fast(instruction, instance, depth, template, evalua
|
|
|
3202
3202
|
}
|
|
3203
3203
|
|
|
3204
3204
|
function AssertionEqualsAny_fast(instruction, instance, depth, template, evaluator) {
|
|
3205
|
-
const value = instruction[
|
|
3205
|
+
const value = instruction[6];
|
|
3206
3206
|
const target = evaluator.propertyTarget !== undefined
|
|
3207
3207
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
3208
3208
|
if (value.primitive) return value.set.has(target);
|
|
@@ -3216,7 +3216,7 @@ function AssertionEqualsAny_fast(instruction, instance, depth, template, evaluat
|
|
|
3216
3216
|
function AssertionDefinesAll_fast(instruction, instance, depth, template, evaluator) {
|
|
3217
3217
|
const target = resolveInstance(instance, instruction[2]);
|
|
3218
3218
|
if (!isObject(target)) return true;
|
|
3219
|
-
const strings = instruction[
|
|
3219
|
+
const strings = instruction[6];
|
|
3220
3220
|
for (let index = 0; index < strings.length; index++) {
|
|
3221
3221
|
if (!Object.hasOwn(target, strings[index])) return false;
|
|
3222
3222
|
}
|
|
@@ -3228,7 +3228,7 @@ function AssertionDefinesExactly_fast(instruction, instance, depth, template, ev
|
|
|
3228
3228
|
if (!isObject(target)) return true;
|
|
3229
3229
|
let targetSize = 0;
|
|
3230
3230
|
for (const key in target) targetSize++;
|
|
3231
|
-
const strings = instruction[
|
|
3231
|
+
const strings = instruction[6];
|
|
3232
3232
|
if (targetSize !== strings.length) return false;
|
|
3233
3233
|
for (let index = 0; index < strings.length; index++) {
|
|
3234
3234
|
if (!Object.hasOwn(target, strings[index])) return false;
|
|
@@ -3241,7 +3241,7 @@ function AssertionDefinesExactlyStrict_fast(instruction, instance, depth, templa
|
|
|
3241
3241
|
if (!isObject(target)) return false;
|
|
3242
3242
|
let targetSize = 0;
|
|
3243
3243
|
for (const key in target) targetSize++;
|
|
3244
|
-
const strings = instruction[
|
|
3244
|
+
const strings = instruction[6];
|
|
3245
3245
|
if (targetSize !== strings.length) return false;
|
|
3246
3246
|
for (let index = 0; index < strings.length; index++) {
|
|
3247
3247
|
if (!Object.hasOwn(target, strings[index])) return false;
|
|
@@ -3252,7 +3252,7 @@ function AssertionDefinesExactlyStrict_fast(instruction, instance, depth, templa
|
|
|
3252
3252
|
function AssertionDefinesExactlyStrictHash3_fast(instruction, instance, depth, template, evaluator) {
|
|
3253
3253
|
const target = resolveInstance(instance, instruction[2]);
|
|
3254
3254
|
if (!isObject(target)) return false;
|
|
3255
|
-
const entries = instruction[
|
|
3255
|
+
const entries = instruction[6][0];
|
|
3256
3256
|
let count = 0;
|
|
3257
3257
|
for (const key in target) count++;
|
|
3258
3258
|
if (count !== 3) return false;
|
|
@@ -3263,7 +3263,7 @@ function AssertionDefinesExactlyStrictHash3_fast(instruction, instance, depth, t
|
|
|
3263
3263
|
|
|
3264
3264
|
function AssertionType_fast(instruction, instance, depth, template, evaluator) {
|
|
3265
3265
|
const target = resolveInstance(instance, instruction[2]);
|
|
3266
|
-
const expected = instruction[
|
|
3266
|
+
const expected = instruction[6];
|
|
3267
3267
|
const actual = jsonTypeOf(target);
|
|
3268
3268
|
if (actual === expected) return true;
|
|
3269
3269
|
return expected === Type.Integer && isIntegral(target);
|
|
@@ -3272,32 +3272,32 @@ function AssertionType_fast(instruction, instance, depth, template, evaluator) {
|
|
|
3272
3272
|
function AssertionTypeStrictAny_fast(instruction, instance, depth, template, evaluator) {
|
|
3273
3273
|
const relInstance = instruction[2];
|
|
3274
3274
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3275
|
-
return typeSetTest(instruction[
|
|
3275
|
+
return typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
3276
3276
|
}
|
|
3277
3277
|
|
|
3278
3278
|
function AssertionNotTypeStrictAny_fast(instruction, instance, depth, template, evaluator) {
|
|
3279
3279
|
const relInstance = instruction[2];
|
|
3280
3280
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3281
|
-
return !typeSetTest(instruction[
|
|
3281
|
+
return !typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
3282
3282
|
}
|
|
3283
3283
|
|
|
3284
3284
|
function AssertionTypeStringUpper_fast(instruction, instance, depth, template, evaluator) {
|
|
3285
3285
|
const relInstance = instruction[2];
|
|
3286
3286
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3287
|
-
return typeof target === 'string' && unicodeLength(target) <= instruction[
|
|
3287
|
+
return typeof target === 'string' && unicodeLength(target) <= instruction[6];
|
|
3288
3288
|
}
|
|
3289
3289
|
|
|
3290
3290
|
function AssertionTypeArrayUpper_fast(instruction, instance, depth, template, evaluator) {
|
|
3291
3291
|
const relInstance = instruction[2];
|
|
3292
3292
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3293
|
-
return Array.isArray(target) && target.length <= instruction[
|
|
3293
|
+
return Array.isArray(target) && target.length <= instruction[6];
|
|
3294
3294
|
}
|
|
3295
3295
|
|
|
3296
3296
|
function AssertionTypeObjectBounded_fast(instruction, instance, depth, template, evaluator) {
|
|
3297
3297
|
const relInstance = instruction[2];
|
|
3298
3298
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3299
3299
|
if (!isObject(target)) return false;
|
|
3300
|
-
const range = instruction[
|
|
3300
|
+
const range = instruction[6];
|
|
3301
3301
|
const size = objectSize(target);
|
|
3302
3302
|
if (size < range[0]) return false;
|
|
3303
3303
|
return range[1] === null || size <= range[1];
|
|
@@ -3307,73 +3307,73 @@ function AssertionTypeObjectUpper_fast(instruction, instance, depth, template, e
|
|
|
3307
3307
|
const relInstance = instruction[2];
|
|
3308
3308
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3309
3309
|
if (!isObject(target)) return false;
|
|
3310
|
-
return objectSize(target) <= instruction[
|
|
3310
|
+
return objectSize(target) <= instruction[6];
|
|
3311
3311
|
}
|
|
3312
3312
|
|
|
3313
3313
|
function AssertionStringSizeLess_fast(instruction, instance, depth, template, evaluator) {
|
|
3314
3314
|
const target = evaluator.propertyTarget !== undefined
|
|
3315
3315
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
3316
3316
|
if (typeof target !== 'string') return true;
|
|
3317
|
-
return unicodeLength(target) < instruction[
|
|
3317
|
+
return unicodeLength(target) < instruction[6];
|
|
3318
3318
|
}
|
|
3319
3319
|
|
|
3320
3320
|
function AssertionStringSizeGreater_fast(instruction, instance, depth, template, evaluator) {
|
|
3321
3321
|
const target = evaluator.propertyTarget !== undefined
|
|
3322
3322
|
? evaluator.propertyTarget : resolveInstance(instance, instruction[2]);
|
|
3323
3323
|
if (typeof target !== 'string') return true;
|
|
3324
|
-
return unicodeLength(target) > instruction[
|
|
3324
|
+
return unicodeLength(target) > instruction[6];
|
|
3325
3325
|
}
|
|
3326
3326
|
|
|
3327
3327
|
function AssertionArraySizeLess_fast(instruction, instance, depth, template, evaluator) {
|
|
3328
3328
|
const target = resolveInstance(instance, instruction[2]);
|
|
3329
3329
|
if (!Array.isArray(target)) return true;
|
|
3330
|
-
return target.length < instruction[
|
|
3330
|
+
return target.length < instruction[6];
|
|
3331
3331
|
}
|
|
3332
3332
|
|
|
3333
3333
|
function AssertionArraySizeGreater_fast(instruction, instance, depth, template, evaluator) {
|
|
3334
3334
|
const target = resolveInstance(instance, instruction[2]);
|
|
3335
3335
|
if (!Array.isArray(target)) return true;
|
|
3336
|
-
return target.length > instruction[
|
|
3336
|
+
return target.length > instruction[6];
|
|
3337
3337
|
}
|
|
3338
3338
|
|
|
3339
3339
|
function AssertionObjectSizeLess_fast(instruction, instance, depth, template, evaluator) {
|
|
3340
3340
|
const target = resolveInstance(instance, instruction[2]);
|
|
3341
3341
|
if (!isObject(target)) return true;
|
|
3342
|
-
return objectSize(target) < instruction[
|
|
3342
|
+
return objectSize(target) < instruction[6];
|
|
3343
3343
|
}
|
|
3344
3344
|
|
|
3345
3345
|
function AssertionObjectSizeGreater_fast(instruction, instance, depth, template, evaluator) {
|
|
3346
3346
|
const target = resolveInstance(instance, instruction[2]);
|
|
3347
3347
|
if (!isObject(target)) return true;
|
|
3348
|
-
return objectSize(target) > instruction[
|
|
3348
|
+
return objectSize(target) > instruction[6];
|
|
3349
3349
|
}
|
|
3350
3350
|
|
|
3351
3351
|
function AssertionGreaterEqual_fast(instruction, instance, depth, template, evaluator) {
|
|
3352
3352
|
const target = resolveInstance(instance, instruction[2]);
|
|
3353
3353
|
const targetType = typeof target;
|
|
3354
3354
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
3355
|
-
return target >= instruction[
|
|
3355
|
+
return target >= instruction[6];
|
|
3356
3356
|
}
|
|
3357
3357
|
|
|
3358
3358
|
function AssertionLessEqual_fast(instruction, instance, depth, template, evaluator) {
|
|
3359
3359
|
const target = resolveInstance(instance, instruction[2]);
|
|
3360
3360
|
const targetType = typeof target;
|
|
3361
3361
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
3362
|
-
return target <= instruction[
|
|
3362
|
+
return target <= instruction[6];
|
|
3363
3363
|
}
|
|
3364
3364
|
|
|
3365
3365
|
function AssertionGreater_fast(instruction, instance, depth, template, evaluator) {
|
|
3366
3366
|
const target = resolveInstance(instance, instruction[2]);
|
|
3367
3367
|
const targetType = typeof target;
|
|
3368
3368
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
3369
|
-
return target > instruction[
|
|
3369
|
+
return target > instruction[6];
|
|
3370
3370
|
}
|
|
3371
3371
|
|
|
3372
3372
|
function AssertionLess_fast(instruction, instance, depth, template, evaluator) {
|
|
3373
3373
|
const target = resolveInstance(instance, instruction[2]);
|
|
3374
3374
|
const targetType = typeof target;
|
|
3375
3375
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
3376
|
-
return target < instruction[
|
|
3376
|
+
return target < instruction[6];
|
|
3377
3377
|
}
|
|
3378
3378
|
|
|
3379
3379
|
function AssertionUnique_fast(instruction, instance, depth, template, evaluator) {
|
|
@@ -3386,7 +3386,7 @@ function AssertionDivisible_fast(instruction, instance, depth, template, evaluat
|
|
|
3386
3386
|
const target = resolveInstance(instance, instruction[2]);
|
|
3387
3387
|
const targetType = typeof target;
|
|
3388
3388
|
if (targetType !== 'number' && targetType !== 'bigint') return true;
|
|
3389
|
-
return isDivisibleBy(target, instruction[
|
|
3389
|
+
return isDivisibleBy(target, instruction[6]);
|
|
3390
3390
|
}
|
|
3391
3391
|
|
|
3392
3392
|
function AssertionStringType_fast(instruction, instance, depth, template, evaluator) {
|
|
@@ -3400,7 +3400,7 @@ function AssertionPropertyType_fast(instruction, instance, depth, template, eval
|
|
|
3400
3400
|
if (!isObject(instance)) return true;
|
|
3401
3401
|
const target = resolveInstance(instance, instruction[2]);
|
|
3402
3402
|
if (target === undefined) return true;
|
|
3403
|
-
const expected = instruction[
|
|
3403
|
+
const expected = instruction[6];
|
|
3404
3404
|
const actual = jsonTypeOf(target);
|
|
3405
3405
|
return actual === expected || (expected === Type.Integer && isIntegral(target));
|
|
3406
3406
|
}
|
|
@@ -3409,7 +3409,7 @@ function AssertionPropertyTypeEvaluate_fast(instruction, instance, depth, templa
|
|
|
3409
3409
|
if (!isObject(instance)) return true;
|
|
3410
3410
|
const target = resolveInstance(instance, instruction[2]);
|
|
3411
3411
|
if (target === undefined) return true;
|
|
3412
|
-
const expected = instruction[
|
|
3412
|
+
const expected = instruction[6];
|
|
3413
3413
|
const actual = jsonTypeOf(target);
|
|
3414
3414
|
const result = actual === expected || (expected === Type.Integer && isIntegral(target));
|
|
3415
3415
|
if (result && evaluator.trackMode) {
|
|
@@ -3423,7 +3423,7 @@ function AssertionPropertyTypeStrictEvaluate_fast(instruction, instance, depth,
|
|
|
3423
3423
|
if (!isObject(instance)) return true;
|
|
3424
3424
|
const target = resolveInstance(instance, instruction[2]);
|
|
3425
3425
|
if (target === undefined) return true;
|
|
3426
|
-
const result = effectiveTypeStrictReal(target) === instruction[
|
|
3426
|
+
const result = effectiveTypeStrictReal(target) === instruction[6];
|
|
3427
3427
|
if (result && evaluator.trackMode) {
|
|
3428
3428
|
const location = instruction[2];
|
|
3429
3429
|
evaluator.markEvaluated(target, instance, location.length > 0 ? location[location.length - 1] : undefined);
|
|
@@ -3435,14 +3435,14 @@ function AssertionPropertyTypeStrictAny_fast(instruction, instance, depth, templ
|
|
|
3435
3435
|
if (!isObject(instance)) return true;
|
|
3436
3436
|
const target = resolveInstance(instance, instruction[2]);
|
|
3437
3437
|
if (target === undefined) return true;
|
|
3438
|
-
return typeSetTest(instruction[
|
|
3438
|
+
return typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
3439
3439
|
}
|
|
3440
3440
|
|
|
3441
3441
|
function AssertionPropertyTypeStrictAnyEvaluate_fast(instruction, instance, depth, template, evaluator) {
|
|
3442
3442
|
if (!isObject(instance)) return true;
|
|
3443
3443
|
const target = resolveInstance(instance, instruction[2]);
|
|
3444
3444
|
if (target === undefined) return true;
|
|
3445
|
-
const result = typeSetTest(instruction[
|
|
3445
|
+
const result = typeSetTest(instruction[6], effectiveTypeStrictReal(target));
|
|
3446
3446
|
if (result && evaluator.trackMode) {
|
|
3447
3447
|
const location = instruction[2];
|
|
3448
3448
|
evaluator.markEvaluated(target, instance, location.length > 0 ? location[location.length - 1] : undefined);
|
|
@@ -3454,11 +3454,11 @@ function AssertionArrayPrefix_fast(instruction, instance, depth, template, evalu
|
|
|
3454
3454
|
const target = resolveInstance(instance, instruction[2]);
|
|
3455
3455
|
if (!Array.isArray(target)) return true;
|
|
3456
3456
|
if (target.length === 0) return true;
|
|
3457
|
-
const children = instruction[
|
|
3457
|
+
const children = instruction[7];
|
|
3458
3458
|
const prefixes = children.length - 1;
|
|
3459
3459
|
const pointer = target.length === prefixes ? prefixes : Math.min(target.length, prefixes) - 1;
|
|
3460
3460
|
const entry = children[pointer];
|
|
3461
|
-
const entryChildren = entry[
|
|
3461
|
+
const entryChildren = entry[7];
|
|
3462
3462
|
if (entryChildren) {
|
|
3463
3463
|
for (let index = 0; index < entryChildren.length; index++) {
|
|
3464
3464
|
if (!evaluateInstruction(entryChildren[index], target, depth + 1, template, evaluator)) return false;
|
|
@@ -3471,11 +3471,11 @@ function AssertionArrayPrefixEvaluate_fast(instruction, instance, depth, templat
|
|
|
3471
3471
|
const target = resolveInstance(instance, instruction[2]);
|
|
3472
3472
|
if (!Array.isArray(target)) return true;
|
|
3473
3473
|
if (target.length === 0) return true;
|
|
3474
|
-
const children = instruction[
|
|
3474
|
+
const children = instruction[7];
|
|
3475
3475
|
const prefixes = children.length - 1;
|
|
3476
3476
|
const pointer = target.length === prefixes ? prefixes : Math.min(target.length, prefixes) - 1;
|
|
3477
3477
|
const entry = children[pointer];
|
|
3478
|
-
const entryChildren = entry[
|
|
3478
|
+
const entryChildren = entry[7];
|
|
3479
3479
|
if (entryChildren) {
|
|
3480
3480
|
for (let index = 0; index < entryChildren.length; index++) {
|
|
3481
3481
|
if (!evaluateInstruction(entryChildren[index], target, depth + 1, template, evaluator)) return false;
|
|
@@ -3496,8 +3496,8 @@ function AssertionArrayPrefixEvaluate_fast(instruction, instance, depth, templat
|
|
|
3496
3496
|
function AssertionObjectPropertiesSimple_fast(instruction, instance, depth, template, evaluator) {
|
|
3497
3497
|
const target = resolveInstance(instance, instruction[2]);
|
|
3498
3498
|
if (!isObject(target)) return false;
|
|
3499
|
-
const value = instruction[
|
|
3500
|
-
const children = instruction[
|
|
3499
|
+
const value = instruction[6];
|
|
3500
|
+
const children = instruction[7];
|
|
3501
3501
|
for (let index = 0; index < value.length; index++) {
|
|
3502
3502
|
const entry = value[index];
|
|
3503
3503
|
const name = entry[0];
|
|
@@ -3531,7 +3531,7 @@ function Evaluate_fast(instruction, instance, depth, template, evaluator) {
|
|
|
3531
3531
|
function LogicalNotEvaluate_fast(instruction, instance, depth, template, evaluator) {
|
|
3532
3532
|
const relInstance = instruction[2];
|
|
3533
3533
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3534
|
-
const children = instruction[
|
|
3534
|
+
const children = instruction[7];
|
|
3535
3535
|
let result = false;
|
|
3536
3536
|
if (children) {
|
|
3537
3537
|
for (let index = 0; index < children.length; index++) {
|
|
@@ -3547,8 +3547,8 @@ function LogicalNotEvaluate_fast(instruction, instance, depth, template, evaluat
|
|
|
3547
3547
|
|
|
3548
3548
|
function LogicalWhenArraySizeGreater_fast(instruction, instance, depth, template, evaluator) {
|
|
3549
3549
|
const target = resolveInstance(instance, instruction[2]);
|
|
3550
|
-
if (!Array.isArray(target) || target.length <= instruction[
|
|
3551
|
-
const children = instruction[
|
|
3550
|
+
if (!Array.isArray(target) || target.length <= instruction[6]) return true;
|
|
3551
|
+
const children = instruction[7];
|
|
3552
3552
|
if (children) {
|
|
3553
3553
|
for (let index = 0; index < children.length; index++) {
|
|
3554
3554
|
if (!evaluateInstruction(children[index], target, depth + 1, template, evaluator)) return false;
|
|
@@ -3561,7 +3561,7 @@ function LoopPropertiesUnevaluated_fast(instruction, instance, depth, template,
|
|
|
3561
3561
|
const target = resolveInstance(instance, instruction[2]);
|
|
3562
3562
|
if (!isObject(target)) return true;
|
|
3563
3563
|
if (evaluator.trackMode && evaluator.isEvaluated(target)) return true;
|
|
3564
|
-
const children = instruction[
|
|
3564
|
+
const children = instruction[7];
|
|
3565
3565
|
for (const key in target) {
|
|
3566
3566
|
if (evaluator.trackMode && evaluator.isEvaluated(target[key], target, key)) continue;
|
|
3567
3567
|
if (children) {
|
|
@@ -3578,11 +3578,11 @@ function LoopPropertiesUnevaluatedExcept_fast(instruction, instance, depth, temp
|
|
|
3578
3578
|
const target = resolveInstance(instance, instruction[2]);
|
|
3579
3579
|
if (!isObject(target)) return true;
|
|
3580
3580
|
if (evaluator.trackMode && evaluator.isEvaluated(target)) return true;
|
|
3581
|
-
const filter = instruction[
|
|
3581
|
+
const filter = instruction[6];
|
|
3582
3582
|
const filterStrings = filter[0];
|
|
3583
3583
|
const filterPrefixes = filter[1];
|
|
3584
3584
|
const filterRegexes = filter[2];
|
|
3585
|
-
const children = instruction[
|
|
3585
|
+
const children = instruction[7];
|
|
3586
3586
|
for (const key in target) {
|
|
3587
3587
|
if (filterStrings.has(key)) continue;
|
|
3588
3588
|
let matched = false;
|
|
@@ -3610,7 +3610,7 @@ function LoopPropertiesEvaluate_fast(instruction, instance, depth, template, eva
|
|
|
3610
3610
|
const relInstance = instruction[2];
|
|
3611
3611
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3612
3612
|
if (!isObject(target)) return true;
|
|
3613
|
-
const children = instruction[
|
|
3613
|
+
const children = instruction[7];
|
|
3614
3614
|
for (const key in target) {
|
|
3615
3615
|
evaluator.propertyParent = target;
|
|
3616
3616
|
evaluator.propertyKey = key;
|
|
@@ -3634,8 +3634,8 @@ function LoopPropertiesRegex_fast(instruction, instance, depth, template, evalua
|
|
|
3634
3634
|
const relInstance = instruction[2];
|
|
3635
3635
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3636
3636
|
if (!isObject(target)) return true;
|
|
3637
|
-
const regex = instruction[
|
|
3638
|
-
const children = instruction[
|
|
3637
|
+
const regex = instruction[6];
|
|
3638
|
+
const children = instruction[7];
|
|
3639
3639
|
for (const key in target) {
|
|
3640
3640
|
regex.lastIndex = 0;
|
|
3641
3641
|
if (!regex.test(key)) continue;
|
|
@@ -3660,8 +3660,8 @@ function LoopPropertiesRegexClosed_fast(instruction, instance, depth, template,
|
|
|
3660
3660
|
const relInstance = instruction[2];
|
|
3661
3661
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3662
3662
|
if (!isObject(target)) return true;
|
|
3663
|
-
const regex = instruction[
|
|
3664
|
-
const children = instruction[
|
|
3663
|
+
const regex = instruction[6];
|
|
3664
|
+
const children = instruction[7];
|
|
3665
3665
|
for (const key in target) {
|
|
3666
3666
|
regex.lastIndex = 0;
|
|
3667
3667
|
if (!regex.test(key)) return false;
|
|
@@ -3686,8 +3686,8 @@ function LoopPropertiesStartsWith_fast(instruction, instance, depth, template, e
|
|
|
3686
3686
|
const relInstance = instruction[2];
|
|
3687
3687
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3688
3688
|
if (!isObject(target)) return true;
|
|
3689
|
-
const prefix = instruction[
|
|
3690
|
-
const children = instruction[
|
|
3689
|
+
const prefix = instruction[6];
|
|
3690
|
+
const children = instruction[7];
|
|
3691
3691
|
for (const key in target) {
|
|
3692
3692
|
if (!key.startsWith(prefix)) continue;
|
|
3693
3693
|
evaluator.propertyParent = target;
|
|
@@ -3711,7 +3711,7 @@ function LoopPropertiesType_fast(instruction, instance, depth, template, evaluat
|
|
|
3711
3711
|
const relInstance = instruction[2];
|
|
3712
3712
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3713
3713
|
if (!isObject(target)) return true;
|
|
3714
|
-
const expected = instruction[
|
|
3714
|
+
const expected = instruction[6];
|
|
3715
3715
|
for (const key in target) {
|
|
3716
3716
|
const actual = jsonTypeOf(target[key]);
|
|
3717
3717
|
if (actual !== expected && !(expected === Type.Integer && isIntegral(target[key]))) return false;
|
|
@@ -3723,7 +3723,7 @@ function LoopPropertiesTypeEvaluate_fast(instruction, instance, depth, template,
|
|
|
3723
3723
|
const relInstance = instruction[2];
|
|
3724
3724
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3725
3725
|
if (!isObject(target)) return true;
|
|
3726
|
-
const expected = instruction[
|
|
3726
|
+
const expected = instruction[6];
|
|
3727
3727
|
for (const key in target) {
|
|
3728
3728
|
const actual = jsonTypeOf(target[key]);
|
|
3729
3729
|
if (actual !== expected && !(expected === Type.Integer && isIntegral(target[key]))) return false;
|
|
@@ -3735,7 +3735,7 @@ function LoopPropertiesTypeEvaluate_fast(instruction, instance, depth, template,
|
|
|
3735
3735
|
function LoopPropertiesExactlyTypeStrict_fast(instruction, instance, depth, template, evaluator) {
|
|
3736
3736
|
const target = resolveInstance(instance, instruction[2]);
|
|
3737
3737
|
if (!isObject(target)) return false;
|
|
3738
|
-
const value = instruction[
|
|
3738
|
+
const value = instruction[6];
|
|
3739
3739
|
const names = new Set(value[1]);
|
|
3740
3740
|
let count = 0;
|
|
3741
3741
|
for (const key in target) {
|
|
@@ -3748,7 +3748,7 @@ function LoopPropertiesExactlyTypeStrict_fast(instruction, instance, depth, temp
|
|
|
3748
3748
|
function LoopPropertiesExactlyTypeStrictHash_fast(instruction, instance, depth, template, evaluator) {
|
|
3749
3749
|
const target = resolveInstance(instance, instruction[2]);
|
|
3750
3750
|
if (!isObject(target)) return false;
|
|
3751
|
-
const value = instruction[
|
|
3751
|
+
const value = instruction[6];
|
|
3752
3752
|
const entries = value[1][0];
|
|
3753
3753
|
const expectedCount = entries.length;
|
|
3754
3754
|
let count = 0;
|
|
@@ -3767,7 +3767,7 @@ function LoopPropertiesTypeStrict_fast(instruction, instance, depth, template, e
|
|
|
3767
3767
|
const relInstance = instruction[2];
|
|
3768
3768
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3769
3769
|
if (!isObject(target)) return true;
|
|
3770
|
-
const expected = instruction[
|
|
3770
|
+
const expected = instruction[6];
|
|
3771
3771
|
for (const key in target) {
|
|
3772
3772
|
if (effectiveTypeStrictReal(target[key]) !== expected) return false;
|
|
3773
3773
|
}
|
|
@@ -3778,7 +3778,7 @@ function LoopPropertiesTypeStrictEvaluate_fast(instruction, instance, depth, tem
|
|
|
3778
3778
|
const relInstance = instruction[2];
|
|
3779
3779
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3780
3780
|
if (!isObject(target)) return true;
|
|
3781
|
-
const expected = instruction[
|
|
3781
|
+
const expected = instruction[6];
|
|
3782
3782
|
for (const key in target) {
|
|
3783
3783
|
if (effectiveTypeStrictReal(target[key]) !== expected) return false;
|
|
3784
3784
|
}
|
|
@@ -3790,7 +3790,7 @@ function LoopPropertiesTypeStrictAny_fast(instruction, instance, depth, template
|
|
|
3790
3790
|
const relInstance = instruction[2];
|
|
3791
3791
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3792
3792
|
if (!isObject(target)) return true;
|
|
3793
|
-
const bitmask = instruction[
|
|
3793
|
+
const bitmask = instruction[6];
|
|
3794
3794
|
for (const key in target) {
|
|
3795
3795
|
if (!typeSetTest(bitmask, effectiveTypeStrictReal(target[key]))) return false;
|
|
3796
3796
|
}
|
|
@@ -3801,7 +3801,7 @@ function LoopPropertiesTypeStrictAnyEvaluate_fast(instruction, instance, depth,
|
|
|
3801
3801
|
const relInstance = instruction[2];
|
|
3802
3802
|
const target = relInstance.length === 0 ? instance : resolveInstance(instance, relInstance);
|
|
3803
3803
|
if (!isObject(target)) return true;
|
|
3804
|
-
const bitmask = instruction[
|
|
3804
|
+
const bitmask = instruction[6];
|
|
3805
3805
|
for (const key in target) {
|
|
3806
3806
|
if (!typeSetTest(bitmask, effectiveTypeStrictReal(target[key]))) return false;
|
|
3807
3807
|
}
|
|
@@ -3812,7 +3812,7 @@ function LoopPropertiesTypeStrictAnyEvaluate_fast(instruction, instance, depth,
|
|
|
3812
3812
|
function LoopKeys_fast(instruction, instance, depth, template, evaluator) {
|
|
3813
3813
|
const target = resolveInstance(instance, instruction[2]);
|
|
3814
3814
|
if (!isObject(target)) return true;
|
|
3815
|
-
const children = instruction[
|
|
3815
|
+
const children = instruction[7];
|
|
3816
3816
|
for (const key in target) {
|
|
3817
3817
|
const previousPropertyTarget = evaluator.propertyTarget;
|
|
3818
3818
|
evaluator.propertyTarget = key;
|
|
@@ -3831,9 +3831,9 @@ function LoopKeys_fast(instruction, instance, depth, template, evaluator) {
|
|
|
3831
3831
|
|
|
3832
3832
|
function LoopItemsFrom_fast(instruction, instance, depth, template, evaluator) {
|
|
3833
3833
|
const target = resolveInstance(instance, instruction[2]);
|
|
3834
|
-
const startIndex = instruction[
|
|
3834
|
+
const startIndex = instruction[6];
|
|
3835
3835
|
if (!Array.isArray(target) || startIndex >= target.length) return true;
|
|
3836
|
-
const children = instruction[
|
|
3836
|
+
const children = instruction[7];
|
|
3837
3837
|
for (let index = startIndex; index < target.length; index++) {
|
|
3838
3838
|
if (children) {
|
|
3839
3839
|
for (let childIndex = 0; childIndex < children.length; childIndex++) {
|
|
@@ -3848,7 +3848,7 @@ function LoopItemsUnevaluated_fast(instruction, instance, depth, template, evalu
|
|
|
3848
3848
|
const target = resolveInstance(instance, instruction[2]);
|
|
3849
3849
|
if (!Array.isArray(target)) return true;
|
|
3850
3850
|
if (evaluator.trackMode && evaluator.isEvaluated(target)) return true;
|
|
3851
|
-
const children = instruction[
|
|
3851
|
+
const children = instruction[7];
|
|
3852
3852
|
for (let index = 0; index < target.length; index++) {
|
|
3853
3853
|
if (evaluator.trackMode && evaluator.isEvaluated(target[index], target, index)) continue;
|
|
3854
3854
|
if (children) {
|
|
@@ -3864,8 +3864,8 @@ function LoopItemsUnevaluated_fast(instruction, instance, depth, template, evalu
|
|
|
3864
3864
|
function LoopItemsPropertiesExactlyTypeStrictHash_fast(instruction, instance, depth, template, evaluator) {
|
|
3865
3865
|
const target = resolveInstance(instance, instruction[2]);
|
|
3866
3866
|
if (!Array.isArray(target)) return false;
|
|
3867
|
-
const expectedType = instruction[
|
|
3868
|
-
const entries = instruction[
|
|
3867
|
+
const expectedType = instruction[6][0];
|
|
3868
|
+
const entries = instruction[6][1][0];
|
|
3869
3869
|
const expectedCount = entries.length;
|
|
3870
3870
|
for (let index = 0; index < target.length; index++) {
|
|
3871
3871
|
const item = target[index];
|
|
@@ -3885,9 +3885,9 @@ function LoopItemsPropertiesExactlyTypeStrictHash_fast(instruction, instance, de
|
|
|
3885
3885
|
|
|
3886
3886
|
function ControlDynamicAnchorJump_fast(instruction, instance, depth, template, evaluator) {
|
|
3887
3887
|
const resolved = resolveInstance(instance, instruction[2]);
|
|
3888
|
-
const anchor = instruction[
|
|
3888
|
+
const anchor = instruction[6];
|
|
3889
3889
|
if (!evaluator.resources) return false;
|
|
3890
|
-
const anchors = template[
|
|
3890
|
+
const anchors = template[6];
|
|
3891
3891
|
for (let index = 0; index < evaluator.resources.length; index++) {
|
|
3892
3892
|
const jumpTarget = anchors.get(evaluator.resources[index] + ':' + anchor);
|
|
3893
3893
|
if (jumpTarget !== undefined) {
|
|
@@ -3903,8 +3903,8 @@ function ControlDynamicAnchorJump_fast(instruction, instance, depth, template, e
|
|
|
3903
3903
|
function LoopItemsIntegerBounded_fast(instruction, instance, depth, template, evaluator) {
|
|
3904
3904
|
const target = resolveInstance(instance, instruction[2]);
|
|
3905
3905
|
if (!Array.isArray(target) || target.length === 0) return true;
|
|
3906
|
-
const minimum = instruction[
|
|
3907
|
-
const maximum = instruction[
|
|
3906
|
+
const minimum = instruction[6][0];
|
|
3907
|
+
const maximum = instruction[6][1];
|
|
3908
3908
|
for (let index = 0; index < target.length; index++) {
|
|
3909
3909
|
const element = target[index];
|
|
3910
3910
|
const elementType = typeof element;
|
|
@@ -3914,7 +3914,7 @@ function LoopItemsIntegerBounded_fast(instruction, instance, depth, template, ev
|
|
|
3914
3914
|
}
|
|
3915
3915
|
|
|
3916
3916
|
function LoopItemsIntegerBoundedSized_fast(instruction, instance, depth, template, evaluator) {
|
|
3917
|
-
const value = instruction[
|
|
3917
|
+
const value = instruction[6];
|
|
3918
3918
|
const minimum = value[0][0];
|
|
3919
3919
|
const maximum = value[0][1];
|
|
3920
3920
|
const minimumSize = value[1][0];
|
|
@@ -3932,25 +3932,25 @@ function LoopItemsIntegerBoundedSized_fast(instruction, instance, depth, templat
|
|
|
3932
3932
|
|
|
3933
3933
|
function AssertionTypeIntegerBounded_fast(instruction, instance, depth, template, evaluator) {
|
|
3934
3934
|
const target = resolveInstance(instance, instruction[2]);
|
|
3935
|
-
const range = instruction[
|
|
3935
|
+
const range = instruction[6];
|
|
3936
3936
|
return (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0] && target <= range[1];
|
|
3937
3937
|
}
|
|
3938
3938
|
|
|
3939
3939
|
function AssertionTypeIntegerBoundedStrict_fast(instruction, instance, depth, template, evaluator) {
|
|
3940
3940
|
const target = resolveInstance(instance, instruction[2]);
|
|
3941
|
-
const range = instruction[
|
|
3941
|
+
const range = instruction[6];
|
|
3942
3942
|
return (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0] && target <= range[1];
|
|
3943
3943
|
}
|
|
3944
3944
|
|
|
3945
3945
|
function AssertionTypeIntegerLowerBound_fast(instruction, instance, depth, template, evaluator) {
|
|
3946
3946
|
const target = resolveInstance(instance, instruction[2]);
|
|
3947
|
-
const range = instruction[
|
|
3947
|
+
const range = instruction[6];
|
|
3948
3948
|
return (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0];
|
|
3949
3949
|
}
|
|
3950
3950
|
|
|
3951
3951
|
function AssertionTypeIntegerLowerBoundStrict_fast(instruction, instance, depth, template, evaluator) {
|
|
3952
3952
|
const target = resolveInstance(instance, instruction[2]);
|
|
3953
|
-
const range = instruction[
|
|
3953
|
+
const range = instruction[6];
|
|
3954
3954
|
return (typeof target === 'bigint' || Number.isInteger(target)) && target >= range[0];
|
|
3955
3955
|
}
|
|
3956
3956
|
|