occam-verify-cli 1.0.638 → 1.0.642
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/liminal.js +2 -2
- package/lib/context/scoped.js +4 -4
- package/lib/context.js +8 -1
- package/lib/element/assumption.js +3 -3
- package/lib/element/combinator.js +4 -4
- package/lib/element/declaration/combinator.js +15 -2
- package/lib/element/declaration/complexType.js +4 -4
- package/lib/element/declaration/constructor.js +129 -60
- package/lib/element/declaration/simpleType.js +51 -46
- package/lib/element/declaration/typePrefix.js +3 -3
- package/lib/element/declaration/variable.js +2 -2
- package/lib/element/equality.js +18 -17
- package/lib/element/frame.js +2 -2
- package/lib/element/judgement.js +4 -4
- package/lib/element/procedureCall.js +3 -3
- package/lib/element/reference.js +3 -3
- package/lib/element/rule.js +2 -2
- package/lib/element/statement.js +3 -3
- package/lib/element/term.js +7 -4
- package/lib/element/topLevelAssertion.js +2 -2
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/type.js +4 -4
- package/lib/utilities/element.js +147 -47
- package/package.json +7 -7
- package/src/context/liminal.js +1 -1
- package/src/context/scoped.js +3 -3
- package/src/context.js +7 -0
- package/src/element/assumption.js +1 -1
- package/src/element/combinator.js +3 -4
- package/src/element/declaration/combinator.js +19 -1
- package/src/element/declaration/complexType.js +3 -3
- package/src/element/declaration/constructor.js +123 -60
- package/src/element/declaration/simpleType.js +51 -50
- package/src/element/declaration/typePrefix.js +2 -2
- package/src/element/declaration/variable.js +1 -1
- package/src/element/equality.js +18 -20
- package/src/element/frame.js +1 -2
- package/src/element/judgement.js +2 -2
- package/src/element/procedureCall.js +2 -2
- package/src/element/reference.js +1 -1
- package/src/element/rule.js +1 -1
- package/src/element/statement.js +1 -1
- package/src/element/term.js +7 -3
- package/src/element/topLevelAssertion.js +1 -1
- package/src/element/topLevelMetaAssertion.js +1 -1
- package/src/element/type.js +3 -4
- package/src/utilities/element.js +214 -77
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-verify-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.642",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"argumentative": "^2.0.36",
|
|
14
14
|
"necessary": "^17.0.9",
|
|
15
15
|
"occam-file-system": "^6.0.505",
|
|
16
|
-
"occam-furtle": "^3.0.
|
|
17
|
-
"occam-grammars": "^1.3.
|
|
18
|
-
"occam-languages": "^0.0.
|
|
16
|
+
"occam-furtle": "^3.0.121",
|
|
17
|
+
"occam-grammars": "^1.3.512",
|
|
18
|
+
"occam-languages": "^0.0.92",
|
|
19
19
|
"occam-lexers": "^23.1.34",
|
|
20
|
-
"occam-model": "^1.0.
|
|
21
|
-
"occam-nominal": "^1.0.
|
|
22
|
-
"occam-parsers": "^23.1.
|
|
20
|
+
"occam-model": "^1.0.496",
|
|
21
|
+
"occam-nominal": "^1.0.45",
|
|
22
|
+
"occam-parsers": "^23.1.42"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@swc/core": "1.13.20",
|
package/src/context/liminal.js
CHANGED
|
@@ -77,7 +77,7 @@ export default class LiminalContext extends Context {
|
|
|
77
77
|
}) || null;
|
|
78
78
|
|
|
79
79
|
if (substitutionB !== null) {
|
|
80
|
-
context.
|
|
80
|
+
context.debug(`The '${substitutionString}' substitution has already been added to the liminal context.`);
|
|
81
81
|
} else {
|
|
82
82
|
this.substitutions.push(substitution);
|
|
83
83
|
|
package/src/context/scoped.js
CHANGED
|
@@ -117,15 +117,15 @@ class ScopedContext extends Context {
|
|
|
117
117
|
|
|
118
118
|
const equalityRelfexive = equality.isReflexive();
|
|
119
119
|
|
|
120
|
-
if (equalityRelfexive) {
|
|
121
|
-
context.trace(`The '${equalityString}' equality is reflexive and will not added to the scoped context.`);
|
|
122
|
-
} else {
|
|
120
|
+
if (!equalityRelfexive) {
|
|
123
121
|
const { Equivalence } = elements,
|
|
124
122
|
equivalence = Equivalence.fromEquality(equality, context);
|
|
125
123
|
|
|
126
124
|
this.equivalences = this.equivalences.mergedWithEquivalence(equivalence, context);
|
|
127
125
|
|
|
128
126
|
context.debug(`...added the '${equalityString}' equality to the scoped context.`);
|
|
127
|
+
} else {
|
|
128
|
+
context.debug(`The '${equalityString}' equality is reflexive and will not added to the scoped context.`);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
package/src/context.js
CHANGED
|
@@ -179,6 +179,13 @@ export default class Context extends ContextBase {
|
|
|
179
179
|
return reference;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
findSubstitutionBySubstitutionNode(substitutionNode) {
|
|
183
|
+
const context = this.getContext(),
|
|
184
|
+
substitution = context.findSubstitutionBySubstitutionNode(substitutionNode);
|
|
185
|
+
|
|
186
|
+
return substitution;
|
|
187
|
+
}
|
|
188
|
+
|
|
182
189
|
findVariableByVariableIdentifier(variableIdentifier) {
|
|
183
190
|
const context = this.getContext(),
|
|
184
191
|
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
@@ -25,16 +25,15 @@ export default define(class Combinator extends Element {
|
|
|
25
25
|
return combinatorNode;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
verify() {
|
|
28
|
+
verify(context) {
|
|
29
29
|
let verifies;
|
|
30
30
|
|
|
31
|
-
const
|
|
32
|
-
combinatorString = this.getString(); ///
|
|
31
|
+
const combinatorString = this.getString(); ///
|
|
33
32
|
|
|
34
33
|
context.trace(`Verifying the '${combinatorString}' combinator...`);
|
|
35
34
|
|
|
36
35
|
const combinator = this, ///
|
|
37
|
-
combinatorVerifies = verifyCombinator(combinator
|
|
36
|
+
combinatorVerifies = verifyCombinator(combinator);
|
|
38
37
|
|
|
39
38
|
if (combinatorVerifies) {
|
|
40
39
|
verifies = true;
|
|
@@ -30,7 +30,7 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
30
30
|
|
|
31
31
|
context.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
32
32
|
|
|
33
|
-
const combinatorVerifies = this.
|
|
33
|
+
const combinatorVerifies = this.verifyCombinator();
|
|
34
34
|
|
|
35
35
|
if (combinatorVerifies) {
|
|
36
36
|
context.addCombinator(this.combinator);
|
|
@@ -45,5 +45,23 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
45
45
|
return verifies;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
verifyCombinator() {
|
|
49
|
+
let combinatorVerifies;
|
|
50
|
+
|
|
51
|
+
const context = this.getContext(),
|
|
52
|
+
combinatorString = this.combinator.getString(),
|
|
53
|
+
combinatorDeclarationString = this.getString(); ///
|
|
54
|
+
|
|
55
|
+
context.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration's '${combinatorString}' combinator...`);
|
|
56
|
+
|
|
57
|
+
combinatorVerifies = this.combinator.verify(context);
|
|
58
|
+
|
|
59
|
+
if (combinatorVerifies) {
|
|
60
|
+
context.debug(`...verified the '${combinatorDeclarationString}' combinator declaration's '${combinatorString}' combinator.`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return combinatorVerifies;
|
|
64
|
+
}
|
|
65
|
+
|
|
48
66
|
static name = "CombinatorDeclaration";
|
|
49
67
|
});
|
|
@@ -41,20 +41,20 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
41
41
|
typePresent = context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
|
|
42
42
|
|
|
43
43
|
if (typePresent) {
|
|
44
|
-
context.
|
|
44
|
+
context.debug(`The '${typeString}' type is already present.`);
|
|
45
45
|
} else {
|
|
46
46
|
const prefixedTypeName = typeName, ///
|
|
47
47
|
typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
48
48
|
|
|
49
49
|
if (typePresent) {
|
|
50
|
-
context.
|
|
50
|
+
context.debug(`The '${typeString}' type is already present.`);
|
|
51
51
|
} else {
|
|
52
52
|
typeVerifies = true;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
if (typeVerifies) {
|
|
57
|
-
context.
|
|
57
|
+
context.debug(`...verified the '${typeString}' complex type.`);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return typeVerifies;
|
|
@@ -3,77 +3,81 @@
|
|
|
3
3
|
import Declaration from "../declaration";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { validateTerm } from "../../process/validate";
|
|
7
6
|
|
|
8
7
|
export default define(class ConstructorDeclaration extends Declaration {
|
|
9
|
-
constructor(context, string, node, constructor) {
|
|
8
|
+
constructor(context, string, node, type, provisional, constructor) {
|
|
10
9
|
super(context, string, node);
|
|
11
10
|
|
|
11
|
+
this.type = type;
|
|
12
|
+
this.provisional = provisional;
|
|
12
13
|
this.constructor = constructor;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
getType() {
|
|
17
|
+
return this.type;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
isProvisinal() {
|
|
21
|
+
return this.provisional;
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
getConstructor() {
|
|
16
25
|
return this.constructor;
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
getConstructorDeclarationNode() {
|
|
20
29
|
const node = this.getNode(),
|
|
21
|
-
constructorDeclarationNode = node;
|
|
30
|
+
constructorDeclarationNode = node; ///
|
|
22
31
|
|
|
23
32
|
return constructorDeclarationNode;
|
|
24
33
|
}
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
let
|
|
35
|
+
async verify() {
|
|
36
|
+
let verifies = false;
|
|
28
37
|
|
|
29
38
|
const context = this.getContext(),
|
|
30
|
-
|
|
39
|
+
constructorDeclarationString = this.getString(); ///
|
|
40
|
+
|
|
41
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
const typeVerified = this.verifyType();
|
|
33
44
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
termValidates = validateTerm(termNode, context, () => {
|
|
37
|
-
const validatesFormards = true;
|
|
45
|
+
if (typeVerified) {
|
|
46
|
+
const constructorVerifies = this.verifyConstructor();
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
if (constructorVerifies) {
|
|
49
|
+
const constructorTypeVerifies = this.verifyConstructorType();
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
if (constructorTypeVerifies) {
|
|
52
|
+
context.addConstructor(this.constructor);
|
|
53
|
+
|
|
54
|
+
verifies = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
if (
|
|
47
|
-
context.debug(`...verified the '${
|
|
59
|
+
if (verifies) {
|
|
60
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
48
61
|
}
|
|
49
62
|
|
|
50
|
-
return
|
|
63
|
+
return verifies;
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
const context = this.getContext();
|
|
57
|
-
|
|
58
|
-
let type;
|
|
66
|
+
verifyType() {
|
|
67
|
+
let typeVerifies = false;
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
context.trace(`Verifying the '${typeString}' type...`);
|
|
65
|
-
|
|
66
|
-
const nominalTypeName = type.getNominalTypeName();
|
|
69
|
+
const context = this.getContext(),
|
|
70
|
+
typeString = this.type.getString(),
|
|
71
|
+
constructorDeclarationString = this.getString(); ///
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's '${typeString}' type...`);
|
|
69
74
|
|
|
70
|
-
const
|
|
75
|
+
const nominalTypeName = this.type.getNominalTypeName(),
|
|
76
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
71
77
|
|
|
72
|
-
if (
|
|
73
|
-
context.debug(`The '${typeString}' type is not present.`);
|
|
74
|
-
} else {
|
|
78
|
+
if (type !== null) {
|
|
75
79
|
const includeSupertypes = false,
|
|
76
|
-
provisional =
|
|
80
|
+
provisional = this.isProvisional(includeSupertypes),
|
|
77
81
|
typeComparesToProvisional = type.compareProvisional(provisional);
|
|
78
82
|
|
|
79
83
|
if (!typeComparesToProvisional) {
|
|
@@ -81,45 +85,104 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
81
85
|
context.debug(`The '${typeString}' type is present but not provisional.`) :
|
|
82
86
|
context.debug(`The '${typeString}' type is present but provisional.`);
|
|
83
87
|
} else {
|
|
84
|
-
this.
|
|
88
|
+
this.type = type;
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
typeVerifies = true;
|
|
87
91
|
}
|
|
92
|
+
} else {
|
|
93
|
+
context.debug(`The '${typeString}' type is not present.`);
|
|
88
94
|
}
|
|
89
95
|
|
|
90
|
-
if (
|
|
91
|
-
context.debug(`...verified the '${typeString}' type.`);
|
|
96
|
+
if (typeVerifies) {
|
|
97
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration's '${typeString}' type.`);
|
|
92
98
|
}
|
|
93
99
|
|
|
94
|
-
return
|
|
100
|
+
return typeVerifies;
|
|
95
101
|
}
|
|
96
102
|
|
|
97
|
-
|
|
98
|
-
let
|
|
103
|
+
verifyConstructor() {
|
|
104
|
+
let constructorVerifies;
|
|
99
105
|
|
|
100
106
|
const context = this.getContext(),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
104
|
-
|
|
105
|
-
const constructorTypeVerifies = this.verifyConstructorType();
|
|
107
|
+
constructorString = this.constructor.getString(),
|
|
108
|
+
constructorDeclarationString = this.getString(); ///
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
const constructorValidates = this.verifyConstructor();
|
|
110
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's '${constructorString}' constructor...`);
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
context.addConstructor(this.constructor);
|
|
112
|
+
constructorVerifies = this.constructor.verify(context);
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (verifies) {
|
|
118
|
-
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
114
|
+
if (constructorVerifies) {
|
|
115
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration's '${constructorString}' constructor.`);
|
|
119
116
|
}
|
|
120
117
|
|
|
121
|
-
return
|
|
118
|
+
return constructorVerifies;
|
|
122
119
|
}
|
|
123
120
|
|
|
121
|
+
// verifyConstructorType() {
|
|
122
|
+
// let constructorTypeVerifies = false;
|
|
123
|
+
//
|
|
124
|
+
// const context = this.getContext(),
|
|
125
|
+
// constructorType = this,
|
|
126
|
+
// constructorTypeString = constructorType.getString(),
|
|
127
|
+
// constructorDeclarationString = this.getString(); ///
|
|
128
|
+
//
|
|
129
|
+
// context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's '${constructorTypeString}' type...`);
|
|
130
|
+
//
|
|
131
|
+
// const nominalTypeName = this.type.getNominalTypeName(),
|
|
132
|
+
// typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
133
|
+
//
|
|
134
|
+
// if (!typePresent) {
|
|
135
|
+
// context.debug(`The '${typeString}' type is not present.`);
|
|
136
|
+
// } else {
|
|
137
|
+
// const includeSupertypes = false,
|
|
138
|
+
// provisional = type.isProvisional(includeSupertypes),
|
|
139
|
+
// typeComparesToProvisional = type.compareProvisional(provisional);
|
|
140
|
+
//
|
|
141
|
+
// if (!typeComparesToProvisional) {
|
|
142
|
+
// provisional ?
|
|
143
|
+
// context.debug(`The '${typeString}' type is present but not provisional.`) :
|
|
144
|
+
// context.debug(`The '${typeString}' type is present but provisional.`);
|
|
145
|
+
// } else {
|
|
146
|
+
// this.constructor.setType(type);
|
|
147
|
+
//
|
|
148
|
+
// constructorTypeVerifies = true;
|
|
149
|
+
// }
|
|
150
|
+
// }
|
|
151
|
+
//
|
|
152
|
+
// if (constructorTypeVerifies) {
|
|
153
|
+
// context.debug(`...verified the '${constructorDeclarationString}' constructor declaration's '${typeString}' type.`);
|
|
154
|
+
// }
|
|
155
|
+
//
|
|
156
|
+
// return constructorTypeVerifies;
|
|
157
|
+
// }
|
|
158
|
+
|
|
124
159
|
static name = "ConstructorDeclaration";
|
|
125
160
|
});
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
// verifyConstructor() {
|
|
164
|
+
// let constructorValidates = false;
|
|
165
|
+
//
|
|
166
|
+
// const context = this.getContext(),
|
|
167
|
+
// constructorString = this.constructor.getString();
|
|
168
|
+
//
|
|
169
|
+
// context.trace(`Verifying the '${constructorString}' constructor...`);
|
|
170
|
+
//
|
|
171
|
+
// const term = this.constructor.getTerm(),
|
|
172
|
+
// termNode = term.getNode(),
|
|
173
|
+
// termValidates = validateTerm(termNode, context, () => {
|
|
174
|
+
// const validatesFormards = true;
|
|
175
|
+
//
|
|
176
|
+
// return validatesFormards;
|
|
177
|
+
// });
|
|
178
|
+
//
|
|
179
|
+
// if (termValidates) {
|
|
180
|
+
// constructorValidates = true;
|
|
181
|
+
// }
|
|
182
|
+
//
|
|
183
|
+
// if (constructorValidates) {
|
|
184
|
+
// context.debug(`...verified the '${constructorString}' constructor.`);
|
|
185
|
+
// }
|
|
186
|
+
//
|
|
187
|
+
// return constructorValidates;
|
|
188
|
+
// }
|
|
@@ -3,19 +3,29 @@
|
|
|
3
3
|
import Declaration from "../declaration";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
+
import { superTypesStringFromSuperTypes } from "../../utilities/string";
|
|
6
7
|
|
|
7
8
|
export default define(class SimpleTypeDeclaration extends Declaration {
|
|
8
|
-
constructor(context, string, node, type, prefixed) {
|
|
9
|
+
constructor(context, string, node, type, prefixed, superTypes) {
|
|
9
10
|
super(context, string, node);
|
|
10
11
|
|
|
11
12
|
this.type = type;
|
|
12
13
|
this.prefixed = prefixed;
|
|
14
|
+
this.superTypes = superTypes;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
getType() {
|
|
16
18
|
return this.type;
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
isPrefixed() {
|
|
22
|
+
return this.prefixed;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
getSuperTypes() {
|
|
26
|
+
return this.superTypes;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
getSimpleTypeDeclarationNode() {
|
|
20
30
|
const node = this.getNode(),
|
|
21
31
|
simpleTypeDeclarationNode = node; ///
|
|
@@ -23,71 +33,65 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
23
33
|
return simpleTypeDeclarationNode;
|
|
24
34
|
}
|
|
25
35
|
|
|
26
|
-
isPrefixed() {
|
|
27
|
-
return this.prefixed;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
36
|
verifyType() {
|
|
31
37
|
let typeVerifies = false;
|
|
32
38
|
|
|
33
39
|
const context = this.getContext(),
|
|
34
|
-
typeString = this.type.getString()
|
|
40
|
+
typeString = this.type.getString(),
|
|
41
|
+
simpleTypeDeclarationString = this.getString(); ///
|
|
35
42
|
|
|
36
|
-
context.trace(`Verifying the '${
|
|
43
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type...`);
|
|
37
44
|
|
|
38
45
|
const typeName = this.type.getName(),
|
|
39
46
|
includeRelease = true,
|
|
40
47
|
includeDependencies = false,
|
|
41
48
|
typePresent = context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
|
|
42
49
|
|
|
43
|
-
if (typePresent) {
|
|
44
|
-
context.trace(`The '${typeString}' type is already present.`);
|
|
45
|
-
} else {
|
|
50
|
+
if (!typePresent) {
|
|
46
51
|
const prefixedTypeName = typeName, ///
|
|
47
52
|
typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
48
53
|
|
|
49
|
-
if (typePresent) {
|
|
50
|
-
context.trace(`The '${typeString}' type is already present.`);
|
|
51
|
-
} else {
|
|
54
|
+
if (!typePresent) {
|
|
52
55
|
typeVerifies = true;
|
|
56
|
+
} else {
|
|
57
|
+
context.debug(`The '${typeString}' type is already present.`);
|
|
53
58
|
}
|
|
59
|
+
} else {
|
|
60
|
+
context.debug(`The '${typeString}' type is already present.`);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
if (typeVerifies) {
|
|
57
|
-
context.
|
|
64
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type`);
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
return typeVerifies;
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
verifySuperType(superType) {
|
|
70
|
+
verifySuperType(superType, index) {
|
|
64
71
|
let superTypeVerifies = false;
|
|
65
72
|
|
|
66
73
|
const context = this.getContext(),
|
|
67
|
-
superTypeString = superType.getString()
|
|
74
|
+
superTypeString = superType.getString(),
|
|
75
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
68
76
|
|
|
69
|
-
context.trace(`Verifying the '${superTypeString}' super-
|
|
77
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-types...`);
|
|
70
78
|
|
|
71
79
|
const nominalTypeName = superType.getNominalTypeName(),
|
|
72
80
|
typeName = nominalTypeName, ///
|
|
73
81
|
typeComparesToTypeName = this.type.compareTypeName(typeName);
|
|
74
82
|
|
|
75
|
-
if (typeComparesToTypeName) {
|
|
76
|
-
context.trace(`The super-type's name compares to the ${typeName}' simple type's name.`);
|
|
77
|
-
} else {
|
|
78
|
-
const oldSuperType = superType;
|
|
79
|
-
|
|
83
|
+
if (!typeComparesToTypeName) {
|
|
80
84
|
superType = context.findTypeByNominalTypeName(nominalTypeName);
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (superTypePresent) {
|
|
85
|
-
const newSuperType = superType; ///
|
|
86
|
-
|
|
87
|
-
this.type.replaceSuperType(oldSuperType, newSuperType);
|
|
86
|
+
if (superType !== null) {
|
|
87
|
+
this.type.replaceSuperType(superType, index);
|
|
88
88
|
|
|
89
89
|
superTypeVerifies = true;
|
|
90
|
+
} else {
|
|
91
|
+
context.debug(`The '${superTypeString}' super-type is not present.`);
|
|
90
92
|
}
|
|
93
|
+
} else {
|
|
94
|
+
context.debug(`The '${superTypeString}' super-type's name compares to the ${typeName}' type's name.`);
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
if (superTypeVerifies) {
|
|
@@ -100,31 +104,28 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
100
104
|
verifySuperTypes() {
|
|
101
105
|
let superTypesVerify;
|
|
102
106
|
|
|
103
|
-
const
|
|
104
|
-
typeString = this.type.getString();
|
|
107
|
+
const superTypesLength = this.superTypes.length;
|
|
105
108
|
|
|
106
|
-
|
|
109
|
+
if (superTypesLength > 0) {
|
|
110
|
+
const context = this.getContext(),
|
|
111
|
+
superTypesString = superTypesStringFromSuperTypes(this.superTypes),
|
|
112
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (typeBasic) {
|
|
111
|
-
superTypesVerify = true;
|
|
114
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types...`);
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const superTypes = this.type.getSuperTypes();
|
|
116
|
-
|
|
117
|
-
superTypesVerify = superTypes.every((superType) => {
|
|
118
|
-
const superTypeVerifies = this.verifySuperType(superType);
|
|
116
|
+
superTypesVerify = this.superTypes.every((superType, index) => {
|
|
117
|
+
const superTypeVerifies = this.verifySuperType(superType, index);
|
|
119
118
|
|
|
120
119
|
if (superTypeVerifies) {
|
|
121
120
|
return true;
|
|
122
121
|
}
|
|
123
122
|
});
|
|
124
|
-
}
|
|
125
123
|
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
if (superTypesVerify) {
|
|
125
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types.`);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
superTypesVerify = true;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
return superTypesVerify;
|
|
@@ -138,11 +139,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
138
139
|
|
|
139
140
|
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration...`);
|
|
140
141
|
|
|
141
|
-
if (this.prefixed) {
|
|
142
|
-
const typeString = this.type.getString();
|
|
143
|
-
|
|
144
|
-
context.trace(`The '${typeString}' type is prefixed.`);
|
|
145
|
-
} else {
|
|
142
|
+
if (!this.prefixed) {
|
|
146
143
|
const typeVerifies = this.verifyType();
|
|
147
144
|
|
|
148
145
|
if (typeVerifies) {
|
|
@@ -153,7 +150,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
153
150
|
|
|
154
151
|
if (typePrefix !== null) {
|
|
155
152
|
const typePrefixName = typePrefix.getName(),
|
|
156
|
-
|
|
153
|
+
prefixName = typePrefixName; ///
|
|
157
154
|
|
|
158
155
|
this.type.setPrefixName(prefixName);
|
|
159
156
|
}
|
|
@@ -163,6 +160,10 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
163
160
|
verifies = true;
|
|
164
161
|
}
|
|
165
162
|
}
|
|
163
|
+
} else {
|
|
164
|
+
const typeString = this.type.getString();
|
|
165
|
+
|
|
166
|
+
context.trace(`The '${typeString}' type is prefixed.`);
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
if (verifies) {
|
|
@@ -40,13 +40,13 @@ export default define(class TypePrefixDeclaration extends Declaration {
|
|
|
40
40
|
typePrefixPresent = context.isTypePrefixPresentByTypePrefixName(typePrefixName);
|
|
41
41
|
|
|
42
42
|
if (typePrefixPresent) {
|
|
43
|
-
context.
|
|
43
|
+
context.debug(`The '${typePrefixString}' type prefix is already present.`);
|
|
44
44
|
} else {
|
|
45
45
|
const nominalTypeName = typePrefixName, ///
|
|
46
46
|
typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
47
47
|
|
|
48
48
|
if (typePresent) {
|
|
49
|
-
context.
|
|
49
|
+
context.debug(`The '${typePrefixString}' type is already present.`);
|
|
50
50
|
} else {
|
|
51
51
|
typePrefixVerifies = true;
|
|
52
52
|
}
|
|
@@ -93,7 +93,7 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if ( variableVerifies) {
|
|
96
|
-
context.
|
|
96
|
+
context.debug(`...verified the '${variableDeclarationString}' variable declaration's '${variableString}' variable.`);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
return variableVerifies;
|