occam-verify-cli 1.0.642 → 1.0.648
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 +14 -14
- package/lib/context.js +22 -8
- package/lib/element/assertion/type.js +9 -6
- package/lib/element/combinator.js +11 -6
- package/lib/element/constructor.js +43 -8
- package/lib/element/declaration/combinator.js +25 -15
- package/lib/element/declaration/complexType.js +43 -33
- package/lib/element/declaration/constructor.js +45 -100
- package/lib/element/declaration/simpleType.js +77 -53
- package/lib/element/declaration/typePrefix.js +30 -20
- package/lib/element/declaration/variable.js +3 -5
- package/lib/element/term.js +1 -1
- package/lib/element/topLevelAssertion/axiom.js +2 -2
- package/lib/element/type.js +6 -5
- package/lib/node/declaration/complexType.js +1 -8
- package/lib/node/declaration/simpleType.js +1 -8
- package/lib/process/assign.js +11 -24
- package/lib/process/unify.js +41 -1
- package/lib/process/verify.js +61 -13
- package/lib/utilities/element.js +31 -19
- package/lib/utilities/type.js +3 -3
- package/package.json +1 -1
- package/src/context/file/nominal.js +13 -13
- package/src/context.js +24 -10
- package/src/element/assertion/type.js +10 -6
- package/src/element/combinator.js +11 -7
- package/src/element/constructor.js +54 -3
- package/src/element/declaration/combinator.js +5 -2
- package/src/element/declaration/complexType.js +9 -6
- package/src/element/declaration/constructor.js +33 -99
- package/src/element/declaration/simpleType.js +73 -44
- package/src/element/declaration/typePrefix.js +5 -2
- package/src/element/declaration/variable.js +3 -8
- package/src/element/term.js +7 -7
- package/src/element/topLevelAssertion/axiom.js +1 -1
- package/src/element/type.js +4 -3
- package/src/node/declaration/complexType.js +0 -7
- package/src/node/declaration/simpleType.js +0 -7
- package/src/process/assign.js +15 -23
- package/src/process/unify.js +32 -0
- package/src/process/verify.js +48 -18
- package/src/utilities/element.js +33 -18
- package/src/utilities/type.js +2 -3
package/lib/utilities/type.js
CHANGED
|
@@ -18,10 +18,10 @@ function _interop_require_default(obj) {
|
|
|
18
18
|
var baseType = null;
|
|
19
19
|
function baseTypeFromNothing() {
|
|
20
20
|
if (baseType === null) {
|
|
21
|
-
var Type = _elements.default.Type, name = _constants.BASE_TYPE_SYMBOL, context = null
|
|
22
|
-
baseType = Type.
|
|
21
|
+
var Type = _elements.default.Type, name = _constants.BASE_TYPE_SYMBOL, context = null;
|
|
22
|
+
baseType = Type.fromName(name, context);
|
|
23
23
|
}
|
|
24
24
|
return baseType;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvdHlwZS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IGVsZW1lbnRzIGZyb20gXCIuLi9lbGVtZW50c1wiO1xuXG5pbXBvcnQgeyBCQVNFX1RZUEVfU1lNQk9MIH0gZnJvbSBcIi4uL2NvbnN0YW50c1wiO1xuXG5sZXQgYmFzZVR5cGUgPSBudWxsO1xuXG5leHBvcnQgZnVuY3Rpb24gYmFzZVR5cGVGcm9tTm90aGluZygpIHtcbiAgaWYgKGJhc2VUeXBlID09PSBudWxsKSB7XG4gICAgY29uc3QgeyBUeXBlIH0gPSBlbGVtZW50cyxcbiAgICAgICAgICBuYW1lID0gQkFTRV9UWVBFX1NZTUJPTCwgIC8vL1xuICAgICAgICAgIGNvbnRleHQgPSBudWxsO1xuXG4gICAgYmFzZVR5cGUgPSBUeXBlLmZyb21OYW1lKG5hbWUsIGNvbnRleHQpO1xuICB9XG5cbiAgcmV0dXJuIGJhc2VUeXBlO1xufVxuIl0sIm5hbWVzIjpbImJhc2VUeXBlRnJvbU5vdGhpbmciLCJiYXNlVHlwZSIsIlR5cGUiLCJlbGVtZW50cyIsIm5hbWUiLCJCQVNFX1RZUEVfU1lNQk9MIiwiY29udGV4dCIsImZyb21OYW1lIl0sIm1hcHBpbmdzIjoiQUFBQTs7OzsrQkFRZ0JBOzs7ZUFBQUE7OzsrREFOSzt5QkFFWTs7Ozs7O0FBRWpDLElBQUlDLFdBQVc7QUFFUixTQUFTRDtJQUNkLElBQUlDLGFBQWEsTUFBTTtRQUNyQixJQUFNLEFBQUVDLE9BQVNDLGlCQUFRLENBQWpCRCxNQUNGRSxPQUFPQywyQkFBZ0IsRUFDdkJDLFVBQVU7UUFFaEJMLFdBQVdDLEtBQUtLLFFBQVEsQ0FBQ0gsTUFBTUU7SUFDakM7SUFFQSxPQUFPTDtBQUNUIn0=
|
package/package.json
CHANGED
|
@@ -263,7 +263,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
263
263
|
this.types.push(type);
|
|
264
264
|
|
|
265
265
|
const filePath = this.getFilePath(),
|
|
266
|
-
typeString = type.
|
|
266
|
+
typeString = type.getString();
|
|
267
267
|
|
|
268
268
|
this.trace(`Added the '${typeString}' type to the '${filePath}' file context.`)
|
|
269
269
|
}
|
|
@@ -272,7 +272,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
272
272
|
this.rules.push(rule);
|
|
273
273
|
|
|
274
274
|
const filePath = this.getFilePath(),
|
|
275
|
-
ruleString = rule.
|
|
275
|
+
ruleString = rule.getString();
|
|
276
276
|
|
|
277
277
|
this.trace(`Added the '${ruleString}' rule to the '${filePath}' file context.`)
|
|
278
278
|
}
|
|
@@ -281,7 +281,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
281
281
|
this.axioms.push(axiom);
|
|
282
282
|
|
|
283
283
|
const filePath = this.getFilePath(),
|
|
284
|
-
axiomString = axiom.
|
|
284
|
+
axiomString = axiom.getString();
|
|
285
285
|
|
|
286
286
|
this.trace(`Added the '${axiomString}' axiom to the '${filePath}' file context.`)
|
|
287
287
|
}
|
|
@@ -290,7 +290,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
290
290
|
this.lemmas.push(lemma);
|
|
291
291
|
|
|
292
292
|
const filePath = this.getFilePath(),
|
|
293
|
-
lemmaString = lemma.
|
|
293
|
+
lemmaString = lemma.getString();
|
|
294
294
|
|
|
295
295
|
this.trace(`Added the '${lemmaString}' lemma to the '${filePath}' file context.`)
|
|
296
296
|
}
|
|
@@ -299,7 +299,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
299
299
|
this.theorems.push(theorem);
|
|
300
300
|
|
|
301
301
|
const filePath = this.getFilePath(),
|
|
302
|
-
theoremString = theorem.
|
|
302
|
+
theoremString = theorem.getString();
|
|
303
303
|
|
|
304
304
|
this.trace(`Added the '${theoremString}' theorem to the '${filePath}' file context.`)
|
|
305
305
|
}
|
|
@@ -308,7 +308,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
308
308
|
this.variables.push(variable);
|
|
309
309
|
|
|
310
310
|
const filePath = this.getFilePath(),
|
|
311
|
-
variableString = variable.
|
|
311
|
+
variableString = variable.getString();
|
|
312
312
|
|
|
313
313
|
this.trace(`Added the '${variableString}' variable to the '${filePath}' file context.`)
|
|
314
314
|
}
|
|
@@ -317,7 +317,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
317
317
|
this.metaLemmas.push(metaLemma);
|
|
318
318
|
|
|
319
319
|
const filePath = this.getFilePath(),
|
|
320
|
-
metaLemmaString = metaLemma.
|
|
320
|
+
metaLemmaString = metaLemma.getString();
|
|
321
321
|
|
|
322
322
|
this.trace(`Added the '${metaLemmaString}' meta-lemma to the '${filePath}' file context.`)
|
|
323
323
|
}
|
|
@@ -326,7 +326,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
326
326
|
this.conjectures.push(conjecture);
|
|
327
327
|
|
|
328
328
|
const filePath = this.getFilePath(),
|
|
329
|
-
ocnjectureString = ocnjecture.
|
|
329
|
+
ocnjectureString = ocnjecture.getString();
|
|
330
330
|
|
|
331
331
|
this.trace(`Added the '${ocnjectureString}' ocnjecture to the '${filePath}' file context.`)
|
|
332
332
|
}
|
|
@@ -335,7 +335,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
335
335
|
this.combinators.push(combinator);
|
|
336
336
|
|
|
337
337
|
const filePath = this.getFilePath(),
|
|
338
|
-
combinatorString = combinator.
|
|
338
|
+
combinatorString = combinator.getString();
|
|
339
339
|
|
|
340
340
|
this.trace(`Added the '${combinatorString}' combinator to the '${filePath}' file context.`)
|
|
341
341
|
}
|
|
@@ -344,7 +344,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
344
344
|
this.typePrefixes.push(typePrefix);
|
|
345
345
|
|
|
346
346
|
const filePath = this.getFilePath(),
|
|
347
|
-
typePrefixString = typePrefix.
|
|
347
|
+
typePrefixString = typePrefix.getString();
|
|
348
348
|
|
|
349
349
|
this.trace(`Added the '${typePrefixString}' type-prefix to the '${filePath}' file context.`)
|
|
350
350
|
}
|
|
@@ -353,7 +353,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
353
353
|
this.constructors.push(constructor);
|
|
354
354
|
|
|
355
355
|
const filePath = this.getFilePath(),
|
|
356
|
-
constructorString = constructor.
|
|
356
|
+
constructorString = constructor.getString();
|
|
357
357
|
|
|
358
358
|
this.trace(`Added the '${constructorString}' constructor to the '${filePath}' file context.`)
|
|
359
359
|
}
|
|
@@ -362,7 +362,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
362
362
|
this.metatheorems.push(metatheorem);
|
|
363
363
|
|
|
364
364
|
const filePath = this.getFilePath(),
|
|
365
|
-
metatheoremString = metatheorem.
|
|
365
|
+
metatheoremString = metatheorem.getString();
|
|
366
366
|
|
|
367
367
|
this.trace(`Added the '${metatheoremString}' metatheorem to the '${filePath}' file context.`)
|
|
368
368
|
}
|
|
@@ -371,7 +371,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
371
371
|
this.metavariables.push(metavariable);
|
|
372
372
|
|
|
373
373
|
const filePath = this.getFilePath(),
|
|
374
|
-
metavariableString = metavariable.
|
|
374
|
+
metavariableString = metavariable.getString();
|
|
375
375
|
|
|
376
376
|
this.trace(`Added the '${metavariableString}' metavariable to the '${filePath}' file context.`)
|
|
377
377
|
}
|
package/src/context.js
CHANGED
|
@@ -33,7 +33,7 @@ export default class Context extends ContextBase {
|
|
|
33
33
|
|
|
34
34
|
getFrames() {
|
|
35
35
|
const context = this.getContext(),
|
|
36
|
-
|
|
36
|
+
frames = context.getFrames();
|
|
37
37
|
|
|
38
38
|
return frames;
|
|
39
39
|
}
|
|
@@ -87,9 +87,9 @@ export default class Context extends ContextBase {
|
|
|
87
87
|
return combinators;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
getConstructors(includeRelease) {
|
|
91
91
|
const context = this.getContext(),
|
|
92
|
-
constructors = context.
|
|
92
|
+
constructors = context.getConstructors(includeRelease);
|
|
93
93
|
|
|
94
94
|
return constructors;
|
|
95
95
|
}
|
|
@@ -118,7 +118,7 @@ export default class Context extends ContextBase {
|
|
|
118
118
|
|
|
119
119
|
findRuleByReference(reference) {
|
|
120
120
|
const context = this.getContext(),
|
|
121
|
-
|
|
121
|
+
rule = context.findRuleByReference(reference);
|
|
122
122
|
|
|
123
123
|
return rule;
|
|
124
124
|
}
|
|
@@ -146,14 +146,14 @@ export default class Context extends ContextBase {
|
|
|
146
146
|
|
|
147
147
|
findFrameByFrameNode(frameNode) {
|
|
148
148
|
const context = this.getContext(),
|
|
149
|
-
|
|
149
|
+
frame = context.findFrameByFrameNode(frameNode);
|
|
150
150
|
|
|
151
151
|
return frame;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
findEqualityByEqualityNode(equalityNode) {
|
|
155
155
|
const context = this.getContext(),
|
|
156
|
-
|
|
156
|
+
equality = context.findEqualityByEqualityNode(equalityNode);
|
|
157
157
|
|
|
158
158
|
return equality;
|
|
159
159
|
}
|
|
@@ -186,6 +186,13 @@ export default class Context extends ContextBase {
|
|
|
186
186
|
return substitution;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
findTypeByNominalTypeName(nominalTypeName) {
|
|
190
|
+
const context = this.getContext(),
|
|
191
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
192
|
+
|
|
193
|
+
return type;
|
|
194
|
+
}
|
|
195
|
+
|
|
189
196
|
findVariableByVariableIdentifier(variableIdentifier) {
|
|
190
197
|
const context = this.getContext(),
|
|
191
198
|
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
@@ -238,7 +245,7 @@ export default class Context extends ContextBase {
|
|
|
238
245
|
|
|
239
246
|
findProcedureByProcedureName(procedureName) {
|
|
240
247
|
const context = this.getContext(),
|
|
241
|
-
|
|
248
|
+
procedure = context.findProcedureByProcedureName(procedureName);
|
|
242
249
|
|
|
243
250
|
return procedure;
|
|
244
251
|
}
|
|
@@ -279,11 +286,11 @@ export default class Context extends ContextBase {
|
|
|
279
286
|
return framePresent;
|
|
280
287
|
}
|
|
281
288
|
|
|
282
|
-
|
|
289
|
+
isTypePresentByNominalTypeName(nominalTypeName) {
|
|
283
290
|
const context = this.getContext(),
|
|
284
|
-
|
|
291
|
+
typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
285
292
|
|
|
286
|
-
return
|
|
293
|
+
return typePresent;
|
|
287
294
|
}
|
|
288
295
|
|
|
289
296
|
isEqualityPresentByEqualityNode(equalityNode) {
|
|
@@ -293,6 +300,13 @@ export default class Context extends ContextBase {
|
|
|
293
300
|
return equalityPresent;
|
|
294
301
|
}
|
|
295
302
|
|
|
303
|
+
isJudgementPresentByJudgementNode(judgementNode) {
|
|
304
|
+
const context = this.getContext(),
|
|
305
|
+
judgementPresent = context.isJudgementPresentByJudgementNode(judgementNode);
|
|
306
|
+
|
|
307
|
+
return judgementPresent;
|
|
308
|
+
}
|
|
309
|
+
|
|
296
310
|
isStatementPresentByStatementNode(statementNode) {
|
|
297
311
|
const context = this.getContext(),
|
|
298
312
|
statementPresent = context.isStatementPresentByStatementNode(statementNode);
|
|
@@ -80,9 +80,10 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
80
80
|
validateType(context) {
|
|
81
81
|
let typeValidates;
|
|
82
82
|
|
|
83
|
-
const typeString = this.type.getString()
|
|
83
|
+
const typeString = this.type.getString(),
|
|
84
|
+
typeAssertionString = this.getString(); ///
|
|
84
85
|
|
|
85
|
-
context.trace(`Validating the '${typeString}' type...`);
|
|
86
|
+
context.trace(`Validating the '${typeAssertionString}' type assertion's '${typeString}' type...`);
|
|
86
87
|
|
|
87
88
|
const nominalTypeName = this.type.getNominalTypeName(),
|
|
88
89
|
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
@@ -96,7 +97,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
if (typeValidates) {
|
|
99
|
-
context.debug(`...
|
|
100
|
+
context.debug(`...validated the '${typeAssertionString}' type assertion's '${typeString}' type.`);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
return typeValidates;
|
|
@@ -178,10 +179,13 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
const typeAssertion = this, ///
|
|
181
|
-
variableAssigment = variableAssignmentFromTypeAssertion(typeAssertion, context)
|
|
182
|
-
assignment = variableAssigment; ///
|
|
182
|
+
variableAssigment = variableAssignmentFromTypeAssertion(typeAssertion, context);
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
if (variableAssigment !== null) {
|
|
185
|
+
const assignment = variableAssigment; ///
|
|
186
|
+
|
|
187
|
+
context.addAssignment(assignment);
|
|
188
|
+
}
|
|
185
189
|
}
|
|
186
190
|
|
|
187
191
|
static name = "TypeAssertion";
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { attempt } from "../utilities/context";
|
|
7
|
+
import { verifyStatementAsCombinator } from "../process/verify";
|
|
7
8
|
import { unifyStatementWithCombinator } from "../process/unify";
|
|
8
9
|
import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
9
10
|
|
|
@@ -26,18 +27,21 @@ export default define(class Combinator extends Element {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
verify(context) {
|
|
29
|
-
let verifies;
|
|
30
|
+
let verifies = false;
|
|
30
31
|
|
|
31
32
|
const combinatorString = this.getString(); ///
|
|
32
33
|
|
|
33
34
|
context.trace(`Verifying the '${combinatorString}' combinator...`);
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
attempt((context) => {
|
|
37
|
+
const statementVerifiesAsCombinator = verifyStatementAsCombinator(this.statement, context);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (statementVerifiesAsCombinator) {
|
|
40
|
+
this.setContext(context);
|
|
41
|
+
|
|
42
|
+
verifies = true;
|
|
43
|
+
}
|
|
44
|
+
}, context)
|
|
41
45
|
|
|
42
46
|
if (verifies) {
|
|
43
47
|
context.debug(`...verified the '${combinatorString}' combinator.`);
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
+
import { attempt } from "../utilities/context";
|
|
7
|
+
import { verifyTermAsConstructor } from "../process/verify";
|
|
6
8
|
import { unifyTermWithConstructor } from "../process/unify";
|
|
7
9
|
import { termFromJSON, termToTermJSON } from "../utilities/json";
|
|
8
10
|
|
|
@@ -24,12 +26,53 @@ export default define(class Constructor extends Element {
|
|
|
24
26
|
return constructorNode;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
isProvisional() { return this.term.isProvisional(); }
|
|
28
|
-
|
|
29
29
|
getType() { return this.term.getType(); }
|
|
30
30
|
|
|
31
|
+
getString() {
|
|
32
|
+
let string;
|
|
33
|
+
|
|
34
|
+
const type = this.getType();
|
|
35
|
+
|
|
36
|
+
if (type === null) {
|
|
37
|
+
const termString = this.term.getString();
|
|
38
|
+
|
|
39
|
+
string = termString; ///
|
|
40
|
+
} else {
|
|
41
|
+
const typeString = type.getString(),
|
|
42
|
+
termString = this.term.getString();
|
|
43
|
+
|
|
44
|
+
string = `${termString}.${typeString}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return string;
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
setType(type) { this.term.setType(type); }
|
|
32
51
|
|
|
52
|
+
verify(context) {
|
|
53
|
+
let verifies = false;
|
|
54
|
+
|
|
55
|
+
const constructorString = this.getString(); ///
|
|
56
|
+
|
|
57
|
+
context.trace(`Verifying the '${constructorString}' constructor...`);
|
|
58
|
+
|
|
59
|
+
attempt((context) => {
|
|
60
|
+
const termVerifiesAsConstructor = verifyTermAsConstructor(this.term, context);
|
|
61
|
+
|
|
62
|
+
if (termVerifiesAsConstructor) {
|
|
63
|
+
this.setContext(context);
|
|
64
|
+
|
|
65
|
+
verifies = true;
|
|
66
|
+
}
|
|
67
|
+
}, context);
|
|
68
|
+
|
|
69
|
+
if (verifies) {
|
|
70
|
+
context.debug(`...verified the '${constructorString}' constructor.`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return verifies;
|
|
74
|
+
}
|
|
75
|
+
|
|
33
76
|
unifyTerm(term, context, validateForwards) {
|
|
34
77
|
let termUnifies = false;
|
|
35
78
|
|
|
@@ -38,8 +81,16 @@ export default define(class Constructor extends Element {
|
|
|
38
81
|
|
|
39
82
|
context.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`);
|
|
40
83
|
|
|
84
|
+
const specifiContext = context; ///
|
|
85
|
+
|
|
86
|
+
context = this.getContext();
|
|
87
|
+
|
|
88
|
+
const generalContext = context; ///
|
|
89
|
+
|
|
90
|
+
context = specifiContext; ///
|
|
91
|
+
|
|
41
92
|
const constructor = this, ///
|
|
42
|
-
termUnifiesWithConstructor = unifyTermWithConstructor(term, constructor,
|
|
93
|
+
termUnifiesWithConstructor = unifyTermWithConstructor(term, constructor, generalContext, specifiContext);
|
|
43
94
|
|
|
44
95
|
if (termUnifiesWithConstructor) {
|
|
45
96
|
let validatesForwards;
|
|
@@ -25,8 +25,11 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
25
25
|
async verify() {
|
|
26
26
|
let verifies = false;
|
|
27
27
|
|
|
28
|
-
const context = this.getContext()
|
|
29
|
-
|
|
28
|
+
const context = this.getContext();
|
|
29
|
+
|
|
30
|
+
await this.break(context);
|
|
31
|
+
|
|
32
|
+
const combinatorDeclarationString = this.getString(); ///
|
|
30
33
|
|
|
31
34
|
context.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
32
35
|
|
|
@@ -5,19 +5,19 @@ import Declaration from "../declaration";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
|
|
7
7
|
export default define(class ComplexTypeDeclaration extends Declaration {
|
|
8
|
-
constructor(context, string, node, type,
|
|
8
|
+
constructor(context, string, node, type, superTypes) {
|
|
9
9
|
super(context, string, node);
|
|
10
10
|
|
|
11
11
|
this.type = type;
|
|
12
|
-
this.
|
|
12
|
+
this.superTypes = superTypes;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getType() {
|
|
16
16
|
return this.type;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
return this.
|
|
19
|
+
getSuperTypes() {
|
|
20
|
+
return this.superTypes;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
getComplexTypeDeclarationNode() {
|
|
@@ -266,8 +266,11 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
266
266
|
async verify() {
|
|
267
267
|
let verifies = false;
|
|
268
268
|
|
|
269
|
-
const context = this.getContext()
|
|
270
|
-
|
|
269
|
+
const context = this.getContext();
|
|
270
|
+
|
|
271
|
+
await this.break(context);
|
|
272
|
+
|
|
273
|
+
const complexTypeDeclarationString = this.getString(); ///
|
|
271
274
|
|
|
272
275
|
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`);
|
|
273
276
|
|
|
@@ -17,7 +17,7 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
17
17
|
return this.type;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
isProvisional() {
|
|
21
21
|
return this.provisional;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -32,37 +32,6 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
32
32
|
return constructorDeclarationNode;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
async verify() {
|
|
36
|
-
let verifies = false;
|
|
37
|
-
|
|
38
|
-
const context = this.getContext(),
|
|
39
|
-
constructorDeclarationString = this.getString(); ///
|
|
40
|
-
|
|
41
|
-
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
42
|
-
|
|
43
|
-
const typeVerified = this.verifyType();
|
|
44
|
-
|
|
45
|
-
if (typeVerified) {
|
|
46
|
-
const constructorVerifies = this.verifyConstructor();
|
|
47
|
-
|
|
48
|
-
if (constructorVerifies) {
|
|
49
|
-
const constructorTypeVerifies = this.verifyConstructorType();
|
|
50
|
-
|
|
51
|
-
if (constructorTypeVerifies) {
|
|
52
|
-
context.addConstructor(this.constructor);
|
|
53
|
-
|
|
54
|
-
verifies = true;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (verifies) {
|
|
60
|
-
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return verifies;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
35
|
verifyType() {
|
|
67
36
|
let typeVerifies = false;
|
|
68
37
|
|
|
@@ -76,8 +45,7 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
76
45
|
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
77
46
|
|
|
78
47
|
if (type !== null) {
|
|
79
|
-
const
|
|
80
|
-
provisional = this.isProvisional(includeSupertypes),
|
|
48
|
+
const provisional = this.isProvisional(),
|
|
81
49
|
typeComparesToProvisional = type.compareProvisional(provisional);
|
|
82
50
|
|
|
83
51
|
if (!typeComparesToProvisional) {
|
|
@@ -118,71 +86,37 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
118
86
|
return constructorVerifies;
|
|
119
87
|
}
|
|
120
88
|
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
// }
|
|
89
|
+
async verify() {
|
|
90
|
+
let verifies = false;
|
|
158
91
|
|
|
159
|
-
|
|
160
|
-
|
|
92
|
+
const context = this.getContext();
|
|
93
|
+
|
|
94
|
+
await this.break(context);
|
|
95
|
+
|
|
96
|
+
const constructorDeclarationString = this.getString(); ///
|
|
97
|
+
|
|
98
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
99
|
+
|
|
100
|
+
const typeVerified = this.verifyType();
|
|
101
|
+
|
|
102
|
+
if (typeVerified) {
|
|
103
|
+
const constructorVerifies = this.verifyConstructor();
|
|
104
|
+
|
|
105
|
+
if (constructorVerifies) {
|
|
106
|
+
this.constructor.setType(this.type);
|
|
107
|
+
|
|
108
|
+
context.addConstructor(this.constructor);
|
|
161
109
|
|
|
110
|
+
verifies = true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
162
113
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
// }
|
|
114
|
+
if (verifies) {
|
|
115
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return verifies;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static name = "ConstructorDeclaration";
|
|
122
|
+
});
|