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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
|
|
5
|
-
import { objectType } from "../type";
|
|
6
5
|
import { domAssigned } from "../../dom";
|
|
7
6
|
import { stringFromTypeNameTypePrefixNameAndSuperTypes } from "../../utilities/type";
|
|
8
7
|
|
|
@@ -58,9 +57,22 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
58
57
|
const propertiesVerify = this.verifyProperties();
|
|
59
58
|
|
|
60
59
|
if (propertiesVerify) {
|
|
61
|
-
this.
|
|
60
|
+
const propertyTypesVerify = this.verifyPropertyTypes();
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
if (propertyTypesVerify) {
|
|
63
|
+
const typePrefix = this.context.getTypePrefix();
|
|
64
|
+
|
|
65
|
+
if (typePrefix !== null) {
|
|
66
|
+
const typePrefixName = typePrefix.getName(),
|
|
67
|
+
prefixName = typePrefixName; ///
|
|
68
|
+
|
|
69
|
+
this.type.setPrefixName(prefixName);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.context.addType(this.type);
|
|
73
|
+
|
|
74
|
+
verifies = true;
|
|
75
|
+
}
|
|
64
76
|
}
|
|
65
77
|
}
|
|
66
78
|
}
|
|
@@ -81,16 +93,25 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
81
93
|
this.context.trace(`Verifying the '${typeString}' complex type...`, this.node);
|
|
82
94
|
|
|
83
95
|
const typeName = this.type.getName(),
|
|
84
|
-
|
|
96
|
+
includeRelease = true,
|
|
97
|
+
includeDependencies = false,
|
|
98
|
+
typePresent = this.context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
|
|
85
99
|
|
|
86
100
|
if (typePresent) {
|
|
87
|
-
this.context.
|
|
101
|
+
this.context.trace(`The '${typeString}' type is already present.`, this.node);
|
|
88
102
|
} else {
|
|
89
|
-
|
|
103
|
+
const prefixedTypeName = typeName, ///
|
|
104
|
+
typePresent = this.context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
105
|
+
|
|
106
|
+
if (typePresent) {
|
|
107
|
+
this.context.trace(`The '${typeString}' type is already present.`, this.node);
|
|
108
|
+
} else {
|
|
109
|
+
typeVerifies = true;
|
|
110
|
+
}
|
|
90
111
|
}
|
|
91
112
|
|
|
92
113
|
if (typeVerifies) {
|
|
93
|
-
this.context.
|
|
114
|
+
this.context.trace(`...verified the '${typeString}' complex type.`, this.node);
|
|
94
115
|
}
|
|
95
116
|
|
|
96
117
|
return typeVerifies;
|
|
@@ -103,11 +124,26 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
103
124
|
|
|
104
125
|
this.context.trace(`Verifying the '${superTypeString}' super-type...`, this.node);
|
|
105
126
|
|
|
106
|
-
const
|
|
107
|
-
|
|
127
|
+
const nominalTypeName = superType.getNominalTypeName(),
|
|
128
|
+
typeName = nominalTypeName, ///
|
|
129
|
+
typeNameMatches = this.type.matchTypeName(typeName);
|
|
130
|
+
|
|
131
|
+
if (typeNameMatches) {
|
|
132
|
+
this.context.trace(`The super-type's name matches the ${typeName}' complex type's name.`, this.node);
|
|
133
|
+
} else {
|
|
134
|
+
const oldSuperType = superType;
|
|
135
|
+
|
|
136
|
+
superType = this.context.findTypeByNominalTypeName(nominalTypeName);
|
|
137
|
+
|
|
138
|
+
const superTypePresent = (superType !== null);
|
|
139
|
+
|
|
140
|
+
if (superTypePresent) {
|
|
141
|
+
const newSuperType = superType; ///
|
|
142
|
+
|
|
143
|
+
this.type.replaceSuperType(oldSuperType, newSuperType);
|
|
108
144
|
|
|
109
|
-
|
|
110
|
-
|
|
145
|
+
superTypeVerifies = true;
|
|
146
|
+
}
|
|
111
147
|
}
|
|
112
148
|
|
|
113
149
|
if (superTypeVerifies) {
|
|
@@ -118,71 +154,38 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
118
154
|
}
|
|
119
155
|
|
|
120
156
|
verifySuperTypes() {
|
|
121
|
-
let superTypesVerify
|
|
122
|
-
|
|
123
|
-
this.context.trace(`Verifying the super-types...`, this.node);
|
|
124
|
-
|
|
125
|
-
let superTypes;
|
|
126
|
-
|
|
127
|
-
superTypes = this.type.getSuperTypes();
|
|
128
|
-
|
|
129
|
-
const superTypesLength = superTypes.length;
|
|
157
|
+
let superTypesVerify;
|
|
130
158
|
|
|
131
|
-
|
|
132
|
-
const superType = objectType; ///
|
|
159
|
+
const typeString = this.type.getString();
|
|
133
160
|
|
|
134
|
-
|
|
135
|
-
}
|
|
161
|
+
this.context.trace(`Verifying the '${typeString}' complex type's super-types...`, this.node);
|
|
136
162
|
|
|
137
|
-
const
|
|
138
|
-
typeBasic = this.type.isBasic(),
|
|
139
|
-
typeString = this.type.getString();
|
|
163
|
+
const typeBasic = this.type.isBasic();
|
|
140
164
|
|
|
141
165
|
if (typeBasic) {
|
|
142
166
|
superTypesVerify = true;
|
|
143
167
|
|
|
144
168
|
this.context.trace(`The '${typeString}' complex type is basic.`, this.node)
|
|
145
169
|
} else {
|
|
146
|
-
const
|
|
147
|
-
const superTypeName = superType.getName();
|
|
148
|
-
|
|
149
|
-
return superTypeName;
|
|
150
|
-
}),
|
|
151
|
-
superTypeNamesIncludesTypeName = superTypeNames.includes(typeName);
|
|
152
|
-
|
|
153
|
-
if (superTypeNamesIncludesTypeName) {
|
|
154
|
-
this.context.trace(`The '${typeName}' complex type cannot be a super-type `, this.node);
|
|
155
|
-
} else {
|
|
156
|
-
superTypesVerify = superTypes.every((superType) => {
|
|
157
|
-
const superTypeVerifies = this.verifySuperType(superType);
|
|
158
|
-
|
|
159
|
-
if (superTypeVerifies) {
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
if (superTypesVerify) {
|
|
165
|
-
superTypes = superTypes.map((superType) => {
|
|
166
|
-
const superTypeName = superType.getName();
|
|
170
|
+
const superTypes = this.type.getSuperTypes();
|
|
167
171
|
|
|
168
|
-
|
|
172
|
+
superTypesVerify = superTypes.every((superType) => {
|
|
173
|
+
const superTypeVerifies = this.verifySuperType(superType);
|
|
169
174
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this.type.setSuperTypes(superTypes);
|
|
175
|
+
if (superTypeVerifies) {
|
|
176
|
+
return true;
|
|
174
177
|
}
|
|
175
|
-
}
|
|
178
|
+
});
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
if (superTypesVerify) {
|
|
179
|
-
this.context.debug(`...verified the super-types.`, this.node);
|
|
182
|
+
this.context.debug(`...verified the '${typeString}' complex type's super-types.`, this.node);
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
return superTypesVerify;
|
|
183
186
|
}
|
|
184
187
|
|
|
185
|
-
verifyProperty(property, properties
|
|
188
|
+
verifyProperty(property, properties) {
|
|
186
189
|
let propertyVerifies = false;
|
|
187
190
|
|
|
188
191
|
const propertyString = property.getString();
|
|
@@ -203,49 +206,30 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
203
206
|
if (count > 1) {
|
|
204
207
|
this.context.debug(`The '${propertyString}' property appears more than once.`, this.node);
|
|
205
208
|
} else {
|
|
206
|
-
const
|
|
207
|
-
const propertyNameMatches = superTypeProperty.matchPropertyName(propertyName);
|
|
208
|
-
|
|
209
|
-
if (propertyNameMatches) {
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
}) || null;
|
|
213
|
-
|
|
214
|
-
if (superTypeProperty !== null) {
|
|
215
|
-
const superTypePropertyString = superTypeProperty.getString();
|
|
216
|
-
|
|
217
|
-
this.context.debug(`The '${propertyString}' property matches the super-type's '${superTypePropertyString}' property.`, this.node);
|
|
218
|
-
} else {
|
|
219
|
-
let propertyType;
|
|
220
|
-
|
|
221
|
-
propertyType = property.getType();
|
|
209
|
+
const superTypes = this.type.getSuperTypes();
|
|
222
210
|
|
|
223
|
-
|
|
211
|
+
propertyVerifies = superTypes.every((superType) => {
|
|
212
|
+
const superTypeProperties = superType.getProperties(),
|
|
213
|
+
superTypeProperty = superTypeProperties.find((superTypeProperty) => {
|
|
214
|
+
const propertyNameMatches = superTypeProperty.matchPropertyName(propertyName);
|
|
224
215
|
|
|
225
|
-
|
|
226
|
-
|
|
216
|
+
if (propertyNameMatches) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
}) || null;
|
|
227
220
|
|
|
228
|
-
|
|
221
|
+
if (superTypeProperty !== null) {
|
|
222
|
+
const superTypePropertyString = superTypeProperty.getString();
|
|
229
223
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
propertyVerifies = true;
|
|
224
|
+
this.context.debug(`The '${propertyString}' property matches the super-type's '${superTypePropertyString}' property.`, this.node);
|
|
225
|
+
} else {
|
|
226
|
+
return true;
|
|
235
227
|
}
|
|
236
|
-
}
|
|
228
|
+
});
|
|
237
229
|
}
|
|
238
230
|
|
|
239
231
|
if (propertyVerifies) {
|
|
240
|
-
|
|
241
|
-
prefixed = true,
|
|
242
|
-
typeNameMatches = property.matchTypeName(typeName, prefixed, this.context);
|
|
243
|
-
|
|
244
|
-
if (typeNameMatches) {
|
|
245
|
-
property.setType(this.type);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
this.context.debug(`verifies the '${propertyString}' property.`, this.node);
|
|
232
|
+
this.context.debug(`...verified the '${propertyString}' property.`, this.node);
|
|
249
233
|
}
|
|
250
234
|
|
|
251
235
|
return propertyVerifies;
|
|
@@ -254,59 +238,92 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
254
238
|
verifyProperties() {
|
|
255
239
|
let propertiesVerify;
|
|
256
240
|
|
|
257
|
-
const
|
|
258
|
-
properties = this.type.getProperties(includeSuperTypes),
|
|
259
|
-
superTypes = this.type.getSuperTypes()
|
|
241
|
+
const typeString = this.type.getString();
|
|
260
242
|
|
|
261
|
-
|
|
262
|
-
const superTypeProperties = superType.getProperties(),
|
|
263
|
-
propertiesVerify = properties.every((property) => {
|
|
264
|
-
const propertyVerifies = this.verifyProperty(property, properties, superTypeProperties);
|
|
243
|
+
this.context.trace(`Verifying the '${typeString}' complex type's properties...`, this.node);
|
|
265
244
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
245
|
+
const includeSuperTypes = false,
|
|
246
|
+
properties = this.type.getProperties(includeSuperTypes);
|
|
247
|
+
|
|
248
|
+
propertiesVerify = properties.every((property) => {
|
|
249
|
+
const propertyVerifies = this.verifyProperty(property, properties);
|
|
270
250
|
|
|
271
|
-
if (
|
|
251
|
+
if (propertyVerifies) {
|
|
272
252
|
return true;
|
|
273
253
|
}
|
|
274
254
|
});
|
|
275
255
|
|
|
256
|
+
if (propertiesVerify) {
|
|
257
|
+
this.context.debug(`...verified the '${typeString}' complex type's properties.`, this.node);
|
|
258
|
+
}
|
|
259
|
+
|
|
276
260
|
return propertiesVerify;
|
|
277
261
|
}
|
|
278
262
|
|
|
279
|
-
verifyPropertyType(
|
|
263
|
+
verifyPropertyType(property) {
|
|
280
264
|
let propertyTypeVerifies = false;
|
|
281
265
|
|
|
282
|
-
|
|
266
|
+
let propertyType = property.getType();
|
|
267
|
+
|
|
268
|
+
const propertyTypeString = propertyType.getString();
|
|
283
269
|
|
|
284
|
-
|
|
270
|
+
this.context.trace(`Verifying the '${propertyTypeString}' property type...`, this.node);
|
|
271
|
+
|
|
272
|
+
const typeName = this.type.getName(),
|
|
273
|
+
typeNameMatches = propertyType.matchTypeName(typeName);
|
|
274
|
+
|
|
275
|
+
if (typeNameMatches) {
|
|
285
276
|
propertyTypeVerifies = true;
|
|
286
|
-
} else {
|
|
287
|
-
const propertyTypeString = propertyType.getString(); ///
|
|
288
277
|
|
|
289
|
-
|
|
278
|
+
property.setType(this.type);
|
|
279
|
+
} else {
|
|
280
|
+
const nominalTypeName = propertyType.getNominalTypeName();
|
|
281
|
+
|
|
282
|
+
propertyType = this.context.findTypeByNominalTypeName(nominalTypeName);
|
|
290
283
|
|
|
291
|
-
const
|
|
292
|
-
propertyTypePresent = this.context.isTypePresentByTypeName(propertyTypeName);
|
|
284
|
+
const propertyTypePresent = (propertyType !== null);
|
|
293
285
|
|
|
294
|
-
if (
|
|
295
|
-
const
|
|
286
|
+
if (propertyTypePresent) {
|
|
287
|
+
const type = propertyType; ///
|
|
288
|
+
|
|
289
|
+
property.setType(type);
|
|
296
290
|
|
|
297
|
-
this.context.debug(`The '${propertyTypeString}' property type is not present.`, this.node);
|
|
298
|
-
} else {
|
|
299
291
|
propertyTypeVerifies = true;
|
|
300
292
|
}
|
|
293
|
+
}
|
|
301
294
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
295
|
+
if (propertyTypeVerifies) {
|
|
296
|
+
this.context.debug(`...verified the '${propertyTypeString}' property type.`, this.node);
|
|
305
297
|
}
|
|
306
298
|
|
|
307
299
|
return propertyTypeVerifies;
|
|
308
300
|
}
|
|
309
301
|
|
|
302
|
+
verifyPropertyTypes() {
|
|
303
|
+
let propertyTypesVerify;
|
|
304
|
+
|
|
305
|
+
const typeString = this.type.getString();
|
|
306
|
+
|
|
307
|
+
this.context.trace(`Verifying the '${typeString}' complex type's property types...`, this.node);
|
|
308
|
+
|
|
309
|
+
const includeSuperTypes = false,
|
|
310
|
+
properties = this.type.getProperties(includeSuperTypes);
|
|
311
|
+
|
|
312
|
+
propertyTypesVerify = properties.every((property) => {
|
|
313
|
+
const propertyVerifies = this.verifyPropertyType(property);
|
|
314
|
+
|
|
315
|
+
if (propertyVerifies) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
if (propertyTypesVerify) {
|
|
321
|
+
this.context.debug(`...verified the '${typeString}' complex type's property types.`, this.node);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return propertyTypesVerify;
|
|
325
|
+
}
|
|
326
|
+
|
|
310
327
|
static name = "ComplexTypeDeclaration";
|
|
311
328
|
|
|
312
329
|
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
@@ -82,22 +82,22 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
82
82
|
|
|
83
83
|
type = this.constructor.getType();
|
|
84
84
|
|
|
85
|
-
const
|
|
86
|
-
typeString = type.getString();
|
|
85
|
+
const typeString = type.getString();
|
|
87
86
|
|
|
88
87
|
this.context.trace(`Verifying the '${typeString}' type...`, this.node);
|
|
89
88
|
|
|
90
|
-
const
|
|
91
|
-
provisional = type.isProvisional(includeSupertypes);
|
|
89
|
+
const nominalTypeName = type.getNominalTypeName();
|
|
92
90
|
|
|
93
|
-
type = this.context.
|
|
91
|
+
type = this.context.findTypeByNominalTypeName(nominalTypeName);
|
|
94
92
|
|
|
95
93
|
const typePresent = (type !== null)
|
|
96
94
|
|
|
97
95
|
if (!typePresent) {
|
|
98
96
|
this.context.debug(`The '${typeString}' type is not present.`, this.node);
|
|
99
97
|
} else {
|
|
100
|
-
const
|
|
98
|
+
const includeSupertypes = false,
|
|
99
|
+
provisional = type.isProvisional(includeSupertypes),
|
|
100
|
+
provisionalMatches = type.matchProvisional(provisional);
|
|
101
101
|
|
|
102
102
|
if (!provisionalMatches) {
|
|
103
103
|
provisional ?
|
|
@@ -56,12 +56,12 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
56
56
|
if (type === null) {
|
|
57
57
|
typeVerifies = true;
|
|
58
58
|
} else {
|
|
59
|
-
const
|
|
60
|
-
typeString = type.getString();
|
|
59
|
+
const typeString = type.getString();
|
|
61
60
|
|
|
62
61
|
this.context.trace(`Verifying the '${typeString}' type...`, this.node);
|
|
63
62
|
|
|
64
|
-
const
|
|
63
|
+
const nominalTypeName = type.getNominalTypeName(),
|
|
64
|
+
typePresent = this.context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
65
65
|
|
|
66
66
|
if (!typePresent) {
|
|
67
67
|
this.context.debug(`The '${typeString}' type is not present.`, this.node);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
|
|
5
|
-
import { objectType } from "../type";
|
|
6
5
|
import { domAssigned } from "../../dom";
|
|
7
6
|
import { stringFromTypeNameTypePrefixNameAndSuperTypes } from "../../utilities/type";
|
|
8
7
|
|
|
@@ -53,6 +52,15 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
53
52
|
const superTypesVerify = this.verifySuperTypes();
|
|
54
53
|
|
|
55
54
|
if (superTypesVerify) {
|
|
55
|
+
const typePrefix = this.context.getTypePrefix();
|
|
56
|
+
|
|
57
|
+
if (typePrefix !== null) {
|
|
58
|
+
const typePrefixName = typePrefix.getName(),
|
|
59
|
+
prefixName = typePrefixName; ///
|
|
60
|
+
|
|
61
|
+
this.type.setPrefixName(prefixName);
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
this.context.addType(this.type);
|
|
57
65
|
|
|
58
66
|
verifies = true;
|
|
@@ -75,12 +83,21 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
75
83
|
this.context.trace(`Verifying the '${typeString}' simple type...`, this.node);
|
|
76
84
|
|
|
77
85
|
const typeName = this.type.getName(),
|
|
78
|
-
|
|
86
|
+
includeRelease = true,
|
|
87
|
+
includeDependencies = false,
|
|
88
|
+
typePresent = this.context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
|
|
79
89
|
|
|
80
90
|
if (typePresent) {
|
|
81
91
|
this.context.trace(`The '${typeString}' type is already present.`, this.node);
|
|
82
92
|
} else {
|
|
83
|
-
|
|
93
|
+
const prefixedTypeName = typeName, ///
|
|
94
|
+
typePresent = this.context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
95
|
+
|
|
96
|
+
if (typePresent) {
|
|
97
|
+
this.context.trace(`The '${typeString}' type is already present.`, this.node);
|
|
98
|
+
} else {
|
|
99
|
+
typeVerifies = true;
|
|
100
|
+
}
|
|
84
101
|
}
|
|
85
102
|
|
|
86
103
|
if (typeVerifies) {
|
|
@@ -97,11 +114,24 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
97
114
|
|
|
98
115
|
this.context.trace(`Verifying the '${superTypeString}' super-type...`, this.node);
|
|
99
116
|
|
|
100
|
-
const
|
|
101
|
-
|
|
117
|
+
const nominalTypeName = superType.getNominalTypeName(),
|
|
118
|
+
typeName = nominalTypeName, ///
|
|
119
|
+
typeNameMatches = this.type.matchTypeName(typeName);
|
|
102
120
|
|
|
103
|
-
if (
|
|
104
|
-
|
|
121
|
+
if (typeNameMatches) {
|
|
122
|
+
this.context.trace(`The super-type's name matches the ${typeName}' simple type's name.`, this.node);
|
|
123
|
+
} else {
|
|
124
|
+
const oldSuperType = superType;
|
|
125
|
+
|
|
126
|
+
superType = this.context.findTypeByNominalTypeName(nominalTypeName);
|
|
127
|
+
|
|
128
|
+
const superTypePresent = (superType !== null);
|
|
129
|
+
|
|
130
|
+
if (superTypePresent) {
|
|
131
|
+
this.type.replaceSuperType(oldSuperType, newSuperType);
|
|
132
|
+
|
|
133
|
+
superTypeVerifies = true;
|
|
134
|
+
}
|
|
105
135
|
}
|
|
106
136
|
|
|
107
137
|
if (superTypeVerifies) {
|
|
@@ -112,65 +142,32 @@ export default domAssigned(class SimpleTypeDeclaration {
|
|
|
112
142
|
}
|
|
113
143
|
|
|
114
144
|
verifySuperTypes() {
|
|
115
|
-
let superTypesVerify
|
|
116
|
-
|
|
117
|
-
this.context.trace(`Verifying the super-types...`, this.node);
|
|
118
|
-
|
|
119
|
-
let superTypes;
|
|
145
|
+
let superTypesVerify;
|
|
120
146
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const superTypesLength = superTypes.length;
|
|
147
|
+
const typeString = this.type.getString();
|
|
124
148
|
|
|
125
|
-
|
|
126
|
-
const superType = objectType; ///
|
|
149
|
+
this.context.trace(`Verifying the '${typeString}' simple type's super-types...`, this.node);
|
|
127
150
|
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const typeName = this.type.getName(),
|
|
132
|
-
typeBasic = this.type.isBasic(),
|
|
133
|
-
typeString = this.type.getString();
|
|
151
|
+
const typeBasic = this.type.isBasic();
|
|
134
152
|
|
|
135
153
|
if (typeBasic) {
|
|
136
154
|
superTypesVerify = true;
|
|
137
155
|
|
|
138
156
|
this.context.trace(`The '${typeString}' simple type is basic.`, this.node)
|
|
139
157
|
} else {
|
|
140
|
-
const
|
|
141
|
-
const superTypeName = superType.getName();
|
|
142
|
-
|
|
143
|
-
return superTypeName;
|
|
144
|
-
}),
|
|
145
|
-
superTypeNamesIncludesTypeName = superTypeNames.includes(typeName);
|
|
146
|
-
|
|
147
|
-
if (superTypeNamesIncludesTypeName) {
|
|
148
|
-
this.context.trace(`The '${typeName}' simple type cannot be a super-type `, this.node);
|
|
149
|
-
} else {
|
|
150
|
-
superTypesVerify = superTypes.every((superType) => {
|
|
151
|
-
const superTypeVerifies = this.verifySuperType(superType);
|
|
152
|
-
|
|
153
|
-
if (superTypeVerifies) {
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
});
|
|
158
|
+
const superTypes = this.type.getSuperTypes();
|
|
157
159
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const superTypeName = superType.getName();
|
|
160
|
+
superTypesVerify = superTypes.every((superType) => {
|
|
161
|
+
const superTypeVerifies = this.verifySuperType(superType);
|
|
161
162
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return superType;
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
this.type.setSuperTypes(superTypes);
|
|
163
|
+
if (superTypeVerifies) {
|
|
164
|
+
return true;
|
|
168
165
|
}
|
|
169
|
-
}
|
|
166
|
+
});
|
|
170
167
|
}
|
|
171
168
|
|
|
172
169
|
if (superTypesVerify) {
|
|
173
|
-
this.context.debug(`...verified the super-types.`, this.node);
|
|
170
|
+
this.context.debug(`...verified the '${typeString}' simple type's super-types.`, this.node);
|
|
174
171
|
}
|
|
175
172
|
|
|
176
173
|
return superTypesVerify;
|
|
@@ -35,12 +35,21 @@ export default domAssigned(class TypePrefixDeclaration {
|
|
|
35
35
|
|
|
36
36
|
this.context.trace(`Verifying the '${typePrefixDeclarationString}' type prefix declaration...`, this.node);
|
|
37
37
|
|
|
38
|
-
const
|
|
38
|
+
const includeRelease = true,
|
|
39
|
+
includeDependencies = false,
|
|
40
|
+
types = this.context.getTypes(includeRelease, includeDependencies),
|
|
41
|
+
typesLength = types.length;
|
|
39
42
|
|
|
40
|
-
if (
|
|
41
|
-
this.context.
|
|
43
|
+
if (typesLength > 0) {
|
|
44
|
+
this.context.debug(`Cannot verify the '${typePrefixDeclarationString}' type prefix declaration because types have already been declared.`, this.node);
|
|
45
|
+
} else {
|
|
46
|
+
const typePrefixVerifies = this.verifyTypePrefix();
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
if (typePrefixVerifies) {
|
|
49
|
+
this.context.addTypePrefix(this.typePrefix);
|
|
50
|
+
|
|
51
|
+
verifies = true;
|
|
52
|
+
}
|
|
44
53
|
}
|
|
45
54
|
|
|
46
55
|
if (verifies) {
|
|
@@ -69,8 +78,8 @@ export default domAssigned(class TypePrefixDeclaration {
|
|
|
69
78
|
if (typePrefixPresent) {
|
|
70
79
|
this.context.trace(`The '${typePrefixString}' type prefix is already present.`, this.node);
|
|
71
80
|
} else {
|
|
72
|
-
const
|
|
73
|
-
typePresent = this.context.
|
|
81
|
+
const nominalTypeName = typePrefixName, ///
|
|
82
|
+
typePresent = this.context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
74
83
|
|
|
75
84
|
if (typePresent) {
|
|
76
85
|
this.context.trace(`The '${typePrefixString}' type is already present.`, this.node);
|
|
@@ -84,22 +84,22 @@ export default domAssigned(class VariableDeclaration {
|
|
|
84
84
|
|
|
85
85
|
type = this.variable.getType();
|
|
86
86
|
|
|
87
|
-
const
|
|
88
|
-
typeString = type.getString();
|
|
87
|
+
const typeString = type.getString();
|
|
89
88
|
|
|
90
89
|
this.context.trace(`Verifying the '${typeString}' type...`, this.node);
|
|
91
90
|
|
|
92
|
-
const
|
|
93
|
-
provisional = type.isProvisional(includeSupertypes);
|
|
91
|
+
const nominalTypeName = type.getNominalTypeName();
|
|
94
92
|
|
|
95
|
-
type = this.context.
|
|
93
|
+
type = this.context.findTypeByNominalTypeName(nominalTypeName);
|
|
96
94
|
|
|
97
95
|
const typePresent = (type !== null)
|
|
98
96
|
|
|
99
97
|
if (!typePresent) {
|
|
100
98
|
this.context.debug(`The '${typeString}' type is not present.`, this.node);
|
|
101
99
|
} else {
|
|
102
|
-
const
|
|
100
|
+
const includeSupertypes = false,
|
|
101
|
+
provisional = type.isProvisional(includeSupertypes),
|
|
102
|
+
provisionalMatches = type.matchProvisional(provisional);
|
|
103
103
|
|
|
104
104
|
if (!provisionalMatches) {
|
|
105
105
|
provisional ?
|
package/src/dom/metavariable.js
CHANGED
|
@@ -529,9 +529,9 @@ function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, contex
|
|
|
529
529
|
const typeNode = metavariableDeclarationNode.getTypeNode();
|
|
530
530
|
|
|
531
531
|
if (typeNode !== null) {
|
|
532
|
-
const
|
|
532
|
+
const nominalTypeName = typeNode.getNominalTypeName();
|
|
533
533
|
|
|
534
|
-
type = context.
|
|
534
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
return type;
|
package/src/dom/property.js
CHANGED
|
@@ -28,7 +28,7 @@ export default domAssigned(class Property {
|
|
|
28
28
|
this.type = type;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
matchNominalTypeName(nominalTypeName) { return this.type.matchNominalTypeName(nominalTypeName); }
|
|
32
32
|
|
|
33
33
|
matchPropertyName(propertyName) {
|
|
34
34
|
const propertyNameMatches = (this.name === propertyName);
|