occam-verify-cli 1.0.890 → 1.0.895
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/nominal.js +9 -3
- package/lib/context/mnemic.js +68 -8
- package/lib/context/synoptic.js +33 -1
- package/lib/context.js +11 -1
- package/lib/element/assertion/property.js +7 -7
- package/lib/element/declaration/complexType.js +93 -134
- package/lib/element/declaration/property.js +81 -0
- package/lib/element/declaration/simpleType.js +8 -9
- package/lib/element/declaration/typePrefix.js +2 -27
- package/lib/element/metavariable.js +4 -4
- package/lib/element/property.js +81 -12
- package/lib/element/propertyRelation.js +37 -15
- package/lib/element/statement.js +2 -2
- package/lib/element/substitution/statement.js +2 -2
- package/lib/element/typePrefix.js +26 -1
- package/lib/preamble.js +2 -1
- package/lib/utilities/element.js +119 -18
- package/lib/utilities/json.js +10 -24
- package/lib/utilities/string.js +20 -2
- package/lib/utilities/synoptic.js +23 -1
- package/package.json +1 -1
- package/src/context/file/nominal.js +10 -2
- package/src/context/mnemic.js +123 -14
- package/src/context/synoptic.js +49 -1
- package/src/context.js +16 -0
- package/src/element/assertion/property.js +6 -6
- package/src/element/declaration/complexType.js +110 -168
- package/src/element/declaration/property.js +99 -0
- package/src/element/declaration/simpleType.js +8 -15
- package/src/element/declaration/typePrefix.js +1 -38
- package/src/element/metavariable.js +3 -3
- package/src/element/property.js +122 -13
- package/src/element/propertyRelation.js +54 -14
- package/src/element/statement.js +1 -1
- package/src/element/substitution/statement.js +1 -1
- package/src/element/typePrefix.js +36 -0
- package/src/preamble.js +1 -0
- package/src/utilities/element.js +139 -36
- package/src/utilities/json.js +16 -28
- package/src/utilities/string.js +37 -12
- package/src/utilities/synoptic.js +21 -1
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
import Declaration from "../declaration";
|
|
4
4
|
|
|
5
|
+
import { asynchronousUtilities } from "occam-languages";
|
|
6
|
+
|
|
5
7
|
import { define } from "../../elements";
|
|
8
|
+
import { baseTypeFromNothing } from "../../utilities/type";
|
|
9
|
+
|
|
10
|
+
const { asyncEvery } = asynchronousUtilities;
|
|
6
11
|
|
|
7
12
|
export default define(class ComplexTypeDeclaration extends Declaration {
|
|
8
|
-
constructor(context, string, node, lineIndex, type, superTypes) {
|
|
13
|
+
constructor(context, string, node, lineIndex, type, superTypes, provisional, propertyDeclarations) {
|
|
9
14
|
super(context, string, node, lineIndex);
|
|
10
15
|
|
|
11
16
|
this.type = type;
|
|
12
17
|
this.superTypes = superTypes;
|
|
18
|
+
this.provisional = provisional;
|
|
19
|
+
this.propertyDeclarations = propertyDeclarations;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
getType() {
|
|
@@ -20,44 +27,59 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
20
27
|
return this.superTypes;
|
|
21
28
|
}
|
|
22
29
|
|
|
30
|
+
isProvisional() {
|
|
31
|
+
return this.provisional;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
getPropertyDeclarations() {
|
|
35
|
+
return this.propertyDeclarations;
|
|
36
|
+
}
|
|
37
|
+
|
|
23
38
|
getComplexTypeDeclarationNode() {
|
|
24
39
|
const node = this.getNode(),
|
|
25
|
-
complexTypeDeclarationNode = node;
|
|
40
|
+
complexTypeDeclarationNode = node; ///
|
|
26
41
|
|
|
27
42
|
return complexTypeDeclarationNode;
|
|
28
43
|
}
|
|
29
44
|
|
|
45
|
+
getProperties() {
|
|
46
|
+
const properties = this.propertyDeclarations.reduce((properties, propertyDeclaration) => {
|
|
47
|
+
const property = propertyDeclaration.getProperty();
|
|
48
|
+
|
|
49
|
+
if (property !== null) {
|
|
50
|
+
properties.push(property);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return properties;
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
return properties;
|
|
57
|
+
}
|
|
58
|
+
|
|
30
59
|
async verify(context) {
|
|
31
60
|
let verifies = false;
|
|
32
61
|
|
|
33
62
|
await this.break(context);
|
|
34
63
|
|
|
35
|
-
const complexTypeDeclarationString = this.getString();
|
|
64
|
+
const complexTypeDeclarationString = this.getString(); ///
|
|
36
65
|
|
|
37
66
|
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`);
|
|
38
67
|
|
|
39
|
-
|
|
40
|
-
const typeString = this.type.getString();
|
|
41
|
-
|
|
42
|
-
context.trace(`The '${typeString}' type is prefixed.`);
|
|
43
|
-
} else {
|
|
44
|
-
const typeVerifies = this.verifyType(context);
|
|
68
|
+
const typeVerifies = this.verifyType(context);
|
|
45
69
|
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
if (typeVerifies) {
|
|
71
|
+
const superTypesVerify = this.verifySuperTypes(context);
|
|
48
72
|
|
|
49
|
-
|
|
50
|
-
|
|
73
|
+
if (superTypesVerify) {
|
|
74
|
+
const typePrefixVerifies = this.verifyTypePrefix(context);
|
|
51
75
|
|
|
52
|
-
|
|
53
|
-
|
|
76
|
+
if (typePrefixVerifies) {
|
|
77
|
+
const propertyDeclarationsVerify = await this.verifyPropertyDeclaratisons(context);
|
|
54
78
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
prefixName = typePrefixName; ///
|
|
79
|
+
if (propertyDeclarationsVerify) {
|
|
80
|
+
const properties = this.getProperties();
|
|
58
81
|
|
|
59
|
-
|
|
60
|
-
}
|
|
82
|
+
this.type.setProperties(properties);
|
|
61
83
|
|
|
62
84
|
context.addType(this.type);
|
|
63
85
|
|
|
@@ -77,65 +99,64 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
77
99
|
verifyType(context) {
|
|
78
100
|
let typeVerifies = false;
|
|
79
101
|
|
|
80
|
-
const typeString = this.type.getString()
|
|
102
|
+
const typeString = this.type.getString(),
|
|
103
|
+
complexTypeDeclarationString = this.getString(); ///
|
|
81
104
|
|
|
82
|
-
context.trace(`Verifying the '${
|
|
105
|
+
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration's '${typeString}' type...`);
|
|
83
106
|
|
|
84
107
|
const typeName = this.type.getName(),
|
|
85
|
-
|
|
86
|
-
typePresent = context.isTypePresentByTypeName(typeName, includeRelease);
|
|
108
|
+
typePresent = context.isTypePresentByTypeName(typeName);
|
|
87
109
|
|
|
88
|
-
if (typePresent) {
|
|
89
|
-
context.debug(`The '${typeString}' type is already present.`);
|
|
90
|
-
} else {
|
|
110
|
+
if (!typePresent) {
|
|
91
111
|
const prefixedTypeName = typeName, ///
|
|
92
112
|
typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
93
113
|
|
|
94
|
-
if (typePresent) {
|
|
95
|
-
|
|
96
|
-
|
|
114
|
+
if (!typePresent) {
|
|
115
|
+
this.type.setProvisional(this.provisional);
|
|
116
|
+
|
|
97
117
|
typeVerifies = true;
|
|
118
|
+
} else {
|
|
119
|
+
context.debug(`The '${typeString}' type is already present.`);
|
|
98
120
|
}
|
|
121
|
+
} else {
|
|
122
|
+
context.debug(`The '${typeString}' type is already present.`);
|
|
99
123
|
}
|
|
100
124
|
|
|
101
125
|
if (typeVerifies) {
|
|
102
|
-
context.debug(`...verified the '${
|
|
126
|
+
context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration's '${typeString}' type`);
|
|
103
127
|
}
|
|
104
128
|
|
|
105
129
|
return typeVerifies;
|
|
106
130
|
}
|
|
107
131
|
|
|
108
|
-
verifySuperType(context, superType) {
|
|
132
|
+
verifySuperType(context, superType, superTypes) {
|
|
109
133
|
let superTypeVerifies = false;
|
|
110
134
|
|
|
111
|
-
const superTypeString = superType.getString()
|
|
135
|
+
const superTypeString = superType.getString(),
|
|
136
|
+
complexTypeDeclarationString = this.getString(); ///
|
|
112
137
|
|
|
113
|
-
context.trace(`Verifying the '${superTypeString}' super-type...`);
|
|
138
|
+
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration's '${superTypeString}' super-type...`);
|
|
114
139
|
|
|
115
140
|
const nominalTypeName = superType.getNominalTypeName(),
|
|
116
141
|
typeName = nominalTypeName, ///
|
|
117
142
|
typeComparesToTypeName = this.type.compareTypeName(typeName);
|
|
118
143
|
|
|
119
|
-
if (typeComparesToTypeName) {
|
|
120
|
-
context.trace(`The super-type's name compares to the ${typeName}' complex type's name.`);
|
|
121
|
-
} else {
|
|
122
|
-
const oldSuperType = superType;
|
|
123
|
-
|
|
144
|
+
if (!typeComparesToTypeName) {
|
|
124
145
|
superType = context.findTypeByNominalTypeName(nominalTypeName);
|
|
125
146
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (superTypePresent) {
|
|
129
|
-
const newSuperType = superType; ///
|
|
130
|
-
|
|
131
|
-
this.type.replaceSuperType(oldSuperType, newSuperType);
|
|
147
|
+
if (superType !== null) {
|
|
148
|
+
superTypes.push(superType);
|
|
132
149
|
|
|
133
150
|
superTypeVerifies = true;
|
|
151
|
+
} else {
|
|
152
|
+
context.debug(`The '${superTypeString}' super-type is not present.`);
|
|
134
153
|
}
|
|
154
|
+
} else {
|
|
155
|
+
context.debug(`The '${superTypeString}' super-type's name compares to the ${typeName}' type's name.`);
|
|
135
156
|
}
|
|
136
157
|
|
|
137
158
|
if (superTypeVerifies) {
|
|
138
|
-
context.debug(`...verified the '${superTypeString}' super-type.`);
|
|
159
|
+
context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration's '${superTypeString}' super-type.`);
|
|
139
160
|
}
|
|
140
161
|
|
|
141
162
|
return superTypeVerifies;
|
|
@@ -144,162 +165,83 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
144
165
|
verifySuperTypes(context) {
|
|
145
166
|
let superTypesVerify;
|
|
146
167
|
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
context.trace(`Verifying the '${typeString}' complex type's super-types...`);
|
|
168
|
+
const superTypes = [],
|
|
169
|
+
complexTypeDeclarationString = this.getString(); ///
|
|
150
170
|
|
|
151
|
-
|
|
171
|
+
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration's super-types...`);
|
|
152
172
|
|
|
153
|
-
|
|
154
|
-
|
|
173
|
+
superTypesVerify = this.superTypes.every((superType) => {
|
|
174
|
+
const superTypeVerifies = this.verifySuperType(context, superType, superTypes);
|
|
155
175
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
superTypesVerify = superTypes.every((superType) => {
|
|
161
|
-
const superTypeVerifies = this.verifySuperType(context, superType);
|
|
162
|
-
|
|
163
|
-
if (superTypeVerifies) {
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
176
|
+
if (superTypeVerifies) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
168
180
|
|
|
169
181
|
if (superTypesVerify) {
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return superTypesVerify;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
verifyProperty(context, property, properties) {
|
|
177
|
-
let propertyVerifies = false;
|
|
178
|
-
|
|
179
|
-
const propertyString = property.getString();
|
|
182
|
+
const superTypesLength = superTypes.length;
|
|
180
183
|
|
|
181
|
-
|
|
184
|
+
if (superTypesLength === 0) {
|
|
185
|
+
const baseType = baseTypeFromNothing(),
|
|
186
|
+
superTyupe = baseType; ///
|
|
182
187
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (propertyNameVerifies) {
|
|
186
|
-
const propertyNominalTypeNameVerifies = this.verifyPropertyNominalTypeName(context, property, properties);
|
|
187
|
-
|
|
188
|
-
if (propertyNominalTypeNameVerifies) {
|
|
189
|
-
propertyVerifies = true;
|
|
188
|
+
superTypes.push(superTyupe);
|
|
190
189
|
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (propertyVerifies) {
|
|
194
|
-
context.debug(`...verified the '${propertyString}' property.`);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return propertyVerifies;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
verifyProperties(context) {
|
|
201
|
-
let propertiesVerify;
|
|
202
|
-
|
|
203
|
-
const typeString = this.type.getString();
|
|
204
190
|
|
|
205
|
-
|
|
191
|
+
this.type.setSuperTypes(superTypes);
|
|
206
192
|
|
|
207
|
-
|
|
208
|
-
properties = this.type.getProperties(includeSuperTypes);
|
|
209
|
-
|
|
210
|
-
propertiesVerify = properties.every((property) => {
|
|
211
|
-
const propertyVerifies = this.verifyProperty(context, property, properties);
|
|
212
|
-
|
|
213
|
-
if (propertyVerifies) {
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
if (propertiesVerify) {
|
|
219
|
-
context.debug(`...verified the '${typeString}' complex type's properties.`);
|
|
193
|
+
context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration's super-types.`);
|
|
220
194
|
}
|
|
221
195
|
|
|
222
|
-
return
|
|
196
|
+
return superTypesVerify;
|
|
223
197
|
}
|
|
224
198
|
|
|
225
|
-
|
|
226
|
-
let
|
|
227
|
-
|
|
228
|
-
const propertyString = property.getString();
|
|
229
|
-
|
|
230
|
-
context.trace(`Verifying the '${propertyString}' property's name...`);
|
|
199
|
+
verifyTypePrefix(context) {
|
|
200
|
+
let typePrefixVerifies = false;
|
|
231
201
|
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
const propertyComparesToPropertyName = property.comparePropertyName(propertyName);
|
|
202
|
+
const typeString = this.type.getString(),
|
|
203
|
+
complexTypeDeclarationString = this.getString(); ///
|
|
235
204
|
|
|
236
|
-
|
|
237
|
-
count++;
|
|
238
|
-
}
|
|
205
|
+
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration's '${typeString}' type's prefix...`);
|
|
239
206
|
|
|
240
|
-
|
|
241
|
-
}, 0);
|
|
207
|
+
const typePrefixed = this.type.isPrefixed();
|
|
242
208
|
|
|
243
|
-
if (
|
|
244
|
-
|
|
209
|
+
if (!typePrefixed) {
|
|
210
|
+
typePrefixVerifies = true;
|
|
245
211
|
} else {
|
|
246
|
-
|
|
247
|
-
superType = superTypes.find((superType) => {
|
|
248
|
-
const superTypeProperties = superType.getProperties(),
|
|
249
|
-
superTypePropertyComparesToPropertyName = superTypeProperties.some((superTypeProperty) => {
|
|
250
|
-
const superTypePropertyComparesToPropertyName = superTypeProperty.comparePropertyName(propertyName);
|
|
251
|
-
|
|
252
|
-
if (superTypePropertyComparesToPropertyName) {
|
|
253
|
-
return true;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
if (superTypePropertyComparesToPropertyName) {
|
|
258
|
-
return true;
|
|
259
|
-
}
|
|
260
|
-
}) || null;
|
|
261
|
-
|
|
262
|
-
if (superType !== null) {
|
|
263
|
-
const superTypeString = superType.getString();
|
|
264
|
-
|
|
265
|
-
context.debug(`The '${superTypeString}' super-type has the same property.`);
|
|
266
|
-
} else {
|
|
267
|
-
propertyNameVerifies = true;
|
|
268
|
-
}
|
|
212
|
+
context.debug(`The '${complexTypeDeclarationString}' complex type declaration's '${typeString}' type is prefixed.`);
|
|
269
213
|
}
|
|
270
214
|
|
|
271
|
-
if (
|
|
272
|
-
context.debug(`...verified the '${
|
|
215
|
+
if (typePrefixVerifies) {
|
|
216
|
+
context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration's '${typeString}' type's prefix.`);
|
|
273
217
|
}
|
|
274
218
|
|
|
275
|
-
return
|
|
219
|
+
return typePrefixVerifies;
|
|
276
220
|
}
|
|
277
221
|
|
|
278
|
-
|
|
279
|
-
let
|
|
222
|
+
async verifyPropertyDeclaratisons(context) {
|
|
223
|
+
let propertyDeclarationsVerify;
|
|
280
224
|
|
|
281
|
-
const
|
|
282
|
-
|
|
225
|
+
const typeString = this.type.getString(),
|
|
226
|
+
complexTypeDeclarationString = this.getString(); ///
|
|
283
227
|
|
|
284
|
-
context.trace(`Verifying the '${
|
|
228
|
+
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration's '${typeString}' type's property declarations...`);
|
|
285
229
|
|
|
286
|
-
const
|
|
230
|
+
const properties = this.getProperties();
|
|
287
231
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
} else {
|
|
291
|
-
const typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
232
|
+
propertyDeclarationsVerify = await asyncEvery(this.propertyDeclarations, async (propertyDeclaration) => {
|
|
233
|
+
const propertyVerifes = await propertyDeclaration.verify(properties, context);
|
|
292
234
|
|
|
293
|
-
if (
|
|
294
|
-
|
|
235
|
+
if (propertyVerifes) {
|
|
236
|
+
return true;
|
|
295
237
|
}
|
|
296
|
-
}
|
|
238
|
+
});
|
|
297
239
|
|
|
298
|
-
if (
|
|
299
|
-
context.debug(`...
|
|
240
|
+
if (propertyDeclarationsVerify) {
|
|
241
|
+
context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration's '${typeString}' type's property declarations.`);
|
|
300
242
|
}
|
|
301
243
|
|
|
302
|
-
return
|
|
244
|
+
return propertyDeclarationsVerify;
|
|
303
245
|
}
|
|
304
246
|
|
|
305
247
|
static name = "ComplexTypeDeclaration";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Declaration from "../declaration";
|
|
4
|
+
|
|
5
|
+
import { define } from "../../elements";
|
|
6
|
+
|
|
7
|
+
export default define(class PropertyDeclaration extends Declaration {
|
|
8
|
+
constructor(context, string, node, lineIndex, property, type) {
|
|
9
|
+
super(context, string, node, lineIndex);
|
|
10
|
+
|
|
11
|
+
this.property = property;
|
|
12
|
+
this.type = type;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getProperty() {
|
|
16
|
+
return this.property;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getType() {
|
|
20
|
+
return this.type;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async verify(properties, context) {
|
|
24
|
+
let verifies = false;
|
|
25
|
+
|
|
26
|
+
await this.break(context);
|
|
27
|
+
|
|
28
|
+
const propertyDeclarationString = this.getString(); ///
|
|
29
|
+
|
|
30
|
+
context.trace(`Verifying the '${propertyDeclarationString}' property declaration...`);
|
|
31
|
+
|
|
32
|
+
if (this.property !== null) {
|
|
33
|
+
const typeVerifies = this.verifyType(context);
|
|
34
|
+
|
|
35
|
+
if (typeVerifies) {
|
|
36
|
+
const propertyVerifies = this.verifyProperty(properties, context);
|
|
37
|
+
|
|
38
|
+
if (propertyVerifies) {
|
|
39
|
+
this.property.setType(this.type);
|
|
40
|
+
|
|
41
|
+
verifies = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
context.debug(`Unable to verify the '${propertyDeclarationString}' property declaration because it is nonsense.`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (verifies) {
|
|
49
|
+
context.debug(`...verified the '${propertyDeclarationString}' property declaration.`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return verifies;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
verifyType(context) {
|
|
56
|
+
let typeVerifies = false;
|
|
57
|
+
|
|
58
|
+
const typeString = this.type.getString(),
|
|
59
|
+
propertyDeclarationString = this.getString(); ///
|
|
60
|
+
|
|
61
|
+
context.trace(`Verifying the '${propertyDeclarationString}' property declaration's '${typeString}' type...`);
|
|
62
|
+
|
|
63
|
+
const typeName = this.type.getName(),
|
|
64
|
+
type = context.findTypeByTypeName(typeName);
|
|
65
|
+
|
|
66
|
+
if (type !== null) {
|
|
67
|
+
this.type = type;
|
|
68
|
+
|
|
69
|
+
typeVerifies = true;
|
|
70
|
+
} else {
|
|
71
|
+
context.debug(`The '${typeString}' type is not present.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (typeVerifies) {
|
|
75
|
+
context.debug(`...verified the '${propertyDeclarationString}' property declaration's '${typeString}' type`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return typeVerifies;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
verifyProperty(properties, context) {
|
|
82
|
+
let propertyVerifies;
|
|
83
|
+
|
|
84
|
+
const propertyString = this.property.getString(),
|
|
85
|
+
propertyDeclarationString = this.getString(); ///
|
|
86
|
+
|
|
87
|
+
context.trace(`Verifying the '${propertyDeclarationString}' property declaration's '${propertyString}' property...`);
|
|
88
|
+
|
|
89
|
+
propertyVerifies = this.property.verify(properties, context);
|
|
90
|
+
|
|
91
|
+
if (propertyVerifies) {
|
|
92
|
+
context.debug(`...verified the '${propertyDeclarationString}' property declaration's '${propertyString}' type`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return propertyVerifies;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static name = "PropertyDeclaration";
|
|
99
|
+
});
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
import Declaration from "../declaration";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
7
|
-
import {baseTypeFromNothing} from "../../utilities/type";
|
|
6
|
+
import { baseTypeFromNothing } from "../../utilities/type";
|
|
8
7
|
|
|
9
8
|
export default define(class SimpleTypeDeclaration extends Declaration {
|
|
10
9
|
constructor(context, string, node, lineIndex, type, superTypes, provisional) {
|
|
@@ -79,8 +78,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
79
78
|
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type...`);
|
|
80
79
|
|
|
81
80
|
const typeName = this.type.getName(),
|
|
82
|
-
|
|
83
|
-
typePresent = context.isTypePresentByTypeName(typeName, includeRelease);
|
|
81
|
+
typePresent = context.isTypePresentByTypeName(typeName);
|
|
84
82
|
|
|
85
83
|
if (!typePresent) {
|
|
86
84
|
const prefixedTypeName = typeName, ///
|
|
@@ -108,7 +106,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
108
106
|
let superTypeVerifies = false;
|
|
109
107
|
|
|
110
108
|
const superTypeString = superType.getString(),
|
|
111
|
-
simpleTypeDeclarationString = this.getString();
|
|
109
|
+
simpleTypeDeclarationString = this.getString(); ///
|
|
112
110
|
|
|
113
111
|
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-type...`);
|
|
114
112
|
|
|
@@ -141,12 +139,9 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
141
139
|
let superTypesVerify;
|
|
142
140
|
|
|
143
141
|
const superTypes = [],
|
|
144
|
-
|
|
145
|
-
simpleTypeDeclarationString = this.getString(); ///;
|
|
142
|
+
simpleTypeDeclarationString = this.getString(); ///
|
|
146
143
|
|
|
147
|
-
(
|
|
148
|
-
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types...`) :
|
|
149
|
-
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's super-types...`);
|
|
144
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's super-types...`);
|
|
150
145
|
|
|
151
146
|
superTypesVerify = this.superTypes.every((superType) => {
|
|
152
147
|
const superTypeVerifies = this.verifySuperType(context, superType, superTypes);
|
|
@@ -168,9 +163,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
168
163
|
|
|
169
164
|
this.type.setSuperTypes(superTypes);
|
|
170
165
|
|
|
171
|
-
(
|
|
172
|
-
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types.`) :
|
|
173
|
-
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's super-types.`);
|
|
166
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's super-types.`);
|
|
174
167
|
}
|
|
175
168
|
|
|
176
169
|
return superTypesVerify;
|
|
@@ -180,7 +173,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
180
173
|
let typePrefixVerifies = false;
|
|
181
174
|
|
|
182
175
|
const typeString = this.type.getString(),
|
|
183
|
-
simpleTypeDeclarationString = this.getString();
|
|
176
|
+
simpleTypeDeclarationString = this.getString(); ///
|
|
184
177
|
|
|
185
178
|
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's prefix...`);
|
|
186
179
|
|
|
@@ -203,7 +196,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
203
196
|
let propertiesVerify = true; ///
|
|
204
197
|
|
|
205
198
|
const typeString = this.type.getString(),
|
|
206
|
-
simpleTypeDeclarationString = this.getString();
|
|
199
|
+
simpleTypeDeclarationString = this.getString(); ///
|
|
207
200
|
|
|
208
201
|
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's properties...`);
|
|
209
202
|
|
|
@@ -35,7 +35,7 @@ export default define(class TypePrefixDeclaration extends Declaration {
|
|
|
35
35
|
typesLength = types.length;
|
|
36
36
|
|
|
37
37
|
if (typesLength === 0) {
|
|
38
|
-
const typePrefixVerifies = this.
|
|
38
|
+
const typePrefixVerifies = this.typePrefix.verify(context);
|
|
39
39
|
|
|
40
40
|
if (typePrefixVerifies) {
|
|
41
41
|
context.addTypePrefix(this.typePrefix);
|
|
@@ -53,42 +53,5 @@ export default define(class TypePrefixDeclaration extends Declaration {
|
|
|
53
53
|
return verifies;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
verifyTypePrefix(context) {
|
|
57
|
-
let typePrefixVerifies = false;
|
|
58
|
-
|
|
59
|
-
const typePrefixString = this.typePrefix.getString();
|
|
60
|
-
|
|
61
|
-
context.trace(`Verifying the '${typePrefixString}' type prefix...`);
|
|
62
|
-
|
|
63
|
-
const typePrefix = context.getTypePrefix();
|
|
64
|
-
|
|
65
|
-
if (typePrefix !== null) {
|
|
66
|
-
context.trace(`The package already has a '${typePrefixString}' type prefix.`);
|
|
67
|
-
} else {
|
|
68
|
-
|
|
69
|
-
const typePrefixName = this.typePrefix.getName(),
|
|
70
|
-
typePrefixPresent = context.isTypePrefixPresentByTypePrefixName(typePrefixName);
|
|
71
|
-
|
|
72
|
-
if (typePrefixPresent) {
|
|
73
|
-
context.debug(`The '${typePrefixString}' type prefix is already present.`);
|
|
74
|
-
} else {
|
|
75
|
-
const nominalTypeName = typePrefixName, ///
|
|
76
|
-
typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
77
|
-
|
|
78
|
-
if (typePresent) {
|
|
79
|
-
context.debug(`The '${typePrefixString}' type is already present.`);
|
|
80
|
-
} else {
|
|
81
|
-
typePrefixVerifies = true;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (typePrefixVerifies) {
|
|
87
|
-
context.debug(`...verified the '${typePrefixString}' type prefix.`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return typePrefixVerifies;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
56
|
static name = "TypePrefixDeclaration";
|
|
94
57
|
});
|
|
@@ -108,7 +108,7 @@ export default define(class Metavariable extends Element {
|
|
|
108
108
|
verify(context) {
|
|
109
109
|
let verifies = false;
|
|
110
110
|
|
|
111
|
-
const metavariableString = this.getString();
|
|
111
|
+
const metavariableString = this.getString(); ///
|
|
112
112
|
|
|
113
113
|
context.trace(`Verifying the '${metavariableString}' metavariable...`);
|
|
114
114
|
|
|
@@ -148,7 +148,7 @@ export default define(class Metavariable extends Element {
|
|
|
148
148
|
let typeVerifies = true; ///
|
|
149
149
|
|
|
150
150
|
if (this.type !== null) {
|
|
151
|
-
const metavariableString = this.getString();
|
|
151
|
+
const metavariableString = this.getString(); ///
|
|
152
152
|
|
|
153
153
|
context.trace(`Verifying the '${metavariableString}' metavariable's type...`);
|
|
154
154
|
|
|
@@ -258,7 +258,7 @@ export default define(class Metavariable extends Element {
|
|
|
258
258
|
if (this.term === null) {
|
|
259
259
|
termValidates = true;
|
|
260
260
|
} else {
|
|
261
|
-
const metavariableString = this.getString();
|
|
261
|
+
const metavariableString = this.getString(); ///
|
|
262
262
|
|
|
263
263
|
context.trace(`Validating the '${metavariableString}' metavariable's term...`);
|
|
264
264
|
|