occam-verify-cli 1.0.230 → 1.0.234
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/assignment/variable.js +4 -2
- package/lib/context/file.js +5 -5
- package/lib/context/local.js +19 -14
- package/lib/dom/axiom.js +36 -27
- package/lib/dom/combinator.js +5 -5
- package/lib/dom/conclusion.js +5 -5
- package/lib/dom/conjecture.js +9 -9
- package/lib/dom/constructor.js +5 -5
- package/lib/dom/declaration/combinator.js +14 -14
- package/lib/dom/declaration/complexType.js +35 -35
- package/lib/dom/declaration/constructor.js +19 -19
- package/lib/dom/declaration/metavariable.js +22 -22
- package/lib/dom/declaration/simpleType.js +23 -23
- package/lib/dom/declaration/variable.js +20 -20
- package/lib/dom/declaration.js +4 -2
- package/lib/dom/deduction.js +5 -5
- package/lib/dom/derivation.js +5 -5
- package/lib/dom/error.js +9 -9
- package/lib/dom/hypothesis.js +184 -0
- package/lib/dom/label.js +18 -24
- package/lib/dom/lemma.js +7 -7
- package/lib/dom/metaLemma.js +9 -9
- package/lib/dom/metaType.js +4 -10
- package/lib/dom/metatheorem.js +9 -9
- package/lib/dom/metavariable.js +7 -8
- package/lib/dom/parameter.js +2 -2
- package/lib/dom/premise.js +5 -5
- package/lib/dom/procedureCall.js +3 -3
- package/lib/dom/proof.js +3 -3
- package/lib/dom/property.js +9 -9
- package/lib/dom/reference.js +23 -22
- package/lib/dom/rule.js +24 -24
- package/lib/dom/section.js +248 -0
- package/lib/dom/signature.js +5 -5
- package/lib/dom/statement.js +25 -20
- package/lib/dom/step.js +3 -3
- package/lib/dom/subDerivation.js +5 -5
- package/lib/dom/subproof.js +7 -7
- package/lib/dom/substitution/statement.js +3 -3
- package/lib/dom/supposition.js +5 -5
- package/lib/dom/term.js +5 -6
- package/lib/dom/theorem.js +9 -9
- package/lib/dom/topLevelAssertion.js +123 -31
- package/lib/dom/topLevelMetaAssertion.js +13 -13
- package/lib/dom/type.js +21 -21
- package/lib/dom/variable.js +9 -15
- package/lib/index.js +3 -1
- package/lib/mixins/step/unify.js +11 -11
- package/lib/mixins/term/verify.js +6 -6
- package/lib/node/hypothesis.js +123 -0
- package/lib/node/section.js +144 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ruleNames.js +9 -1
- package/lib/utilities/context.js +1 -1
- package/lib/utilities/json.js +82 -59
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/subproof.js +10 -10
- package/lib/verifier/combinator.js +9 -10
- package/lib/verifier/constructor.js +10 -11
- package/lib/verifier/topLevel.js +38 -31
- package/package.json +2 -2
- package/src/assignment/variable.js +6 -4
- package/src/context/file.js +3 -3
- package/src/context/local.js +6 -14
- package/src/dom/axiom.js +47 -42
- package/src/dom/combinator.js +4 -4
- package/src/dom/conclusion.js +5 -5
- package/src/dom/conjecture.js +8 -8
- package/src/dom/constructor.js +4 -4
- package/src/dom/declaration/combinator.js +14 -14
- package/src/dom/declaration/complexType.js +35 -35
- package/src/dom/declaration/constructor.js +20 -20
- package/src/dom/declaration/metavariable.js +22 -22
- package/src/dom/declaration/simpleType.js +22 -22
- package/src/dom/declaration/variable.js +21 -21
- package/src/dom/declaration.js +5 -3
- package/src/dom/deduction.js +5 -5
- package/src/dom/derivation.js +5 -5
- package/src/dom/error.js +8 -8
- package/src/dom/hypothesis.js +119 -0
- package/src/dom/label.js +17 -19
- package/src/dom/lemma.js +8 -8
- package/src/dom/metaLemma.js +8 -8
- package/src/dom/metaType.js +2 -6
- package/src/dom/metatheorem.js +8 -8
- package/src/dom/metavariable.js +9 -12
- package/src/dom/parameter.js +1 -1
- package/src/dom/premise.js +8 -8
- package/src/dom/procedureCall.js +3 -3
- package/src/dom/proof.js +2 -2
- package/src/dom/property.js +8 -8
- package/src/dom/reference.js +23 -27
- package/src/dom/rule.js +29 -29
- package/src/dom/section.js +197 -0
- package/src/dom/signature.js +4 -5
- package/src/dom/statement.js +24 -32
- package/src/dom/step.js +4 -4
- package/src/dom/subDerivation.js +5 -5
- package/src/dom/subproof.js +8 -8
- package/src/dom/substitution/statement.js +5 -5
- package/src/dom/supposition.js +7 -7
- package/src/dom/term.js +3 -8
- package/src/dom/theorem.js +7 -7
- package/src/dom/topLevelAssertion.js +113 -40
- package/src/dom/topLevelMetaAssertion.js +19 -19
- package/src/dom/type.js +22 -22
- package/src/dom/variable.js +8 -11
- package/src/index.js +2 -0
- package/src/mixins/step/unify.js +10 -10
- package/src/mixins/term/verify.js +4 -5
- package/src/node/hypothesis.js +23 -0
- package/src/node/section.js +44 -0
- package/src/nonTerminalNodeMap.js +7 -1
- package/src/ruleNames.js +2 -0
- package/src/utilities/context.js +2 -2
- package/src/utilities/json.js +86 -58
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/subproof.js +10 -10
- package/src/verifier/combinator.js +6 -11
- package/src/verifier/constructor.js +9 -12
- package/src/verifier/topLevel.js +42 -30
|
@@ -7,14 +7,14 @@ import { domAssigned } from "../../dom";
|
|
|
7
7
|
import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class ComplexTypeDeclaration {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
10
|
+
constructor(context, string, type) {
|
|
11
|
+
this.context = context;
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.type = type;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
getContext() {
|
|
17
|
+
return this.context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getString() {
|
|
@@ -25,16 +25,16 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
25
25
|
return this.type;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
getReleaseContext() { return this.
|
|
28
|
+
getReleaseContext() { return this.context.getReleaseContext(); }
|
|
29
29
|
|
|
30
30
|
getReleaseTypes() {
|
|
31
31
|
const includeDependencies = false,
|
|
32
32
|
includeRelease = false,
|
|
33
33
|
releaseContext = this.getReleaseContext(),
|
|
34
|
-
|
|
34
|
+
contextTypes = this.context.getTypes(includeRelease),
|
|
35
35
|
releaseContextTypes = releaseContext.getTypes(includeDependencies),
|
|
36
36
|
releaseTypes = [
|
|
37
|
-
...
|
|
37
|
+
...contextTypes,
|
|
38
38
|
...releaseContextTypes
|
|
39
39
|
];
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
46
46
|
|
|
47
47
|
const complexTypeDeclarationString = this.getString();
|
|
48
48
|
|
|
49
|
-
this.
|
|
49
|
+
this.context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`);
|
|
50
50
|
|
|
51
51
|
const typeVerifies = this.verifyType();
|
|
52
52
|
|
|
@@ -57,7 +57,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
57
57
|
const propertiesVerify = this.verifyProperties();
|
|
58
58
|
|
|
59
59
|
if (propertiesVerify) {
|
|
60
|
-
this.
|
|
60
|
+
this.context.addType(this.type);
|
|
61
61
|
|
|
62
62
|
verifies = true;
|
|
63
63
|
}
|
|
@@ -65,7 +65,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (verifies) {
|
|
68
|
-
this.
|
|
68
|
+
this.context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration.`);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
return verifies;
|
|
@@ -76,7 +76,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
76
76
|
|
|
77
77
|
const complexTypeString = this.type.getString();
|
|
78
78
|
|
|
79
|
-
this.
|
|
79
|
+
this.context.trace(`Verifying the '${complexTypeString}' complex type...`);
|
|
80
80
|
|
|
81
81
|
const typeName = this.type.getName(),
|
|
82
82
|
releaseTypes = this.getReleaseTypes(),
|
|
@@ -89,13 +89,13 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
if (typePresent) {
|
|
92
|
-
this.
|
|
92
|
+
this.context.debug(`The type '${complexTypeString}' is already present in the package.`);
|
|
93
93
|
} else {
|
|
94
94
|
typeVerifies = true;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
if (typeVerifies) {
|
|
98
|
-
this.
|
|
98
|
+
this.context.debug(`...verified the '${complexTypeString}' complex type.`);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
return typeVerifies;
|
|
@@ -106,17 +106,17 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
106
106
|
|
|
107
107
|
const superTypeString = superType.getString();
|
|
108
108
|
|
|
109
|
-
this.
|
|
109
|
+
this.context.trace(`Verifying the '${superTypeString}' super-type...`);
|
|
110
110
|
|
|
111
111
|
const superTypeName = superType.getName(),
|
|
112
|
-
superTypePresent = this.
|
|
112
|
+
superTypePresent = this.context.isTypePresentByTypeName(superTypeName);
|
|
113
113
|
|
|
114
114
|
if (superTypePresent) {
|
|
115
115
|
superTypeVerifies = true;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
if (superTypeVerifies) {
|
|
119
|
-
this.
|
|
119
|
+
this.context.debug(`...verified the '${superTypeString}' super-type.`);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
return superTypeVerifies;
|
|
@@ -125,7 +125,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
125
125
|
verifySuperTypes() {
|
|
126
126
|
let superTypesVerify = false;
|
|
127
127
|
|
|
128
|
-
this.
|
|
128
|
+
this.context.trace(`Verifying the super-types...`);
|
|
129
129
|
|
|
130
130
|
let superTypes;
|
|
131
131
|
|
|
@@ -135,7 +135,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
135
135
|
superTypesLength = superTypes.length;
|
|
136
136
|
|
|
137
137
|
if (superTypesLength === 0) {
|
|
138
|
-
const type = this.
|
|
138
|
+
const type = this.context.findTypeByTypeName(typeName);
|
|
139
139
|
|
|
140
140
|
if (type === null) {
|
|
141
141
|
const superType = objectType; ///
|
|
@@ -150,7 +150,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
150
150
|
if (typeBasic) {
|
|
151
151
|
superTypesVerify = true;
|
|
152
152
|
|
|
153
|
-
this.
|
|
153
|
+
this.context.trace(`The '${typeString}' type is basic.`)
|
|
154
154
|
} else {
|
|
155
155
|
const superTypeNames = superTypes.map((superType) => {
|
|
156
156
|
const superTypeName = superType.getName();
|
|
@@ -160,10 +160,10 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
160
160
|
superTypeNamesIncludesTypeName = superTypeNames.includes(typeName);
|
|
161
161
|
|
|
162
162
|
if (superTypeNamesIncludesTypeName) {
|
|
163
|
-
this.
|
|
163
|
+
this.context.trace(`The '${typeName}' type cannot be a super-type `);
|
|
164
164
|
} else {
|
|
165
165
|
if (superTypesLength === 0) {
|
|
166
|
-
const type = this.
|
|
166
|
+
const type = this.context.findTypeByTypeName(typeName),
|
|
167
167
|
superType = type; ///
|
|
168
168
|
|
|
169
169
|
superTypes.push(superType);
|
|
@@ -181,7 +181,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
181
181
|
superTypes = superTypes.map((superType) => {
|
|
182
182
|
const superTypeName = superType.getName();
|
|
183
183
|
|
|
184
|
-
superType = this.
|
|
184
|
+
superType = this.context.findTypeByTypeName(superTypeName);
|
|
185
185
|
|
|
186
186
|
return superType;
|
|
187
187
|
});
|
|
@@ -197,7 +197,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
if (superTypesVerify) {
|
|
200
|
-
this.
|
|
200
|
+
this.context.debug(`...verified the super-types.`);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
return superTypesVerify;
|
|
@@ -208,7 +208,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
208
208
|
|
|
209
209
|
const propertyString = property.getString();
|
|
210
210
|
|
|
211
|
-
this.
|
|
211
|
+
this.context.trace(`Verifying the '${propertyString}' property...`);
|
|
212
212
|
|
|
213
213
|
const propertyName = property.getName(),
|
|
214
214
|
count = properties.reduce((count, property) => {
|
|
@@ -222,7 +222,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
222
222
|
}, 0);
|
|
223
223
|
|
|
224
224
|
if (count > 1) {
|
|
225
|
-
this.
|
|
225
|
+
this.context.debug(`The '${propertyString}' property appears more than once.`);
|
|
226
226
|
} else {
|
|
227
227
|
const superTypeProperty = superTypeProperties.find((superTypeProperty) => {
|
|
228
228
|
const propertyNameMatches = superTypeProperty.matchPropertyName(propertyName);
|
|
@@ -235,7 +235,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
235
235
|
if (superTypeProperty !== null) {
|
|
236
236
|
const superTypePropertyString = superTypeProperty.getString();
|
|
237
237
|
|
|
238
|
-
this.
|
|
238
|
+
this.context.debug(`The '${propertyString}' property matches the super-type's '${superTypePropertyString}' property.`);
|
|
239
239
|
} else {
|
|
240
240
|
let propertyType;
|
|
241
241
|
|
|
@@ -246,7 +246,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
246
246
|
if (propertyTypeVerifies) {
|
|
247
247
|
const propertyTypeName = propertyType.getName();
|
|
248
248
|
|
|
249
|
-
propertyType = this.
|
|
249
|
+
propertyType = this.context.findTypeByTypeName(propertyTypeName);
|
|
250
250
|
|
|
251
251
|
const type = propertyType; ///
|
|
252
252
|
|
|
@@ -265,7 +265,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
265
265
|
property.setType(this.type);
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
this.
|
|
268
|
+
this.context.debug(`verifies the '${propertyString}' property.`);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
return propertyVerifies;
|
|
@@ -306,21 +306,21 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
306
306
|
} else {
|
|
307
307
|
const propertyTypeString = propertyType.getString(); ///
|
|
308
308
|
|
|
309
|
-
this.
|
|
309
|
+
this.context.trace(`Verifying the '${propertyTypeString}' property type...`);
|
|
310
310
|
|
|
311
311
|
const propertyTypeName = propertyType.getName(),
|
|
312
|
-
propertyTypePresent = this.
|
|
312
|
+
propertyTypePresent = this.context.isTypePresentByTypeName(propertyTypeName);
|
|
313
313
|
|
|
314
314
|
if (!propertyTypePresent) {
|
|
315
315
|
const propertyTypeString = propertyType.getString();
|
|
316
316
|
|
|
317
|
-
this.
|
|
317
|
+
this.context.debug(`The '${propertyTypeString}' property type is not present.`);
|
|
318
318
|
} else {
|
|
319
319
|
propertyTypeVerifies = true;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
if (propertyTypeVerifies) {
|
|
323
|
-
this.
|
|
323
|
+
this.context.debug(`...verified the '${propertyTypeString}' property type.`);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
@@ -329,13 +329,13 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
329
329
|
|
|
330
330
|
static name = "ComplexTypeDeclaration";
|
|
331
331
|
|
|
332
|
-
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode,
|
|
332
|
+
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
333
333
|
const { Type } = dom,
|
|
334
|
-
type = Type.fromComplexTypeDeclarationNode(complexTypeDeclarationNode,
|
|
334
|
+
type = Type.fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
335
335
|
typeName = type.getName(),
|
|
336
336
|
superTypes = type.getSuperTypes(),
|
|
337
337
|
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
338
|
-
complexTypeDeclaration = new ComplexTypeDeclaration(
|
|
338
|
+
complexTypeDeclaration = new ComplexTypeDeclaration(context, string, type);
|
|
339
339
|
|
|
340
340
|
return complexTypeDeclaration;
|
|
341
341
|
}
|
|
@@ -7,14 +7,14 @@ import constructorVerifier from "../../verifier/constructor";
|
|
|
7
7
|
import { domAssigned } from "../../dom";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class ConstructorDeclaration {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
10
|
+
constructor(context, string, constructor) {
|
|
11
|
+
this.context = context;
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.constructor = constructor;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
getContext() {
|
|
17
|
+
return this.context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getString() {
|
|
@@ -30,7 +30,7 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
30
30
|
|
|
31
31
|
const constructorDeclarationString = this.getString(); ///
|
|
32
32
|
|
|
33
|
-
this.
|
|
33
|
+
this.context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
34
34
|
|
|
35
35
|
const constructorTypeVerifies = this.verifyConstructorType();
|
|
36
36
|
|
|
@@ -38,14 +38,14 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
38
38
|
const constructorVerifies = this.verifyConstructor();
|
|
39
39
|
|
|
40
40
|
if (constructorVerifies) {
|
|
41
|
-
this.
|
|
41
|
+
this.context.addConstructor(this.constructor);
|
|
42
42
|
|
|
43
43
|
verifies = true;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
if (verifies) {
|
|
48
|
-
this.
|
|
48
|
+
this.context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return verifies;
|
|
@@ -56,15 +56,15 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
56
56
|
|
|
57
57
|
const constructorString = this.constructor.getString();
|
|
58
58
|
|
|
59
|
-
this.
|
|
59
|
+
this.context.trace(`Verifying the '${constructorString}' constructor...`);
|
|
60
60
|
|
|
61
61
|
const term = this.constructor.getTerm(),
|
|
62
62
|
termNode = term.getNode();
|
|
63
63
|
|
|
64
|
-
constructorVerifies = constructorVerifier.verifyTerm(termNode, this.
|
|
64
|
+
constructorVerifies = constructorVerifier.verifyTerm(termNode, this.context);
|
|
65
65
|
|
|
66
66
|
if (constructorVerifies) {
|
|
67
|
-
this.
|
|
67
|
+
this.context.debug(`...verified the '${constructorString}' constructor.`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return constructorVerifies;
|
|
@@ -80,24 +80,24 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
80
80
|
const typeName = type.getName(),
|
|
81
81
|
typeString = type.getString();
|
|
82
82
|
|
|
83
|
-
this.
|
|
83
|
+
this.context.trace(`Verifying the '${typeString}' type...`);
|
|
84
84
|
|
|
85
85
|
const includeSupertypes = false,
|
|
86
86
|
provisional = type.isProvisional(includeSupertypes);
|
|
87
87
|
|
|
88
|
-
type = this.
|
|
88
|
+
type = this.context.findTypeByTypeName(typeName);
|
|
89
89
|
|
|
90
90
|
const typePresent = (type !== null)
|
|
91
91
|
|
|
92
92
|
if (!typePresent) {
|
|
93
|
-
this.
|
|
93
|
+
this.context.debug(`The '${typeString}' type is not present.`);
|
|
94
94
|
} else {
|
|
95
95
|
const provisionalMatches = type.matchProvisional(provisional);
|
|
96
96
|
|
|
97
97
|
if (!provisionalMatches) {
|
|
98
98
|
provisional ?
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
99
|
+
this.context.debug(`The '${typeString}' type is present but not provisional.`) :
|
|
100
|
+
this.context.debug(`The '${typeString}' type is present but provisional.`);
|
|
101
101
|
} else {
|
|
102
102
|
this.constructor.setType(type);
|
|
103
103
|
|
|
@@ -106,7 +106,7 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if (constructorTypeVerifies) {
|
|
109
|
-
this.
|
|
109
|
+
this.context.debug(`...verified the '${typeString}' type.`);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
return constructorTypeVerifies;
|
|
@@ -114,12 +114,12 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
114
114
|
|
|
115
115
|
static name = "ConstructorDeclaration";
|
|
116
116
|
|
|
117
|
-
static fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
117
|
+
static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
118
118
|
const { Constructor } = dom,
|
|
119
119
|
node = constructorDeclarationNode, ///
|
|
120
|
-
string =
|
|
121
|
-
constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
122
|
-
constructorDeclaration = new ConstructorDeclaration(
|
|
120
|
+
string = context.nodeAsString(node),
|
|
121
|
+
constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode, context),
|
|
122
|
+
constructorDeclaration = new ConstructorDeclaration(context, string, constructor);
|
|
123
123
|
|
|
124
124
|
return constructorDeclaration;
|
|
125
125
|
}
|
|
@@ -5,14 +5,14 @@ import dom from "../../dom";
|
|
|
5
5
|
import { domAssigned } from "../../dom";
|
|
6
6
|
|
|
7
7
|
export default domAssigned(class MetavariableDeclaration {
|
|
8
|
-
constructor(
|
|
9
|
-
this.
|
|
8
|
+
constructor(context, string, metavariable) {
|
|
9
|
+
this.context = context;
|
|
10
10
|
this.string = string;
|
|
11
11
|
this.metavariable = metavariable;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
return this.
|
|
14
|
+
getContext() {
|
|
15
|
+
return this.context;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
getString() {
|
|
@@ -28,18 +28,18 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
28
28
|
|
|
29
29
|
const metavariableDeclarationString = this.string; ///
|
|
30
30
|
|
|
31
|
-
this.
|
|
31
|
+
this.context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`);
|
|
32
32
|
|
|
33
33
|
const metavariableVerifies = this.verifyMetavariable(this.metavariable);
|
|
34
34
|
|
|
35
35
|
if (metavariableVerifies) {
|
|
36
|
-
this.
|
|
36
|
+
this.context.addMetavariable(this.metavariable);
|
|
37
37
|
|
|
38
38
|
verifies = true;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (verifies) {
|
|
42
|
-
this.
|
|
42
|
+
this.context.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration.`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return verifies;
|
|
@@ -54,18 +54,18 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
54
54
|
const typeName = type.getName(),
|
|
55
55
|
typeString = type.getString();
|
|
56
56
|
|
|
57
|
-
this.
|
|
57
|
+
this.context.trace(`Verifying the '${typeString}' type...`);
|
|
58
58
|
|
|
59
|
-
const typePresent = this.
|
|
59
|
+
const typePresent = this.context.isTypePresentByTypeName(typeName);
|
|
60
60
|
|
|
61
61
|
if (!typePresent) {
|
|
62
|
-
this.
|
|
62
|
+
this.context.debug(`The '${typeString}' type is not present.`);
|
|
63
63
|
} else {
|
|
64
64
|
typeVerifies = true;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (typeVerifies) {
|
|
68
|
-
this.
|
|
68
|
+
this.context.debug(`...verified the '${typeString}' type.`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -77,19 +77,19 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
77
77
|
|
|
78
78
|
const metavariableString = metavariable.getString();
|
|
79
79
|
|
|
80
|
-
this.
|
|
80
|
+
this.context.trace(`Verifying the '${metavariableString}' metavariable when declared...`);
|
|
81
81
|
|
|
82
82
|
const metavariableNode = metavariable.getNode(), ///
|
|
83
83
|
termNode = metavariableNode.getTermNode();
|
|
84
84
|
|
|
85
85
|
if (termNode !== null) {
|
|
86
|
-
this.
|
|
86
|
+
this.context.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`);
|
|
87
87
|
} else {
|
|
88
88
|
const metavariableName = metavariable.getName(),
|
|
89
|
-
metavariablePresent = this.
|
|
89
|
+
metavariablePresent = this.context.isMetavariablePresentByMetavariableName(metavariableName);
|
|
90
90
|
|
|
91
91
|
if (metavariablePresent) {
|
|
92
|
-
this.
|
|
92
|
+
this.context.debug(`The '${metavariableName}' metavariable is already present.`);
|
|
93
93
|
} else {
|
|
94
94
|
const type = metavariable.getType(),
|
|
95
95
|
typeVerifies = this.verifyType(type);
|
|
@@ -99,7 +99,7 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (metavariableVerifies) {
|
|
102
|
-
this.
|
|
102
|
+
this.context.debug(`...verified the '${metavariableString}' metavariable when declared.`);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
return metavariableVerifies;
|
|
@@ -107,12 +107,12 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
107
107
|
|
|
108
108
|
static name = "MetavariableDeclaration";
|
|
109
109
|
|
|
110
|
-
static fromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
110
|
+
static fromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
111
111
|
const { Metavariable } = dom,
|
|
112
|
-
metaType = metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
113
|
-
metavariable = Metavariable.fromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
112
|
+
metaType = metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
113
|
+
metavariable = Metavariable.fromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
114
114
|
string = stringFromMetavariableAndMetaType(metavariable, metaType),
|
|
115
|
-
metavariableDeclaration = new MetavariableDeclaration(
|
|
115
|
+
metavariableDeclaration = new MetavariableDeclaration(context, string, metavariable);
|
|
116
116
|
|
|
117
117
|
return metavariableDeclaration;
|
|
118
118
|
}
|
|
@@ -134,10 +134,10 @@ function stringFromMetavariableAndMetaType(metavariable, metaType) {
|
|
|
134
134
|
return string;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
137
|
+
function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
138
138
|
const { MetaType } = dom,
|
|
139
139
|
metaTypeNode = metavariableDeclarationNode.getMetaTypeNode(),
|
|
140
|
-
metaType = MetaType.fromMetaTypeNode(metaTypeNode,
|
|
140
|
+
metaType = MetaType.fromMetaTypeNode(metaTypeNode, context);
|
|
141
141
|
|
|
142
142
|
return metaType;
|
|
143
143
|
}
|
|
@@ -7,14 +7,14 @@ import { domAssigned } from "../../dom";
|
|
|
7
7
|
import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class SimpleTypeDeclaration {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
10
|
+
constructor(context, string, type) {
|
|
11
|
+
this.context = context;
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.type = type;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
getContext() {
|
|
17
|
+
return this.context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getString() {
|
|
@@ -30,7 +30,7 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
30
30
|
|
|
31
31
|
const typeDeclarationString = this.getString(); ///
|
|
32
32
|
|
|
33
|
-
this.
|
|
33
|
+
this.context.trace(`Verifying the '${typeDeclarationString}' type declaration...`);
|
|
34
34
|
|
|
35
35
|
const typeVerifies = this.verifyType();
|
|
36
36
|
|
|
@@ -38,14 +38,14 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
38
38
|
const superTypesVerify = this.verifySuperTypes();
|
|
39
39
|
|
|
40
40
|
if (superTypesVerify) {
|
|
41
|
-
this.
|
|
41
|
+
this.context.addType(this.type);
|
|
42
42
|
|
|
43
43
|
verifies = true;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
if (verifies) {
|
|
48
|
-
this.
|
|
48
|
+
this.context.debug(`...verified the '${typeDeclarationString}' type declaration.`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return verifies;
|
|
@@ -56,19 +56,19 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
56
56
|
|
|
57
57
|
const typeString = this.type.getString();
|
|
58
58
|
|
|
59
|
-
this.
|
|
59
|
+
this.context.trace(`Verifying the '${typeString}' type...`);
|
|
60
60
|
|
|
61
61
|
const typeName = this.type.getName(),
|
|
62
|
-
typePresent = this.
|
|
62
|
+
typePresent = this.context.isTypePresentByTypeName(typeName);
|
|
63
63
|
|
|
64
64
|
if (typePresent) {
|
|
65
|
-
this.
|
|
65
|
+
this.context.debug(`The type '${typeString}' is already present.`);
|
|
66
66
|
} else {
|
|
67
67
|
typeVerifies = true;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (typeVerifies) {
|
|
71
|
-
this.
|
|
71
|
+
this.context.debug(`...verified the '${typeString}' type.`);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
return typeVerifies;
|
|
@@ -79,17 +79,17 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
79
79
|
|
|
80
80
|
const superTypeString = superType.getString();
|
|
81
81
|
|
|
82
|
-
this.
|
|
82
|
+
this.context.trace(`Verifying the '${superTypeString}' super-type...`);
|
|
83
83
|
|
|
84
84
|
const superTypeName = superType.getName(),
|
|
85
|
-
superTypePresent = this.
|
|
85
|
+
superTypePresent = this.context.isTypePresentByTypeName(superTypeName);
|
|
86
86
|
|
|
87
87
|
if (superTypePresent) {
|
|
88
88
|
superTypeVerifies = true;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if (superTypeVerifies) {
|
|
92
|
-
this.
|
|
92
|
+
this.context.debug(`...verified the '${superTypeString}' super-type.`);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
return superTypeVerifies;
|
|
@@ -98,7 +98,7 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
98
98
|
verifySuperTypes() {
|
|
99
99
|
let superTypesVerify = false;
|
|
100
100
|
|
|
101
|
-
this.
|
|
101
|
+
this.context.trace(`Verifying the super-types...`);
|
|
102
102
|
|
|
103
103
|
let superTypes;
|
|
104
104
|
|
|
@@ -119,7 +119,7 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
119
119
|
if (typeBasic) {
|
|
120
120
|
superTypesVerify = true;
|
|
121
121
|
|
|
122
|
-
this.
|
|
122
|
+
this.context.trace(`The '${typeString}' type is basic.`)
|
|
123
123
|
} else {
|
|
124
124
|
const superTypeNames = superTypes.map((superType) => {
|
|
125
125
|
const superTypeName = superType.getName();
|
|
@@ -129,7 +129,7 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
129
129
|
superTypeNamesIncludesTypeName = superTypeNames.includes(typeName);
|
|
130
130
|
|
|
131
131
|
if (superTypeNamesIncludesTypeName) {
|
|
132
|
-
this.
|
|
132
|
+
this.context.trace(`The '${typeName}' type cannot be a super-type `);
|
|
133
133
|
} else {
|
|
134
134
|
superTypesVerify = superTypes.every((superType) => {
|
|
135
135
|
const superTypeVerifies = this.verifySuperType(superType);
|
|
@@ -143,7 +143,7 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
143
143
|
superTypes = superTypes.map((superType) => {
|
|
144
144
|
const superTypeName = superType.getName();
|
|
145
145
|
|
|
146
|
-
superType = this.
|
|
146
|
+
superType = this.context.findTypeByTypeName(superTypeName);
|
|
147
147
|
|
|
148
148
|
return superType;
|
|
149
149
|
});
|
|
@@ -158,7 +158,7 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
if (superTypesVerify) {
|
|
161
|
-
this.
|
|
161
|
+
this.context.debug(`...verified the super-types.`);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
return superTypesVerify;
|
|
@@ -166,13 +166,13 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
166
166
|
|
|
167
167
|
static name = "SimpleTypeDeclaration";
|
|
168
168
|
|
|
169
|
-
static fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode,
|
|
169
|
+
static fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
170
170
|
const { Type } = dom,
|
|
171
|
-
type = Type.fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode,
|
|
171
|
+
type = Type.fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
172
172
|
typeName = type.getName(),
|
|
173
173
|
superTypes = type.getSuperTypes(),
|
|
174
174
|
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
175
|
-
simpleTypeDeclaration = new SimpleTypeDeclaration(
|
|
175
|
+
simpleTypeDeclaration = new SimpleTypeDeclaration(context, string, type);
|
|
176
176
|
|
|
177
177
|
return simpleTypeDeclaration;
|
|
178
178
|
}
|