occam-verify-cli 1.0.318 → 1.0.325
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/lib/context/file.js +108 -126
- package/lib/context/local.js +21 -8
- package/lib/context/release.js +58 -7
- package/lib/dom/assertion/type.js +3 -3
- package/lib/dom/declaration/complexType.js +125 -101
- package/lib/dom/declaration/constructor.js +5 -5
- package/lib/dom/declaration/metavariable.js +3 -3
- package/lib/dom/declaration/simpleType.js +58 -52
- package/lib/dom/declaration/typePrefix.js +18 -7
- package/lib/dom/declaration/variable.js +5 -5
- package/lib/dom/metavariable.js +3 -3
- package/lib/dom/property.js +4 -4
- package/lib/dom/topLevelAssertion.js +1 -43
- package/lib/dom/type.js +107 -21
- package/lib/dom/variable.js +4 -4
- package/lib/node/declaration/complexType.js +22 -1
- package/lib/node/declaration/simpleType.js +22 -1
- package/lib/node/type.js +35 -9
- package/lib/unifier/metavariable.js +2 -2
- package/lib/unifier/statementWithCombinator.js +3 -3
- package/lib/unifier/termWithConstructor.js +2 -2
- package/lib/utilities/json.js +8 -6
- package/lib/utilities/node.js +4 -4
- package/lib/utilities/type.js +10 -5
- package/lib/verifier/combinator.js +2 -2
- package/lib/verifier/constructor.js +3 -3
- package/package.json +1 -1
- package/src/context/file.js +137 -171
- package/src/context/local.js +7 -3
- package/src/context/release.js +54 -8
- package/src/dom/assertion/type.js +3 -3
- package/src/dom/declaration/complexType.js +159 -132
- package/src/dom/declaration/constructor.js +6 -6
- package/src/dom/declaration/metavariable.js +3 -3
- package/src/dom/declaration/simpleType.js +74 -68
- package/src/dom/declaration/typePrefix.js +24 -6
- package/src/dom/declaration/variable.js +6 -6
- package/src/dom/metavariable.js +2 -2
- package/src/dom/property.js +1 -1
- package/src/dom/topLevelAssertion.js +3 -15
- package/src/dom/type.js +132 -22
- package/src/dom/variable.js +4 -4
- package/src/node/declaration/complexType.js +21 -0
- package/src/node/declaration/simpleType.js +21 -0
- package/src/node/type.js +42 -9
- package/src/unifier/metavariable.js +2 -2
- package/src/unifier/statementWithCombinator.js +2 -2
- package/src/unifier/termWithConstructor.js +2 -2
- package/src/utilities/json.js +18 -10
- package/src/utilities/node.js +6 -3
- package/src/utilities/type.js +12 -5
- package/src/verifier/combinator.js +2 -2
- package/src/verifier/constructor.js +3 -3
|
@@ -211,12 +211,12 @@ _define_property(ConstructorVerifier, "maps", [
|
|
|
211
211
|
nodeQuery: typeNodeQuery,
|
|
212
212
|
verify: function(typeNode, context, verifyAhead) {
|
|
213
213
|
var typeVerifies;
|
|
214
|
-
var
|
|
214
|
+
var nominalTypeName = typeNode.getNominalTypeName(), typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
215
215
|
if (typePresent) {
|
|
216
216
|
var verifiesAhead = verifyAhead();
|
|
217
217
|
typeVerifies = verifiesAhead; ///
|
|
218
218
|
} else {
|
|
219
|
-
var typeString =
|
|
219
|
+
var typeString = nominalTypeName; ///
|
|
220
220
|
context.debug("The '".concat(typeString, "' type is not present."));
|
|
221
221
|
typeVerifies = false;
|
|
222
222
|
}
|
|
@@ -227,4 +227,4 @@ _define_property(ConstructorVerifier, "maps", [
|
|
|
227
227
|
var constructorVerifier = new ConstructorVerifier();
|
|
228
228
|
var _default = constructorVerifier;
|
|
229
229
|
|
|
230
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
230
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZmllci9jb25zdHJ1Y3Rvci5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgYXJyYXlVdGlsaXRpZXMgfSBmcm9tIFwibmVjZXNzYXJ5XCI7XG5cbmltcG9ydCBkb20gZnJvbSBcIi4uL2RvbVwiO1xuaW1wb3J0IFZlcmlmaWVyIGZyb20gXCIuLi92ZXJpZmllclwiO1xuXG5pbXBvcnQgeyBub2R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FjbkMsUUFBUW9DLDhCQUE4QixDQUFDSDtZQUUzRCxJQUFJRSxhQUFhO2dCQUNmLElBQU01QixnQkFBZ0JRO2dCQUV0QmlCLGVBQWV6QixlQUFlLEdBQUc7WUFDbkMsT0FBTztnQkFDTCxJQUFNYSxhQUFhYSxpQkFBaUIsR0FBRztnQkFFdkNqQyxRQUFRcUIsS0FBSyxDQUFDLEFBQUMsUUFBa0IsT0FBWEQsWUFBVztnQkFFakNZLGVBQWU7WUFDakI7WUFFQSxPQUFPQTtRQUNUO0lBQ0Y7Q0FDRDtBQUdILElBQU1LLHNCQUFzQixJQUFJeEM7SUFFaEMsV0FBZXdDIn0=
|
package/package.json
CHANGED
package/src/context/file.js
CHANGED
|
@@ -33,7 +33,7 @@ import { typesFromJSON,
|
|
|
33
33
|
metatheoremsToMetatheoremsJSON,
|
|
34
34
|
metavariablesToMetavariablesJSON } from "../utilities/json";
|
|
35
35
|
|
|
36
|
-
const { push,
|
|
36
|
+
const { push, filter } = arrayUtilities;
|
|
37
37
|
|
|
38
38
|
export default class FileContext {
|
|
39
39
|
constructor(releaseContext, filePath, lineIndex, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typePrefixes, constructors, metatheorems, metavariables) {
|
|
@@ -83,6 +83,8 @@ export default class FileContext {
|
|
|
83
83
|
|
|
84
84
|
getMetaTypes() { return this.releaseContext.getMetaTypes(); }
|
|
85
85
|
|
|
86
|
+
getTypePrefix() { return this.releaseContext.getTypePrefix(); }
|
|
87
|
+
|
|
86
88
|
getJudgements() {
|
|
87
89
|
const judgements = [];
|
|
88
90
|
|
|
@@ -104,117 +106,87 @@ export default class FileContext {
|
|
|
104
106
|
getLabels(includeRelease = true) {
|
|
105
107
|
const labels = [];
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
+
if (includeRelease) {
|
|
110
|
+
const releaseContextLabels = this.releaseContext.getLabels();
|
|
109
111
|
|
|
110
|
-
push(labels,
|
|
111
|
-
}
|
|
112
|
+
push(labels, releaseContextLabels);
|
|
113
|
+
} else {
|
|
114
|
+
this.rules.forEach((rule) => {
|
|
115
|
+
const ruleLabels = rule.getLabels();
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
push(labels, ruleLabels);
|
|
118
|
+
});
|
|
115
119
|
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
this.axioms.forEach((axiom) => {
|
|
121
|
+
const axiomLabels = axiom.getLabels();
|
|
118
122
|
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
push(labels, axiomLabels);
|
|
124
|
+
});
|
|
121
125
|
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
this.lemmas.forEach((lemma) => {
|
|
127
|
+
const lemmaLabels = lemma.getLabels();
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
push(labels, lemmaLabels);
|
|
130
|
+
});
|
|
127
131
|
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
this.theorems.forEach((theorem) => {
|
|
133
|
+
const theoremLabels = theorem.getLabels();
|
|
130
134
|
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
push(labels, theoremLabels);
|
|
136
|
+
});
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
this.conjectures.forEach((conjecture) => {
|
|
139
|
+
const conjectureLabels = conjecture.getLabels();
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
push(labels, conjectureLabels);
|
|
142
|
+
});
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
this.metatheorems.forEach((metatheorem) => {
|
|
145
|
+
const metatheoremLabel = metatheorem.getLabel();
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
push(labels, releaseContextLabels);
|
|
147
|
+
labels.push(metatheoremLabel);
|
|
148
|
+
});
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
return labels;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
|
-
getTypes(includeRelease = true) {
|
|
153
|
-
const types =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (includeRelease) {
|
|
158
|
-
const releaseContextTypes = this.releaseContext.getTypes();
|
|
159
|
-
|
|
160
|
-
push(types, releaseContextTypes);
|
|
161
|
-
}
|
|
154
|
+
getTypes(includeRelease = true, includeDependencies = true) {
|
|
155
|
+
const types = includeRelease ?
|
|
156
|
+
this.releaseContext.getTypes(includeDependencies) :
|
|
157
|
+
this.types;
|
|
162
158
|
|
|
163
159
|
return types;
|
|
164
160
|
}
|
|
165
161
|
|
|
166
162
|
getRules(includeRelease = true) {
|
|
167
|
-
const rules =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (includeRelease) {
|
|
172
|
-
const releaseContextRules = this.releaseContext.getRules();
|
|
173
|
-
|
|
174
|
-
push(rules, releaseContextRules);
|
|
175
|
-
}
|
|
163
|
+
const rules = includeRelease ?
|
|
164
|
+
this.releaseContext.getRules() :
|
|
165
|
+
this.rules;
|
|
176
166
|
|
|
177
167
|
return rules;
|
|
178
168
|
}
|
|
179
169
|
|
|
180
170
|
getAxioms(includeRelease = true) {
|
|
181
|
-
const axioms =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (includeRelease) {
|
|
186
|
-
const releaseContextAxioms = this.releaseContext.getAxioms();
|
|
187
|
-
|
|
188
|
-
push(axioms, releaseContextAxioms);
|
|
189
|
-
}
|
|
171
|
+
const axioms = includeRelease ?
|
|
172
|
+
this.releaseContext.getAxioms() :
|
|
173
|
+
this.axioms;
|
|
190
174
|
|
|
191
175
|
return axioms;
|
|
192
176
|
}
|
|
193
177
|
|
|
194
178
|
getLemmas(includeRelease = true) {
|
|
195
|
-
const lemmas =
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (includeRelease) {
|
|
200
|
-
const releaseContextLemmas = this.releaseContext.getLemmas();
|
|
201
|
-
|
|
202
|
-
push(lemmas, releaseContextLemmas);
|
|
203
|
-
}
|
|
179
|
+
const lemmas = includeRelease ?
|
|
180
|
+
this.releaseContext.getLemmas() :
|
|
181
|
+
this.lemmas;
|
|
204
182
|
|
|
205
183
|
return lemmas;
|
|
206
184
|
}
|
|
207
185
|
|
|
208
186
|
getTheorems(includeRelease = true) {
|
|
209
|
-
const theorems =
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (includeRelease) {
|
|
214
|
-
const releaseContextTheorems = this.releaseContext.getTheorems();
|
|
215
|
-
|
|
216
|
-
push(theorems, releaseContextTheorems);
|
|
217
|
-
}
|
|
187
|
+
const theorems = includeRelease ?
|
|
188
|
+
this.releaseContext.getTheorems() :
|
|
189
|
+
this.theorems;
|
|
218
190
|
|
|
219
191
|
return theorems;
|
|
220
192
|
}
|
|
@@ -224,97 +196,57 @@ export default class FileContext {
|
|
|
224
196
|
}
|
|
225
197
|
|
|
226
198
|
getProcedures(includeRelease = true) {
|
|
227
|
-
const procedures =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const releaseContextProcedures = this.releaseContext.getProcedures();
|
|
231
|
-
|
|
232
|
-
push(procedures, releaseContextProcedures);
|
|
233
|
-
}
|
|
199
|
+
const procedures = includeRelease ?
|
|
200
|
+
this.releaseContext.getProcedures() :
|
|
201
|
+
null; ///
|
|
234
202
|
|
|
235
203
|
return procedures;
|
|
236
204
|
}
|
|
237
205
|
|
|
238
206
|
getMetaLemmas(includeRelease = true) {
|
|
239
|
-
const metaLemmas =
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (includeRelease) {
|
|
244
|
-
const releaseContextMetaLemmas = this.releaseContext.getMetaLemmas();
|
|
245
|
-
|
|
246
|
-
push(metaLemmas, releaseContextMetaLemmas);
|
|
247
|
-
}
|
|
207
|
+
const metaLemmas = includeRelease ?
|
|
208
|
+
this.releaseContext.getMetaLemmas() :
|
|
209
|
+
this.metaLemmas;
|
|
248
210
|
|
|
249
211
|
return metaLemmas;
|
|
250
212
|
}
|
|
251
213
|
|
|
252
214
|
getConjectures(includeRelease = true) {
|
|
253
|
-
const conjectures =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (includeRelease) {
|
|
258
|
-
const releaseContextConjectures = this.releaseContext.getConjectures();
|
|
259
|
-
|
|
260
|
-
push(conjectures, releaseContextConjectures);
|
|
261
|
-
}
|
|
215
|
+
const conjectures = includeRelease ?
|
|
216
|
+
this.releaseContext.getConjectures() :
|
|
217
|
+
this.conjectures;
|
|
262
218
|
|
|
263
219
|
return conjectures;
|
|
264
220
|
}
|
|
265
221
|
|
|
266
222
|
getCombinators(includeRelease = true) {
|
|
267
|
-
const combinators =
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (includeRelease) {
|
|
272
|
-
const releaseContextCombinators = this.releaseContext.getCombinators();
|
|
273
|
-
|
|
274
|
-
push(combinators, releaseContextCombinators);
|
|
275
|
-
}
|
|
223
|
+
const combinators = includeRelease ?
|
|
224
|
+
this.releaseContext.getCombinators() :
|
|
225
|
+
this.combinators;
|
|
276
226
|
|
|
277
227
|
return combinators;
|
|
278
228
|
}
|
|
279
229
|
|
|
280
230
|
getTypePrefixes(includeRelease = true) {
|
|
281
|
-
const typePrefixes =
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (includeRelease) {
|
|
286
|
-
const releaseContextTypePrefixes = this.releaseContext.getTypePrefixes();
|
|
287
|
-
|
|
288
|
-
push(typePrefixes, releaseContextTypePrefixes);
|
|
289
|
-
}
|
|
231
|
+
const typePrefixes = includeRelease ?
|
|
232
|
+
this.releaseContext.getTypePrefixes() :
|
|
233
|
+
this.typePrefixes;
|
|
290
234
|
|
|
291
235
|
return typePrefixes;
|
|
292
236
|
}
|
|
293
237
|
|
|
294
238
|
getConstructors(includeRelease = true) {
|
|
295
|
-
const constructors =
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (includeRelease) {
|
|
300
|
-
const releaseContextConstructors = this.releaseContext.getConstructors();
|
|
301
|
-
|
|
302
|
-
push(constructors, releaseContextConstructors);
|
|
303
|
-
}
|
|
239
|
+
const constructors = includeRelease ?
|
|
240
|
+
this.releaseContext.getConstructors() :
|
|
241
|
+
this.constructors;
|
|
304
242
|
|
|
305
243
|
return constructors;
|
|
306
244
|
}
|
|
307
245
|
|
|
308
246
|
getMetatheorems(includeRelease = true) {
|
|
309
|
-
const metatheorems =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (includeRelease) {
|
|
314
|
-
const releaseContextMetatheorems = this.releaseContext.getMetatheorems();
|
|
315
|
-
|
|
316
|
-
push(metatheorems, releaseContextMetatheorems);
|
|
317
|
-
}
|
|
247
|
+
const metatheorems = includeRelease ?
|
|
248
|
+
this.releaseContext.getMetatheorems() :
|
|
249
|
+
this.metatheorems;
|
|
318
250
|
|
|
319
251
|
return metatheorems;
|
|
320
252
|
}
|
|
@@ -329,28 +261,6 @@ export default class FileContext {
|
|
|
329
261
|
return fileContext;
|
|
330
262
|
}
|
|
331
263
|
|
|
332
|
-
getTypePrefix(includeRelease = true) {
|
|
333
|
-
let typePrefix = null;
|
|
334
|
-
|
|
335
|
-
if (typePrefix === null) {
|
|
336
|
-
const typePrefixesLength = this.typePrefixes.length;
|
|
337
|
-
|
|
338
|
-
if (typePrefixesLength === 1) {
|
|
339
|
-
const firstTypePrefix = first(this.typePrefixes);
|
|
340
|
-
|
|
341
|
-
typePrefix = firstTypePrefix; ///
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (typePrefix === null) {
|
|
346
|
-
if (includeRelease) {
|
|
347
|
-
typePrefix = this.releaseContext.getTypePrefix();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return typePrefix;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
264
|
addType(type) {
|
|
355
265
|
this.types.push(type);
|
|
356
266
|
}
|
|
@@ -387,6 +297,10 @@ export default class FileContext {
|
|
|
387
297
|
this.combinators.push(combinator);
|
|
388
298
|
}
|
|
389
299
|
|
|
300
|
+
addTypePrefix(typePrefix) {
|
|
301
|
+
this.typePrefixes.push(typePrefix);
|
|
302
|
+
}
|
|
303
|
+
|
|
390
304
|
addConstructor(constructor) {
|
|
391
305
|
this.constructors.push(constructor);
|
|
392
306
|
}
|
|
@@ -602,8 +516,8 @@ export default class FileContext {
|
|
|
602
516
|
return metavariable;
|
|
603
517
|
}
|
|
604
518
|
|
|
605
|
-
findTypeByTypeName(typeName) {
|
|
606
|
-
let types = this.getTypes();
|
|
519
|
+
findTypeByTypeName(typeName, includeRelease = true, includeDependencies = true) {
|
|
520
|
+
let types = this.getTypes(includeRelease, includeDependencies);
|
|
607
521
|
|
|
608
522
|
types = [
|
|
609
523
|
...types,
|
|
@@ -621,17 +535,42 @@ export default class FileContext {
|
|
|
621
535
|
return type;
|
|
622
536
|
}
|
|
623
537
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
typePrefix = typePrefixes.find((typePrefix) => {
|
|
627
|
-
const typePrefixNameMatches = typePrefix.matchTypePrefixName(typePrefixName);
|
|
538
|
+
findTypeByNominalTypeName(nominalTypeName) {
|
|
539
|
+
let types = this.getTypes();
|
|
628
540
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
541
|
+
types = [
|
|
542
|
+
...types,
|
|
543
|
+
objectType
|
|
544
|
+
];
|
|
633
545
|
|
|
634
|
-
|
|
546
|
+
const type = types.find((type) => {
|
|
547
|
+
const typeNameMatches = type.matchNominalTypeName(nominalTypeName);
|
|
548
|
+
|
|
549
|
+
if (typeNameMatches) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
}) || null;
|
|
553
|
+
|
|
554
|
+
return type;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
findTypeByPrefixedTypeName(prefixedTypeName) {
|
|
558
|
+
let types = this.getTypes();
|
|
559
|
+
|
|
560
|
+
types = [
|
|
561
|
+
...types,
|
|
562
|
+
objectType
|
|
563
|
+
];
|
|
564
|
+
|
|
565
|
+
const type = types.find((type) => {
|
|
566
|
+
const typeNameMatches = type.matchPrefixedTypeName(prefixedTypeName);
|
|
567
|
+
|
|
568
|
+
if (typeNameMatches) {
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
}) || null;
|
|
572
|
+
|
|
573
|
+
return type;
|
|
635
574
|
}
|
|
636
575
|
|
|
637
576
|
findMetaTypeByMetaTypeName(metaTypeName) {
|
|
@@ -647,6 +586,19 @@ export default class FileContext {
|
|
|
647
586
|
return metaType;
|
|
648
587
|
}
|
|
649
588
|
|
|
589
|
+
findTypePrefixByTypePrefixName(typePrefixName) {
|
|
590
|
+
const typePrefixes = this.getTypePrefixes(),
|
|
591
|
+
typePrefix = typePrefixes.find((typePrefix) => {
|
|
592
|
+
const typePrefixNameMatches = typePrefix.matchTypePrefixName(typePrefixName);
|
|
593
|
+
|
|
594
|
+
if (typePrefixNameMatches) {
|
|
595
|
+
return true;
|
|
596
|
+
}
|
|
597
|
+
}) || null;
|
|
598
|
+
|
|
599
|
+
return typePrefix;
|
|
600
|
+
}
|
|
601
|
+
|
|
650
602
|
findVariableByVariableIdentifier(variableIdentifier) {
|
|
651
603
|
const variables = this.getVariables(),
|
|
652
604
|
variable = variables.find((variable) => {
|
|
@@ -725,8 +677,22 @@ export default class FileContext {
|
|
|
725
677
|
return metavariablePresent;
|
|
726
678
|
}
|
|
727
679
|
|
|
728
|
-
isTypePresentByTypeName(typeName) {
|
|
729
|
-
const type = this.findTypeByTypeName(typeName),
|
|
680
|
+
isTypePresentByTypeName(typeName, includeRelease = true, includeDependencies = true) {
|
|
681
|
+
const type = this.findTypeByTypeName(typeName, includeRelease, includeDependencies),
|
|
682
|
+
typePresent = (type !== null);
|
|
683
|
+
|
|
684
|
+
return typePresent;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
isTypePresentByNominalTypeName(nominalTypeName) {
|
|
688
|
+
const type = this.findTypeByNominalTypeName(nominalTypeName),
|
|
689
|
+
typePresent = (type !== null);
|
|
690
|
+
|
|
691
|
+
return typePresent;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
isTypePresentByPrefixedTypeName(prefixedTypeName) {
|
|
695
|
+
const type = this.findTypeByPrefixedTypeName(prefixedTypeName),
|
|
730
696
|
typePresent = (type !== null);
|
|
731
697
|
|
|
732
698
|
return typePresent;
|
package/src/context/local.js
CHANGED
|
@@ -231,10 +231,10 @@ class LocalContext {
|
|
|
231
231
|
|
|
232
232
|
findMetavariable(metavariable, generalContext, specificContext) { return this.context.findMetavariable(metavariable, generalContext, specificContext); }
|
|
233
233
|
|
|
234
|
-
findTypeByTypeName(typeName) { return this.context.findTypeByTypeName(typeName); }
|
|
235
|
-
|
|
236
234
|
findLabelByMetavariable(metavariable) { return this.context.findLabelByMetavariable(metavariable); }
|
|
237
235
|
|
|
236
|
+
findTypeByNominalTypeName(nominalTypeName) { return this.context.findTypeByNominalTypeName(nominalTypeName); }
|
|
237
|
+
|
|
238
238
|
findMetaTypeByMetaTypeName(metaTypeName) { return this.context.findMetaTypeByMetaTypeName(metaTypeName); }
|
|
239
239
|
|
|
240
240
|
findMetavariableByMetavariableName(metavariableName) { return this.context.findMetavariableByMetavariableName(metavariableName); }
|
|
@@ -251,7 +251,11 @@ class LocalContext {
|
|
|
251
251
|
|
|
252
252
|
isMetavariablePresent(metavariable, generalContext, specificContext) { return this.context.isMetavariablePresent(metavariable, generalContext, specificContext); }
|
|
253
253
|
|
|
254
|
-
isTypePresentByTypeName(typeName) { return this.context.isTypePresentByTypeName(typeName); }
|
|
254
|
+
isTypePresentByTypeName(typeName, includeRelease = true, includeDependencies = true) { return this.context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies); }
|
|
255
|
+
|
|
256
|
+
isTypePresentByNominalTypeName(nominalTypeName) { return this.context.isTypePresentByNominalTypeName(nominalTypeName); }
|
|
257
|
+
|
|
258
|
+
isTypePresentByPrefixedTypeName(prefixedTypeName) { return this.context.isTypePresentByPrefixedTypeName(prefixedTypeName); }
|
|
255
259
|
|
|
256
260
|
isTypePrefixPresentByTypePrefixName(typePrefixName) { return this.context.isTypePrefixPresentByTypePrefixName(typePrefixName); }
|
|
257
261
|
|
package/src/context/release.js
CHANGED
|
@@ -13,9 +13,9 @@ import NominalParser from "../nominal/parser";
|
|
|
13
13
|
import { frameMetaType, referenceMetaType, statementMetaType } from "../dom/metaType";
|
|
14
14
|
import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
|
|
15
15
|
|
|
16
|
-
const {
|
|
17
|
-
{ nominalLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
16
|
+
const { nominalLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
18
17
|
{ nominalParserFromCombinedCustomGrammar } = parsersUtilities,
|
|
18
|
+
{ tail, push, first, clear, filter, resolve, compress } = arrayUtilities,
|
|
19
19
|
{ isFilePathFurtleFilePath, isFilePathNominalFilePath } = filePathUtilities;
|
|
20
20
|
|
|
21
21
|
export default class ReleaseContext {
|
|
@@ -469,15 +469,21 @@ export default class ReleaseContext {
|
|
|
469
469
|
verify() {
|
|
470
470
|
let verifies = false;
|
|
471
471
|
|
|
472
|
-
const
|
|
473
|
-
|
|
472
|
+
const typePrefixes = this.getTypePrefixes(),
|
|
473
|
+
releaseContext = this, ///
|
|
474
|
+
typePrefixesVerify = verifyTypePrefixes(typePrefixes, releaseContext);
|
|
474
475
|
|
|
475
|
-
if (
|
|
476
|
-
|
|
476
|
+
if (typePrefixesVerify) {
|
|
477
|
+
const verifiedFileContexts = [],
|
|
478
|
+
fileContextsVerify = verifyFileContexts(this.fileContexts, verifiedFileContexts, releaseContext);
|
|
477
479
|
|
|
478
|
-
|
|
480
|
+
if (fileContextsVerify) {
|
|
481
|
+
this.fileContexts = verifiedFileContexts; ///
|
|
479
482
|
|
|
480
|
-
|
|
483
|
+
this.verified = true;
|
|
484
|
+
|
|
485
|
+
verifies = true;
|
|
486
|
+
}
|
|
481
487
|
}
|
|
482
488
|
|
|
483
489
|
return verifies;
|
|
@@ -508,6 +514,46 @@ export default class ReleaseContext {
|
|
|
508
514
|
}
|
|
509
515
|
}
|
|
510
516
|
|
|
517
|
+
function verifyTypePrefixes(typePrefixes, releaseContext) {
|
|
518
|
+
let typePrefixesVerify = true;
|
|
519
|
+
|
|
520
|
+
const typePrefixesLength = typePrefixes.length,
|
|
521
|
+
compressedTypePrefixes = [ ///
|
|
522
|
+
...typePrefixes,
|
|
523
|
+
];
|
|
524
|
+
|
|
525
|
+
compress(compressedTypePrefixes, (typePrefixA, typePrefixB) => {
|
|
526
|
+
const typePrefixAName = typePrefixA.getName(),
|
|
527
|
+
typePrefixBName = typePrefixB.getName();
|
|
528
|
+
|
|
529
|
+
if (typePrefixAName === typePrefixBName) {
|
|
530
|
+
return true;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
const compressTypePrefixesLength = compressedTypePrefixes.length;
|
|
535
|
+
|
|
536
|
+
if (typePrefixesLength > compressTypePrefixesLength) {
|
|
537
|
+
filter(compressedTypePrefixes, (typePrefix) => {
|
|
538
|
+
const typePrefixesIncludesTypePrefix = typePrefixes.includes(typePrefix);
|
|
539
|
+
|
|
540
|
+
if (!typePrefixesIncludesTypePrefix) {
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
const firstTypePrefix = first(typePrefixes),
|
|
546
|
+
typePrefix = firstTypePrefix, ///
|
|
547
|
+
typePrefixString = typePrefix.getString();
|
|
548
|
+
|
|
549
|
+
releaseContext.info(`The '${typePrefixString}' type prefix is duplicated at least once, possibly among others.`)
|
|
550
|
+
|
|
551
|
+
typePrefixesVerify = false;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return typePrefixesVerify;
|
|
555
|
+
}
|
|
556
|
+
|
|
511
557
|
function verifyFileContexts(fileContexts, verifiedFileContexts) {
|
|
512
558
|
const resolved = resolve(fileContexts, verifiedFileContexts, (fileContext) => {
|
|
513
559
|
const fileContextVerifies = fileContext.verify();
|
|
@@ -64,12 +64,12 @@ export default domAssigned(class TypeAssertion {
|
|
|
64
64
|
verifyType(context) {
|
|
65
65
|
let typeVerifies;
|
|
66
66
|
|
|
67
|
-
const
|
|
68
|
-
typeString = this.type.getString();
|
|
67
|
+
const typeString = this.type.getString();
|
|
69
68
|
|
|
70
69
|
context.trace(`Verifying the '${typeString}' type...`);
|
|
71
70
|
|
|
72
|
-
const
|
|
71
|
+
const nominalTypeName = this.type.getNominalTypeName(),
|
|
72
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
73
73
|
|
|
74
74
|
if (type !== null) {
|
|
75
75
|
this.type = type;
|