occam-verify-cli 1.0.320 → 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 +97 -109
- package/lib/context/local.js +21 -9
- package/lib/context/release.js +58 -7
- package/lib/dom/assertion/type.js +3 -3
- package/lib/dom/declaration/complexType.js +106 -92
- package/lib/dom/declaration/constructor.js +5 -5
- package/lib/dom/declaration/metavariable.js +3 -3
- package/lib/dom/declaration/simpleType.js +37 -41
- package/lib/dom/declaration/typePrefix.js +11 -6
- 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/type.js +100 -50
- package/lib/dom/variable.js +3 -3
- package/lib/node/declaration/complexType.js +8 -1
- package/lib/node/declaration/simpleType.js +8 -1
- package/lib/node/type.js +15 -1
- 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 +3 -9
- package/lib/verifier/combinator.js +2 -2
- package/lib/verifier/constructor.js +3 -3
- package/package.json +1 -1
- package/src/context/file.js +136 -155
- 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 +135 -118
- package/src/dom/declaration/constructor.js +6 -6
- package/src/dom/declaration/metavariable.js +3 -3
- package/src/dom/declaration/simpleType.js +48 -51
- package/src/dom/declaration/typePrefix.js +15 -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/type.js +114 -61
- package/src/dom/variable.js +3 -3
- package/src/node/declaration/complexType.js +7 -0
- package/src/node/declaration/simpleType.js +7 -0
- package/src/node/type.js +17 -0
- 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 -12
- package/src/verifier/combinator.js +2 -2
- package/src/verifier/constructor.js +3 -3
package/src/dom/type.js
CHANGED
|
@@ -13,19 +13,15 @@ import { superTypesFromJSON, propertiesFromJSON, superTypesToSuperTypesJSON, pro
|
|
|
13
13
|
const { push, first } = arrayUtilities;
|
|
14
14
|
|
|
15
15
|
class Type {
|
|
16
|
-
constructor(
|
|
17
|
-
this.context = context;
|
|
16
|
+
constructor(string, name, prefixName, superTypes, properties, provisional) {
|
|
18
17
|
this.string = string;
|
|
19
18
|
this.name = name;
|
|
19
|
+
this.prefixName = prefixName;
|
|
20
20
|
this.superTypes = superTypes;
|
|
21
21
|
this.properties = properties;
|
|
22
22
|
this.provisional = provisional;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
getContext() {
|
|
26
|
-
return this.context;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
getString() {
|
|
30
26
|
return this.string;
|
|
31
27
|
}
|
|
@@ -34,6 +30,10 @@ class Type {
|
|
|
34
30
|
return this.name;
|
|
35
31
|
}
|
|
36
32
|
|
|
33
|
+
getPrefixName() {
|
|
34
|
+
return this.prefixName;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
37
|
getSuperTypes() {
|
|
38
38
|
return this.superTypes;
|
|
39
39
|
}
|
|
@@ -76,6 +76,10 @@ class Type {
|
|
|
76
76
|
this.name = name;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
setPrefixName(prefixName) {
|
|
80
|
+
this.prefixName = prefixName;
|
|
81
|
+
}
|
|
82
|
+
|
|
79
83
|
setSuperTypes(superTypes) {
|
|
80
84
|
this.superTypes = superTypes;
|
|
81
85
|
}
|
|
@@ -88,40 +92,39 @@ class Type {
|
|
|
88
92
|
this.provisional = provisional;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const typePrefix = this.context.getTypePrefix();
|
|
95
|
+
replaceSuperType(oldSuperType, newSuperType) {
|
|
96
|
+
const index = this.superTypes.indexOf(oldSuperType),
|
|
97
|
+
start = index,
|
|
98
|
+
deleteCount = 1;
|
|
96
99
|
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return prefix;
|
|
100
|
+
this.superTypes.splice(start, deleteCount, newSuperType);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
fileContext,
|
|
106
|
-
releaseContext;
|
|
103
|
+
isPrefixed() {
|
|
104
|
+
const prefixed = (this.prefixName !== null);
|
|
107
105
|
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
return prefixed;
|
|
107
|
+
}
|
|
110
108
|
|
|
111
|
-
|
|
109
|
+
getPrefixedName() {
|
|
110
|
+
let prefixedName = null;
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
const prefixed = this.isPrefixed();
|
|
114
113
|
|
|
115
|
-
|
|
114
|
+
if (prefixed) {
|
|
115
|
+
prefixedName = `${this.prefixName}${this.name}`;
|
|
116
|
+
}
|
|
116
117
|
|
|
117
|
-
|
|
118
|
+
return prefixedName;
|
|
119
|
+
}
|
|
118
120
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
getNominalTypeName() {
|
|
122
|
+
const prefixed = this.isPrefixed(),
|
|
123
|
+
nominalTypeName = prefixed ?
|
|
124
|
+
`${this.prefixName}${this.name}` :
|
|
125
|
+
this.name;
|
|
123
126
|
|
|
124
|
-
return
|
|
127
|
+
return nominalTypeName;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
isBasic() {
|
|
@@ -219,22 +222,9 @@ class Type {
|
|
|
219
222
|
return equalToOrSuperTypeOf;
|
|
220
223
|
}
|
|
221
224
|
|
|
222
|
-
matchTypeName(typeName
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const naked = !prefixed,
|
|
226
|
-
internal = this.isInternal(context);
|
|
227
|
-
|
|
228
|
-
if (naked || internal) {
|
|
229
|
-
typeNameMatches = (this.name === typeName);
|
|
230
|
-
} else {
|
|
231
|
-
const prefix = this.getPrefix(),
|
|
232
|
-
name = (prefix !== null) ?
|
|
233
|
-
`${prefix}${this.name}` :
|
|
234
|
-
this.name;
|
|
235
|
-
|
|
236
|
-
typeNameMatches = (name === typeName);
|
|
237
|
-
}
|
|
225
|
+
matchTypeName(typeName) {
|
|
226
|
+
const name = this.getName(),
|
|
227
|
+
typeNameMatches = (name === typeName);
|
|
238
228
|
|
|
239
229
|
return typeNameMatches;
|
|
240
230
|
}
|
|
@@ -253,6 +243,42 @@ class Type {
|
|
|
253
243
|
return provisionalMatches;
|
|
254
244
|
}
|
|
255
245
|
|
|
246
|
+
matchPrefixedTypeName(prefixedTypeName) {
|
|
247
|
+
let prefixedTypeNameMatches = false;
|
|
248
|
+
|
|
249
|
+
const prefixed = this.isPrefixed();
|
|
250
|
+
|
|
251
|
+
if (prefixed) {
|
|
252
|
+
const prefixedName = this.getPrefixedName();
|
|
253
|
+
|
|
254
|
+
prefixedTypeNameMatches = (prefixedTypeName === prefixedName);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return prefixedTypeNameMatches;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
matchNominalTypeName(nominalTypeName) {
|
|
261
|
+
let nominalTypeNameMatches = false;
|
|
262
|
+
|
|
263
|
+
if (!nominalTypeNameMatches) {
|
|
264
|
+
const name = this.getName();
|
|
265
|
+
|
|
266
|
+
nominalTypeNameMatches = (nominalTypeName === name);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (!nominalTypeNameMatches) {
|
|
270
|
+
const prefixed = this.isPrefixed();
|
|
271
|
+
|
|
272
|
+
if (prefixed) {
|
|
273
|
+
const prefixedName = this.getPrefixedName();
|
|
274
|
+
|
|
275
|
+
nominalTypeNameMatches = (nominalTypeName === prefixedName);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return nominalTypeNameMatches;
|
|
280
|
+
}
|
|
281
|
+
|
|
256
282
|
toJSON() {
|
|
257
283
|
const propertiesJSON = propertiesToPropertiesJSON(this.properties),
|
|
258
284
|
superTypesJSON = superTypesToSuperTypesJSON(this.superTypes),
|
|
@@ -260,8 +286,10 @@ class Type {
|
|
|
260
286
|
properties = propertiesJSON, ///
|
|
261
287
|
superTypes = superTypesJSON, ///
|
|
262
288
|
name = this.name,
|
|
289
|
+
prefixName = this.prefixName,
|
|
263
290
|
json = {
|
|
264
291
|
name,
|
|
292
|
+
prefixName,
|
|
265
293
|
superTypes,
|
|
266
294
|
properties,
|
|
267
295
|
provisional
|
|
@@ -273,13 +301,13 @@ class Type {
|
|
|
273
301
|
static name = "Type";
|
|
274
302
|
|
|
275
303
|
static fromJSON(json, context) {
|
|
276
|
-
const { name, provisional } = json,
|
|
304
|
+
const { name, prefixName, provisional } = json,
|
|
277
305
|
properties = propertiesFromJSON(json, context),
|
|
278
306
|
superTypes = superTypesFromJSON(json, context),
|
|
279
307
|
typeName = name, ///
|
|
280
308
|
typePrefixName = null,
|
|
281
309
|
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
282
|
-
type = new Type(
|
|
310
|
+
type = new Type(string, name, prefixName, superTypes, properties, provisional);
|
|
283
311
|
|
|
284
312
|
return type;
|
|
285
313
|
}
|
|
@@ -290,6 +318,15 @@ class Type {
|
|
|
290
318
|
return type;
|
|
291
319
|
}
|
|
292
320
|
|
|
321
|
+
static fromSuperTypeNode(superTypeNode, context) {
|
|
322
|
+
context = null; ///
|
|
323
|
+
|
|
324
|
+
const typeNode = superTypeNode, ///
|
|
325
|
+
type = typeFromTypeNode(typeNode, context);
|
|
326
|
+
|
|
327
|
+
return type;
|
|
328
|
+
}
|
|
329
|
+
|
|
293
330
|
static fromTypeAssertionNode(typeAssertionNode, context) {
|
|
294
331
|
const typeNode = typeAssertionNode.getTypeNode(),
|
|
295
332
|
type = typeFromTypeNode(typeNode, context);
|
|
@@ -298,18 +335,18 @@ class Type {
|
|
|
298
335
|
}
|
|
299
336
|
|
|
300
337
|
static fromTypeAndProvisional(type, provisional) {
|
|
301
|
-
const
|
|
302
|
-
|
|
338
|
+
const name = type.getName(),
|
|
339
|
+
prefixName = type.getPrefixName(),
|
|
303
340
|
superType = type, ///
|
|
304
341
|
typeName = name, ///
|
|
305
|
-
typePrefixName =
|
|
342
|
+
typePrefixName = prefixName, ///
|
|
306
343
|
superTypes = [
|
|
307
344
|
superType
|
|
308
345
|
],
|
|
309
346
|
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
310
347
|
properties = type.getProperties();
|
|
311
348
|
|
|
312
|
-
type = new Type(
|
|
349
|
+
type = new Type(string, name, prefixName, superTypes, properties, provisional); ///
|
|
313
350
|
|
|
314
351
|
return type;
|
|
315
352
|
}
|
|
@@ -327,9 +364,10 @@ class Type {
|
|
|
327
364
|
typeName = simpleTypeDeclarationNode.getTypeName(),
|
|
328
365
|
typePrefixName = simpleTypeDeclarationNode.getTypePrefixName(),
|
|
329
366
|
name = typeName, ///
|
|
367
|
+
prefixName = typePrefixName, ///
|
|
330
368
|
superTypes = superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
331
369
|
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
332
|
-
type = new Type(
|
|
370
|
+
type = new Type(string, name, prefixName, superTypes, properties, provisional);
|
|
333
371
|
|
|
334
372
|
return type;
|
|
335
373
|
}
|
|
@@ -339,10 +377,11 @@ class Type {
|
|
|
339
377
|
typeName = complexTypeDeclarationNode.getTypeName(),
|
|
340
378
|
typePrefixName = complexTypeDeclarationNode.getTypePrefixName(),
|
|
341
379
|
name = typeName, ///
|
|
380
|
+
prefixName = typePrefixName, ///
|
|
342
381
|
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
343
382
|
properties = propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
344
383
|
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
345
|
-
type = new Type(
|
|
384
|
+
type = new Type(string, name, prefixName, superTypes, properties, provisional);
|
|
346
385
|
|
|
347
386
|
return type;
|
|
348
387
|
}
|
|
@@ -371,10 +410,17 @@ export default domAssigned(Type);
|
|
|
371
410
|
function superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
372
411
|
const superTypeNodes = simpleTypeDeclarationNode.getSuperTypeNodes(),
|
|
373
412
|
superTypes = superTypeNodes.map((superTypeNode) => {
|
|
374
|
-
const superType = Type.
|
|
413
|
+
const superType = Type.fromSuperTypeNode(superTypeNode, context);
|
|
375
414
|
|
|
376
415
|
return superType;
|
|
377
|
-
})
|
|
416
|
+
}),
|
|
417
|
+
superTypesLength = superTypes.length;
|
|
418
|
+
|
|
419
|
+
if (superTypesLength === 0) {
|
|
420
|
+
const superType = objectType; ///
|
|
421
|
+
|
|
422
|
+
superTypes.push(superType);
|
|
423
|
+
}
|
|
378
424
|
|
|
379
425
|
return superTypes;
|
|
380
426
|
}
|
|
@@ -382,10 +428,17 @@ function superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, cont
|
|
|
382
428
|
function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
383
429
|
const superTypeNodes = complexTypeDeclarationNode.getSuperTypeNodes(),
|
|
384
430
|
superTypes = superTypeNodes.map((superTypeNode) => {
|
|
385
|
-
const superType = Type.
|
|
431
|
+
const superType = Type.fromSuperTypeNode(superTypeNode, context);
|
|
386
432
|
|
|
387
433
|
return superType;
|
|
388
|
-
})
|
|
434
|
+
}),
|
|
435
|
+
superTypesLength = superTypes.length;
|
|
436
|
+
|
|
437
|
+
if (superTypesLength === 0) {
|
|
438
|
+
const superType = objectType; ///
|
|
439
|
+
|
|
440
|
+
superTypes.push(superType);
|
|
441
|
+
}
|
|
389
442
|
|
|
390
443
|
return superTypes;
|
|
391
444
|
}
|
|
@@ -404,13 +457,13 @@ function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, co
|
|
|
404
457
|
|
|
405
458
|
class ObjectType extends Type {
|
|
406
459
|
static fromNothing() {
|
|
407
|
-
const
|
|
408
|
-
name = OBJECT_TYPE_NAME,
|
|
460
|
+
const name = OBJECT_TYPE_NAME,
|
|
409
461
|
string = name, ///
|
|
462
|
+
prefixName = null,
|
|
410
463
|
superTypes = [],
|
|
411
464
|
properties = [],
|
|
412
465
|
provisional = false,
|
|
413
|
-
objectType = new ObjectType(
|
|
466
|
+
objectType = new ObjectType(string, name, prefixName, superTypes, properties, provisional);
|
|
414
467
|
|
|
415
468
|
return objectType;
|
|
416
469
|
}
|
package/src/dom/variable.js
CHANGED
|
@@ -92,12 +92,12 @@ export default domAssigned(class Variable {
|
|
|
92
92
|
verifyType(context) {
|
|
93
93
|
let typeVerifies = false;
|
|
94
94
|
|
|
95
|
-
const
|
|
96
|
-
typeString = this.type.getString();
|
|
95
|
+
const typeString = this.type.getString();
|
|
97
96
|
|
|
98
97
|
context.trace(`Verifying the '${typeString}' type...`);
|
|
99
98
|
|
|
100
|
-
const
|
|
99
|
+
const prefixedTypeName = this.type.getPrefixedName(),
|
|
100
|
+
type = context.findTypeByPrefixedTypeName(prefixedTypeName);
|
|
101
101
|
|
|
102
102
|
if (type === null) {
|
|
103
103
|
context.debug(`The '${typeString}' type is not present.`);
|
|
@@ -77,6 +77,13 @@ export default class ComplexTypeDeclarationNode extends NonTerminalNode {
|
|
|
77
77
|
return typePrefixName;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
getNominalTypeName() {
|
|
81
|
+
const typeNode = this.getTypeNode(),
|
|
82
|
+
nominalTypeName = typeNode.getNominalTypeName();
|
|
83
|
+
|
|
84
|
+
return nominalTypeName;
|
|
85
|
+
}
|
|
86
|
+
|
|
80
87
|
getPropertyDeclarationNodes() {
|
|
81
88
|
const ruleName = PROPERTY_DECLARATION_RULE_NAME,
|
|
82
89
|
propertyDeclarationNodes = this.getNodesByRuleName(ruleName);
|
|
@@ -82,6 +82,13 @@ export default class SimpleTypeDeclarationNode extends NonTerminalNode {
|
|
|
82
82
|
return superTypeNodes;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
getNominalTypeName() {
|
|
86
|
+
const typeNode = this.getTypeNode(),
|
|
87
|
+
nominalTypeName = typeNode.getNominalTypeName();
|
|
88
|
+
|
|
89
|
+
return nominalTypeName;
|
|
90
|
+
}
|
|
91
|
+
|
|
85
92
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(SimpleTypeDeclarationNode, ruleName, childNodes, opacity, precedence); }
|
|
86
93
|
}
|
|
87
94
|
|
package/src/node/type.js
CHANGED
|
@@ -53,5 +53,22 @@ export default class TypeNode extends NonTerminalNode {
|
|
|
53
53
|
return typePrefixName;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
getNominalTypeName() {
|
|
57
|
+
let nominalTypeName;
|
|
58
|
+
|
|
59
|
+
const prefixed = this.isPrefixed(),
|
|
60
|
+
typeName = this.getTypeName();
|
|
61
|
+
|
|
62
|
+
if (prefixed) {
|
|
63
|
+
const typePrefixName = this.getTypePrefixName();
|
|
64
|
+
|
|
65
|
+
nominalTypeName = `${typePrefixName}${typeName}`;
|
|
66
|
+
} else {
|
|
67
|
+
nominalTypeName = typeName; ///
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return nominalTypeName;
|
|
71
|
+
}
|
|
72
|
+
|
|
56
73
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TypeNode, ruleName, childNodes, opacity, precedence); }
|
|
57
74
|
}
|
|
@@ -31,8 +31,8 @@ class MetavariableUnifier extends Unifier {
|
|
|
31
31
|
const { Term } = dom,
|
|
32
32
|
typeNode = generalTypeNode, ///
|
|
33
33
|
termNode = specificTermNode, ///
|
|
34
|
-
|
|
35
|
-
type = generalContext.
|
|
34
|
+
nominalTypeName = typeNode.getNominalTypeName(),
|
|
35
|
+
type = generalContext.findTypeByNominalTypeName(nominalTypeName),
|
|
36
36
|
context = specificContext, ///
|
|
37
37
|
term = Term.fromTermNode(termNode, context),
|
|
38
38
|
termVerifiesGivenType = term.verifyGivenType(type, generalContext, specificContext);
|
|
@@ -86,13 +86,13 @@ class StatementWithCombinatorUnifier extends Unifier {
|
|
|
86
86
|
const { Term } = dom,
|
|
87
87
|
typeNode = generalTypeNode, ///
|
|
88
88
|
termNode = specificTermNode, ///
|
|
89
|
-
|
|
89
|
+
nominalTypeName = typeNode.getNominalTypeName();
|
|
90
90
|
|
|
91
91
|
let context;
|
|
92
92
|
|
|
93
93
|
context = generalContext; ///
|
|
94
94
|
|
|
95
|
-
const type = context.
|
|
95
|
+
const type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
96
96
|
|
|
97
97
|
context = specificContext; ///
|
|
98
98
|
|
|
@@ -30,8 +30,8 @@ class TermWithConstructorUnifier extends Unifier {
|
|
|
30
30
|
|
|
31
31
|
const { Term } = dom,
|
|
32
32
|
typeNode = generalTypeNode, ///
|
|
33
|
-
|
|
34
|
-
type = context.
|
|
33
|
+
nominalTypeName = typeNode.getNominalTypeName(),
|
|
34
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
35
35
|
|
|
36
36
|
if (type !== null) {
|
|
37
37
|
const termNode = specificTermNode, ///
|
package/src/utilities/json.js
CHANGED
|
@@ -20,10 +20,14 @@ export function typeFromJSON(json, context) {
|
|
|
20
20
|
let { type } = json;
|
|
21
21
|
|
|
22
22
|
if (type !== null) {
|
|
23
|
-
|
|
24
|
-
typeName = name; ///
|
|
23
|
+
json = type; ///
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
const { name, prefixName } = json,
|
|
26
|
+
nominalTypeName = (prefixName !== null) ?
|
|
27
|
+
`${prefixName}:${name}` :
|
|
28
|
+
name; ///
|
|
29
|
+
|
|
30
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
return type;
|
|
@@ -33,7 +37,9 @@ export function metaTypeFromJSON(json, context) {
|
|
|
33
37
|
let { metaType } = json;
|
|
34
38
|
|
|
35
39
|
if (metaType !== null) {
|
|
36
|
-
|
|
40
|
+
json = metaType; ///
|
|
41
|
+
|
|
42
|
+
const { name } = json,
|
|
37
43
|
metaTypeName = name; ///
|
|
38
44
|
|
|
39
45
|
metaType = context.findMetaTypeByMetaTypeName(metaTypeName);
|
|
@@ -172,11 +178,11 @@ export function rulesFromJSON(json, context) {
|
|
|
172
178
|
let { rules } = json;
|
|
173
179
|
|
|
174
180
|
const { Rule } = dom,
|
|
175
|
-
|
|
181
|
+
rulesJSON = rules; ///
|
|
176
182
|
|
|
177
183
|
rules = rulesJSON.map((ruleJSON) => {
|
|
178
184
|
const json = ruleJSON, ///
|
|
179
|
-
|
|
185
|
+
rule = Rule.fromJSON(json, context);
|
|
180
186
|
|
|
181
187
|
return rule;
|
|
182
188
|
});
|
|
@@ -298,9 +304,11 @@ export function superTypesFromJSON(json, context) {
|
|
|
298
304
|
|
|
299
305
|
const superTypes = superTypesJSON.map((superTypeJSON) => {
|
|
300
306
|
const json = superTypeJSON, ///
|
|
301
|
-
{ name } = json,
|
|
302
|
-
|
|
303
|
-
|
|
307
|
+
{ name, prefixName } = json,
|
|
308
|
+
nominalSuperTypeName = (prefixName !== null) ?
|
|
309
|
+
`${prefixName}:${name}` :
|
|
310
|
+
name, ///
|
|
311
|
+
superType = context.findTypeByNominalTypeName(nominalSuperTypeName);
|
|
304
312
|
|
|
305
313
|
return superType;
|
|
306
314
|
});
|
|
@@ -373,7 +381,7 @@ export function combinatorsFromJSON(json, context) {
|
|
|
373
381
|
}
|
|
374
382
|
|
|
375
383
|
export function typePrefixesFromJSON(json, context) {
|
|
376
|
-
let { typePrefixes
|
|
384
|
+
let { typePrefixes } = json;
|
|
377
385
|
|
|
378
386
|
const { TypePrefix } = dom,
|
|
379
387
|
typePrefixesJSON = typePrefixes; ///
|
package/src/utilities/node.js
CHANGED
|
@@ -12,22 +12,16 @@ export function typeFromTypeNode(typeNode, context) {
|
|
|
12
12
|
} else {
|
|
13
13
|
const { Type } = dom,
|
|
14
14
|
typeName = typeNode.getTypeName(),
|
|
15
|
-
typePrefixName = typeNode.getTypePrefixName()
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (typePrefixName !== null) {
|
|
22
|
-
string = `${typePrefixName}${string}`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const name = typeName, ///
|
|
15
|
+
typePrefixName = typeNode.getTypePrefixName(),
|
|
16
|
+
nominalTypeName = typeNode.getNominalTypeName(),
|
|
17
|
+
string = nominalTypeName, ///
|
|
18
|
+
name = typeName, ///
|
|
19
|
+
prefixName = typePrefixName, ///
|
|
26
20
|
superTypes = null,
|
|
27
21
|
properties = null,
|
|
28
22
|
provisional = null;
|
|
29
23
|
|
|
30
|
-
type = new Type(
|
|
24
|
+
type = new Type(string, name, prefixName, superTypes, properties, provisional);
|
|
31
25
|
}
|
|
32
26
|
|
|
33
27
|
return type;
|
|
@@ -54,8 +54,8 @@ class CombinatorVerifier extends Verifier {
|
|
|
54
54
|
verify: (typeNode, context) => {
|
|
55
55
|
let typeVerifies = false;
|
|
56
56
|
|
|
57
|
-
const
|
|
58
|
-
typePresent = context.
|
|
57
|
+
const nominalTypeName = typeNode.getNominalTypeName(),
|
|
58
|
+
typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
59
59
|
|
|
60
60
|
if (typePresent) {
|
|
61
61
|
typeVerifies = true;
|
|
@@ -70,15 +70,15 @@ class ConstructorVerifier extends Verifier {
|
|
|
70
70
|
verify: (typeNode, context, verifyAhead) => {
|
|
71
71
|
let typeVerifies;
|
|
72
72
|
|
|
73
|
-
const
|
|
74
|
-
typePresent = context.
|
|
73
|
+
const nominalTypeName = typeNode.getNominalTypeName(),
|
|
74
|
+
typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
75
75
|
|
|
76
76
|
if (typePresent) {
|
|
77
77
|
const verifiesAhead = verifyAhead();
|
|
78
78
|
|
|
79
79
|
typeVerifies = verifiesAhead; ///
|
|
80
80
|
} else {
|
|
81
|
-
const typeString =
|
|
81
|
+
const typeString = nominalTypeName; ///
|
|
82
82
|
|
|
83
83
|
context.debug(`The '${typeString}' type is not present.`);
|
|
84
84
|
|