occam-verify-cli 1.0.220 → 1.0.224
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 +19 -19
- package/lib/context/local.js +5 -43
- package/lib/context/release.js +11 -11
- package/lib/dom/assertion/contained.js +44 -44
- package/lib/dom/assertion/defined.js +40 -40
- package/lib/dom/assertion/property.js +37 -35
- package/lib/dom/assertion/satisfies.js +26 -25
- package/lib/dom/assertion/subproof.js +16 -16
- package/lib/dom/assertion/type.js +34 -32
- package/lib/dom/axiom.js +52 -52
- package/lib/dom/combinator/bracketed.js +5 -5
- package/lib/dom/combinator.js +6 -6
- package/lib/dom/conclusion.js +10 -10
- package/lib/dom/conjecture.js +5 -5
- package/lib/dom/constructor/bracketed.js +12 -12
- package/lib/dom/constructor.js +9 -9
- package/lib/dom/declaration/combinator.js +11 -11
- package/lib/dom/declaration/complexType.js +133 -63
- package/lib/dom/declaration/constructor.js +17 -17
- package/lib/dom/declaration/metavariable.js +17 -17
- package/lib/dom/declaration/simpleType.js +229 -0
- package/lib/dom/declaration/variable.js +17 -17
- package/lib/dom/declaration.js +54 -52
- package/lib/dom/deduction.js +15 -15
- package/lib/dom/derivation.js +8 -8
- package/lib/dom/equality.js +49 -34
- package/lib/dom/error.js +3 -3
- package/lib/dom/frame.js +38 -38
- package/lib/dom/judgement.js +31 -29
- package/lib/dom/label.js +5 -5
- package/lib/dom/lemma.js +5 -5
- package/lib/dom/metaLemma.js +5 -5
- package/lib/dom/metatheorem.js +5 -5
- package/lib/dom/metavariable.js +55 -55
- package/lib/dom/premise.js +36 -34
- package/lib/dom/procedureCall.js +9 -9
- package/lib/dom/proof.js +6 -6
- package/lib/dom/propertyRelation.js +18 -18
- package/lib/dom/reference.js +28 -28
- package/lib/dom/rule.js +63 -48
- package/lib/dom/signature.js +17 -17
- package/lib/dom/statement.js +36 -36
- package/lib/dom/step.js +32 -35
- package/lib/dom/subDerivation.js +8 -8
- package/lib/dom/subproof.js +27 -30
- package/lib/dom/substitution/statement.js +7 -7
- package/lib/dom/substitution/term.js +2 -16
- package/lib/dom/substitution.js +1 -15
- package/lib/dom/supposition.js +39 -39
- package/lib/dom/term.js +15 -15
- package/lib/dom/theorem.js +5 -5
- package/lib/dom/topLevelAssertion.js +60 -71
- package/lib/dom/topLevelMetaAssertion.js +28 -20
- package/lib/dom/type.js +18 -24
- package/lib/dom/variable.js +16 -16
- package/lib/equivalence.js +54 -33
- package/lib/equivalences.js +57 -101
- package/lib/index.js +2 -2
- package/lib/mixins/statement/verify.js +52 -52
- package/lib/mixins/step/unify.js +79 -61
- package/lib/mixins/term/verify.js +17 -17
- package/lib/substitutions.js +7 -7
- package/lib/unifier/equantional.js +170 -0
- package/lib/unifier/intrinsicLevel.js +8 -8
- package/lib/unifier/metaLevel.js +21 -21
- package/lib/unifier/metavariable.js +9 -9
- package/lib/unifier/statementWithCombinator.js +18 -18
- package/lib/unifier/termWithConstructor.js +10 -10
- package/lib/unifier.js +41 -41
- package/lib/utilities/brackets.js +2 -2
- package/lib/utilities/release.js +18 -17
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/type.js +2 -2
- package/lib/utilities/unification.js +28 -34
- package/lib/verifier/combinator.js +14 -14
- package/lib/verifier/constructor.js +18 -18
- package/lib/verifier/topLevel.js +38 -38
- package/lib/verifier.js +30 -30
- package/package.json +1 -1
- package/src/context/file.js +18 -18
- package/src/context/local.js +5 -48
- package/src/context/release.js +11 -11
- package/src/dom/assertion/contained.js +46 -46
- package/src/dom/assertion/defined.js +41 -41
- package/src/dom/assertion/property.js +37 -35
- package/src/dom/assertion/satisfies.js +26 -25
- package/src/dom/assertion/subproof.js +15 -15
- package/src/dom/assertion/type.js +34 -32
- package/src/dom/axiom.js +56 -54
- package/src/dom/combinator/bracketed.js +4 -4
- package/src/dom/combinator.js +5 -5
- package/src/dom/conclusion.js +9 -9
- package/src/dom/conjecture.js +4 -4
- package/src/dom/constructor/bracketed.js +11 -11
- package/src/dom/constructor.js +8 -8
- package/src/dom/declaration/combinator.js +10 -10
- package/src/dom/declaration/complexType.js +129 -64
- package/src/dom/declaration/constructor.js +16 -16
- package/src/dom/declaration/metavariable.js +16 -16
- package/src/dom/declaration/simpleType.js +179 -0
- package/src/dom/declaration/variable.js +16 -16
- package/src/dom/declaration.js +54 -52
- package/src/dom/deduction.js +14 -14
- package/src/dom/derivation.js +7 -7
- package/src/dom/equality.js +55 -38
- package/src/dom/error.js +2 -2
- package/src/dom/frame.js +38 -38
- package/src/dom/judgement.js +31 -29
- package/src/dom/label.js +4 -4
- package/src/dom/lemma.js +4 -4
- package/src/dom/metaLemma.js +4 -4
- package/src/dom/metatheorem.js +4 -4
- package/src/dom/metavariable.js +54 -54
- package/src/dom/premise.js +35 -33
- package/src/dom/procedureCall.js +8 -8
- package/src/dom/proof.js +5 -5
- package/src/dom/propertyRelation.js +17 -17
- package/src/dom/reference.js +27 -27
- package/src/dom/rule.js +72 -49
- package/src/dom/signature.js +15 -15
- package/src/dom/statement.js +34 -34
- package/src/dom/step.js +42 -48
- package/src/dom/subDerivation.js +7 -7
- package/src/dom/subproof.js +30 -40
- package/src/dom/substitution/statement.js +6 -6
- package/src/dom/substitution/term.js +1 -19
- package/src/dom/substitution.js +0 -13
- package/src/dom/supposition.js +38 -38
- package/src/dom/term.js +14 -14
- package/src/dom/theorem.js +4 -4
- package/src/dom/topLevelAssertion.js +62 -81
- package/src/dom/topLevelMetaAssertion.js +35 -20
- package/src/dom/type.js +23 -33
- package/src/dom/variable.js +16 -15
- package/src/equivalence.js +69 -46
- package/src/equivalences.js +53 -115
- package/src/index.js +1 -1
- package/src/mixins/statement/verify.js +51 -51
- package/src/mixins/step/unify.js +88 -67
- package/src/mixins/term/verify.js +16 -16
- package/src/substitutions.js +5 -6
- package/src/unifier/equantional.js +90 -0
- package/src/unifier/intrinsicLevel.js +7 -7
- package/src/unifier/metaLevel.js +20 -21
- package/src/unifier/metavariable.js +8 -8
- package/src/unifier/statementWithCombinator.js +17 -17
- package/src/unifier/termWithConstructor.js +9 -9
- package/src/unifier.js +40 -40
- package/src/utilities/brackets.js +1 -1
- package/src/utilities/release.js +18 -18
- package/src/utilities/subproof.js +1 -1
- package/src/utilities/type.js +1 -1
- package/src/utilities/unification.js +27 -37
- package/src/verifier/combinator.js +13 -13
- package/src/verifier/constructor.js +17 -17
- package/src/verifier/topLevel.js +41 -41
- package/src/verifier.js +29 -29
- package/lib/dom/declaration/type.js +0 -209
- package/lib/unifier/equality.js +0 -155
- package/src/dom/declaration/type.js +0 -150
- package/src/unifier/equality.js +0 -70
package/src/dom/conclusion.js
CHANGED
|
@@ -20,7 +20,7 @@ export default domAssigned(class Conclusion {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
verify(context) {
|
|
23
|
-
let
|
|
23
|
+
let verifies = false;
|
|
24
24
|
|
|
25
25
|
const conclusionString = this.string; ///
|
|
26
26
|
|
|
@@ -29,23 +29,23 @@ export default domAssigned(class Conclusion {
|
|
|
29
29
|
if (this.statement !== null) {
|
|
30
30
|
const stated = true,
|
|
31
31
|
assignments = null,
|
|
32
|
-
|
|
32
|
+
statementVerifies = this.statement.verify(assignments, stated, context);
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
verifies = statementVerifies; ///
|
|
35
35
|
|
|
36
36
|
} else {
|
|
37
37
|
context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (
|
|
40
|
+
if (verifies) {
|
|
41
41
|
context.debug(`...verified the '${conclusionString}' conclusion.`);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return
|
|
44
|
+
return verifies;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
48
|
-
let
|
|
48
|
+
let statementUnifies;
|
|
49
49
|
|
|
50
50
|
const conclusion = this, ///
|
|
51
51
|
statementString = statement.getString(),
|
|
@@ -53,13 +53,13 @@ export default domAssigned(class Conclusion {
|
|
|
53
53
|
|
|
54
54
|
specificContext.trace(`Unifying the '${statementString}' statement with the '${conclusionString}' conclusion...`);
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
57
57
|
|
|
58
|
-
if (
|
|
58
|
+
if (statementUnifies) {
|
|
59
59
|
specificContext.debug(`...unified the '${statementString}' statement with the '${conclusionString}' conclusion.`);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return statementUnifies;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
toJSON() {
|
package/src/dom/conjecture.js
CHANGED
|
@@ -6,7 +6,7 @@ import { domAssigned } from "../dom";
|
|
|
6
6
|
|
|
7
7
|
export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
|
-
let
|
|
9
|
+
let verifies;
|
|
10
10
|
|
|
11
11
|
const conjecture = this, ///
|
|
12
12
|
fileContext = this.getFileContext(),
|
|
@@ -14,9 +14,9 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
|
14
14
|
|
|
15
15
|
fileContext.trace(`Verifying the '${conjectureString}' conjecture...`);
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
verifies = super.verify();
|
|
18
18
|
|
|
19
|
-
if (
|
|
19
|
+
if (verifies) {
|
|
20
20
|
const conjecture = this; ///
|
|
21
21
|
|
|
22
22
|
fileContext.addConjecture(conjecture);
|
|
@@ -24,7 +24,7 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
|
24
24
|
fileContext.debug(`...verified the '${conjectureString}' conjecture.`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
return
|
|
27
|
+
return verifies;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
static name = "Conjecture";
|
|
@@ -8,14 +8,14 @@ import { domAssigned } from "../../dom";
|
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class BracketedConstructor extends Constructor {
|
|
10
10
|
unifyTerm(term, context, verifyAhead) {
|
|
11
|
-
let
|
|
11
|
+
let termUnifies;
|
|
12
12
|
|
|
13
13
|
const termString = term.getString();
|
|
14
14
|
|
|
15
15
|
context.trace(`Unifying the '${termString}' term with the bracketed constructor...`, term);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
let
|
|
17
|
+
termUnifies = super.unifyTerm(term, context, () => {
|
|
18
|
+
let verifiesAhead = false;
|
|
19
19
|
|
|
20
20
|
const { Term } = dom,
|
|
21
21
|
bracketedTerm = term, ///
|
|
@@ -27,29 +27,29 @@ export default domAssigned(class BracketedConstructor extends Constructor {
|
|
|
27
27
|
|
|
28
28
|
term = Term.fromTermNode(termNode, context);
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
let
|
|
30
|
+
const termVVerifies = term.verify(context, () => {
|
|
31
|
+
let verifiesAhead;
|
|
32
32
|
|
|
33
33
|
const type = term.getType();
|
|
34
34
|
|
|
35
35
|
bracketedTerm.setType(type);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
verifiesAhead = verifyAhead();
|
|
38
38
|
|
|
39
|
-
return
|
|
39
|
+
return verifiesAhead;
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
verifiesAhead = termVVerifies; ///
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
return
|
|
45
|
+
return verifiesAhead;
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
if (
|
|
48
|
+
if (termUnifies) {
|
|
49
49
|
context.debug(`...unified the '${termString}' term with the bracketed constructor.`, term);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
return
|
|
52
|
+
return termUnifies;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
static fromNothing() {
|
package/src/dom/constructor.js
CHANGED
|
@@ -28,7 +28,7 @@ export default domAssigned(class Constructor {
|
|
|
28
28
|
setType(type) { this.term.setType(type); }
|
|
29
29
|
|
|
30
30
|
unifyTerm(term, context, verifyAhead) {
|
|
31
|
-
let
|
|
31
|
+
let termUnifies = false;
|
|
32
32
|
|
|
33
33
|
const constructor = this, ///
|
|
34
34
|
termString = term.getString(),
|
|
@@ -36,25 +36,25 @@ export default domAssigned(class Constructor {
|
|
|
36
36
|
|
|
37
37
|
context.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`, term);
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const termUnifiesWithConstructor = unifyTermWithConstructor(term, constructor, context);
|
|
40
40
|
|
|
41
|
-
if (
|
|
42
|
-
let
|
|
41
|
+
if (termUnifiesWithConstructor) {
|
|
42
|
+
let verifiesAhead;
|
|
43
43
|
|
|
44
44
|
const type = constructor.getType();
|
|
45
45
|
|
|
46
46
|
term.setType(type);
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
verifiesAhead = verifyAhead();
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
termUnifies = verifiesAhead; ///
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if (
|
|
53
|
+
if (termUnifies) {
|
|
54
54
|
context.debug(`...unified the '${termString}' term with the '${constructorString}' constructor.`, term);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
return
|
|
57
|
+
return termUnifies;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
toJSON() {
|
|
@@ -26,29 +26,29 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
verify() {
|
|
29
|
-
let
|
|
29
|
+
let verifies = false;
|
|
30
30
|
|
|
31
31
|
const combinatorDeclarationString = this.getString(); ///
|
|
32
32
|
|
|
33
33
|
this.fileContext.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const combinatorVerifies = this.verifyCombinator();
|
|
36
36
|
|
|
37
|
-
if (
|
|
37
|
+
if (combinatorVerifies) {
|
|
38
38
|
this.fileContext.addCombinator(this.combinator);
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
verifies = true;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if (
|
|
43
|
+
if (verifies) {
|
|
44
44
|
this.fileContext.debug(`...verified the '${combinatorDeclarationString}' combinator declaration.`);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
return
|
|
47
|
+
return verifies;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
verifyCombinator() {
|
|
51
|
-
let
|
|
51
|
+
let statementVerifies;
|
|
52
52
|
|
|
53
53
|
const combinatorString = this.combinator.getString();
|
|
54
54
|
|
|
@@ -57,13 +57,13 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
57
57
|
const statement = this.combinator.getStatement(),
|
|
58
58
|
statementNode = statement.getNode();
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
statementVerifies = combinatorVerifier.verifyStatement(statementNode, this.fileContext);
|
|
61
61
|
|
|
62
|
-
if (
|
|
62
|
+
if (statementVerifies) {
|
|
63
63
|
this.fileContext.debug(`...verified the '${combinatorString}' combinator.`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
return
|
|
66
|
+
return statementVerifies;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
static name = "CombinatorDeclaration";
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
|
|
5
|
+
import { objectType } from "../type";
|
|
5
6
|
import { domAssigned } from "../../dom";
|
|
6
|
-
import {
|
|
7
|
+
import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
|
|
7
8
|
|
|
8
9
|
export default domAssigned(class ComplexTypeDeclaration {
|
|
9
10
|
constructor(fileContext, string, type) {
|
|
@@ -24,61 +25,84 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
24
25
|
return this.type;
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
getReleaseContext() { return this.fileContext.getReleaseContext(); }
|
|
29
|
+
|
|
30
|
+
getReleaseTypes() {
|
|
31
|
+
const includeDependencies = false,
|
|
32
|
+
includeRelease = false,
|
|
33
|
+
releaseContext = this.getReleaseContext(),
|
|
34
|
+
fileContextTypes = this.fileContext.getTypes(includeRelease),
|
|
35
|
+
releaseContextTypes = releaseContext.getTypes(includeDependencies),
|
|
36
|
+
releaseTypes = [
|
|
37
|
+
...fileContextTypes,
|
|
38
|
+
...releaseContextTypes
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
return releaseTypes;
|
|
42
|
+
}
|
|
43
|
+
|
|
27
44
|
verify() {
|
|
28
|
-
let
|
|
45
|
+
let verifies = false;
|
|
29
46
|
|
|
30
47
|
const complexTypeDeclarationString = this.getString();
|
|
31
48
|
|
|
32
49
|
this.fileContext.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`);
|
|
33
50
|
|
|
34
|
-
const
|
|
51
|
+
const typeVerifies = this.verifyType();
|
|
35
52
|
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
53
|
+
if (typeVerifies) {
|
|
54
|
+
const superTypesVerify = this.verifySuperTypes();
|
|
38
55
|
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
56
|
+
if (superTypesVerify) {
|
|
57
|
+
const propertiesVerify = this.verifyProperties();
|
|
41
58
|
|
|
42
|
-
if (
|
|
59
|
+
if (propertiesVerify) {
|
|
43
60
|
this.fileContext.addType(this.type);
|
|
44
61
|
|
|
45
|
-
|
|
62
|
+
verifies = true;
|
|
46
63
|
}
|
|
47
64
|
}
|
|
48
65
|
}
|
|
49
66
|
|
|
50
|
-
if (
|
|
67
|
+
if (verifies) {
|
|
51
68
|
this.fileContext.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration.`);
|
|
52
69
|
}
|
|
53
70
|
|
|
54
|
-
return
|
|
71
|
+
return verifies;
|
|
55
72
|
}
|
|
56
73
|
|
|
57
74
|
verifyType() {
|
|
58
|
-
let
|
|
75
|
+
let typeVerifies = false;
|
|
59
76
|
|
|
60
|
-
const
|
|
61
|
-
complexTypeString = this.type.getString();
|
|
77
|
+
const complexTypeString = this.type.getString();
|
|
62
78
|
|
|
63
79
|
this.fileContext.trace(`Verifying the '${complexTypeString}' complex type...`);
|
|
64
80
|
|
|
65
|
-
const
|
|
81
|
+
const typeName = this.type.getName(),
|
|
82
|
+
releaseTypes = this.getReleaseTypes(),
|
|
83
|
+
typePresent = releaseTypes.some((releaseType) => {
|
|
84
|
+
const releaseTypeNameMatches = releaseType.matchTypeName(typeName);
|
|
85
|
+
|
|
86
|
+
if (releaseTypeNameMatches) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
66
90
|
|
|
67
91
|
if (typePresent) {
|
|
68
|
-
this.fileContext.debug(`The type '${complexTypeString}' is already present.`);
|
|
92
|
+
this.fileContext.debug(`The type '${complexTypeString}' is already present in the package.`);
|
|
69
93
|
} else {
|
|
70
|
-
|
|
94
|
+
typeVerifies = true;
|
|
71
95
|
}
|
|
72
96
|
|
|
73
|
-
if (
|
|
97
|
+
if (typeVerifies) {
|
|
74
98
|
this.fileContext.debug(`...verified the '${complexTypeString}' complex type.`);
|
|
75
99
|
}
|
|
76
100
|
|
|
77
|
-
return
|
|
101
|
+
return typeVerifies;
|
|
78
102
|
}
|
|
79
103
|
|
|
80
104
|
verifySuperType(superType) {
|
|
81
|
-
let
|
|
105
|
+
let superTypeVerifies = false;
|
|
82
106
|
|
|
83
107
|
const superTypeString = superType.getString();
|
|
84
108
|
|
|
@@ -87,59 +111,100 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
87
111
|
const superTypeName = superType.getName(),
|
|
88
112
|
superTypePresent = this.fileContext.isTypePresentByTypeName(superTypeName);
|
|
89
113
|
|
|
90
|
-
|
|
114
|
+
if (superTypePresent) {
|
|
115
|
+
superTypeVerifies = true;
|
|
116
|
+
}
|
|
91
117
|
|
|
92
|
-
if (
|
|
118
|
+
if (superTypeVerifies) {
|
|
93
119
|
this.fileContext.debug(`...verified the '${superTypeString}' super-type.`);
|
|
94
120
|
}
|
|
95
121
|
|
|
96
|
-
return
|
|
122
|
+
return superTypeVerifies;
|
|
97
123
|
}
|
|
98
124
|
|
|
99
125
|
verifySuperTypes() {
|
|
100
|
-
let
|
|
126
|
+
let superTypesVerify = false;
|
|
127
|
+
|
|
128
|
+
this.fileContext.trace(`Verifying the super-types...`);
|
|
129
|
+
|
|
130
|
+
let superTypes;
|
|
131
|
+
|
|
132
|
+
superTypes = this.type.getSuperTypes();
|
|
133
|
+
|
|
134
|
+
const typeName = this.type.getName(),
|
|
135
|
+
superTypesLength = superTypes.length;
|
|
136
|
+
|
|
137
|
+
if (superTypesLength === 0) {
|
|
138
|
+
const type = this.fileContext.findTypeByTypeName(typeName);
|
|
101
139
|
|
|
102
|
-
|
|
140
|
+
if (type === null) {
|
|
141
|
+
const superType = objectType; ///
|
|
142
|
+
|
|
143
|
+
superTypes.push(superType);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const typeBasic = this.type.isBasic(),
|
|
148
|
+
typeString = this.type.getString();
|
|
103
149
|
|
|
104
150
|
if (typeBasic) {
|
|
105
|
-
|
|
151
|
+
superTypesVerify = true;
|
|
152
|
+
|
|
153
|
+
this.fileContext.trace(`The '${typeString}' type is basic.`)
|
|
106
154
|
} else {
|
|
107
|
-
|
|
155
|
+
const superTypeNames = superTypes.map((superType) => {
|
|
156
|
+
const superTypeName = superType.getName();
|
|
108
157
|
|
|
109
|
-
|
|
158
|
+
return superTypeName;
|
|
159
|
+
}),
|
|
160
|
+
superTypeNamesIncludesTypeName = superTypeNames.includes(typeName);
|
|
110
161
|
|
|
111
|
-
|
|
162
|
+
if (superTypeNamesIncludesTypeName) {
|
|
163
|
+
this.fileContext.trace(`The '${typeName}' type cannot be a super-type `);
|
|
164
|
+
} else {
|
|
165
|
+
if (superTypesLength === 0) {
|
|
166
|
+
const type = this.fileContext.findTypeByTypeName(typeName),
|
|
167
|
+
superType = type; ///
|
|
112
168
|
|
|
113
|
-
|
|
169
|
+
superTypes.push(superType);
|
|
170
|
+
}
|
|
114
171
|
|
|
115
|
-
|
|
116
|
-
|
|
172
|
+
superTypesVerify = superTypes.every((superType) => {
|
|
173
|
+
const superTypeVerifies = this.verifySuperType(superType);
|
|
117
174
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
175
|
+
if (superTypeVerifies) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
122
179
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
180
|
+
if (superTypesVerify) {
|
|
181
|
+
superTypes = superTypes.map((superType) => {
|
|
182
|
+
const superTypeName = superType.getName();
|
|
126
183
|
|
|
127
|
-
|
|
184
|
+
superType = this.fileContext.findTypeByTypeName(superTypeName);
|
|
128
185
|
|
|
129
|
-
|
|
130
|
-
|
|
186
|
+
return superType;
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const typeName = this.type.getName(),
|
|
190
|
+
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes);
|
|
131
191
|
|
|
132
|
-
|
|
192
|
+
this.type.setString(string);
|
|
133
193
|
|
|
134
|
-
|
|
194
|
+
this.type.setSuperTypes(superTypes);
|
|
195
|
+
}
|
|
135
196
|
}
|
|
136
197
|
}
|
|
137
198
|
|
|
138
|
-
|
|
199
|
+
if (superTypesVerify) {
|
|
200
|
+
this.fileContext.debug(`...verified the super-types.`);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return superTypesVerify;
|
|
139
204
|
}
|
|
140
205
|
|
|
141
206
|
verifyProperty(property, properties, superTypeProperties) {
|
|
142
|
-
let
|
|
207
|
+
let propertyVerifies = false;
|
|
143
208
|
|
|
144
209
|
const propertyString = property.getString();
|
|
145
210
|
|
|
@@ -176,9 +241,9 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
176
241
|
|
|
177
242
|
propertyType = property.getType();
|
|
178
243
|
|
|
179
|
-
const
|
|
244
|
+
const propertyTypeVerifies = this.verifyPropertyType(propertyType);
|
|
180
245
|
|
|
181
|
-
if (
|
|
246
|
+
if (propertyTypeVerifies) {
|
|
182
247
|
const propertyTypeName = propertyType.getName();
|
|
183
248
|
|
|
184
249
|
propertyType = this.fileContext.findTypeByTypeName(propertyTypeName);
|
|
@@ -187,50 +252,50 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
187
252
|
|
|
188
253
|
property.setType(type);
|
|
189
254
|
|
|
190
|
-
|
|
255
|
+
propertyVerifies = true;
|
|
191
256
|
}
|
|
192
257
|
}
|
|
193
258
|
}
|
|
194
259
|
|
|
195
|
-
if (
|
|
196
|
-
this.fileContext.debug(`
|
|
260
|
+
if (propertyVerifies) {
|
|
261
|
+
this.fileContext.debug(`verifies the '${propertyString}' property.`);
|
|
197
262
|
}
|
|
198
263
|
|
|
199
|
-
return
|
|
264
|
+
return propertyVerifies;
|
|
200
265
|
}
|
|
201
266
|
|
|
202
267
|
verifyProperties() {
|
|
203
|
-
let
|
|
268
|
+
let propertiesVerify;
|
|
204
269
|
|
|
205
270
|
const includeSuperTypes = false,
|
|
206
271
|
properties = this.type.getProperties(includeSuperTypes),
|
|
207
272
|
superTypes = this.type.getSuperTypes()
|
|
208
273
|
|
|
209
|
-
|
|
274
|
+
propertiesVerify = superTypes.every((superType) => {
|
|
210
275
|
const superTypeProperties = superType.getProperties(),
|
|
211
|
-
|
|
212
|
-
const
|
|
276
|
+
propertiesVerify = properties.every((property) => {
|
|
277
|
+
const propertyVerifies = this.verifyProperty(property, properties, superTypeProperties);
|
|
213
278
|
|
|
214
|
-
if (
|
|
279
|
+
if (propertyVerifies) {
|
|
215
280
|
return true;
|
|
216
281
|
}
|
|
217
282
|
});
|
|
218
283
|
|
|
219
|
-
if (
|
|
284
|
+
if (propertiesVerify) {
|
|
220
285
|
return true;
|
|
221
286
|
}
|
|
222
287
|
});
|
|
223
288
|
|
|
224
|
-
return
|
|
289
|
+
return propertiesVerify;
|
|
225
290
|
}
|
|
226
291
|
|
|
227
292
|
verifyPropertyType(propertyType) {
|
|
228
|
-
let
|
|
293
|
+
let propertyTypeVerifies = false;
|
|
229
294
|
|
|
230
295
|
const typeEqualToPropertyType = this.type.isEqualTo(propertyType);
|
|
231
296
|
|
|
232
297
|
if (typeEqualToPropertyType) {
|
|
233
|
-
|
|
298
|
+
propertyTypeVerifies = true;
|
|
234
299
|
} else {
|
|
235
300
|
const propertyTypeString = propertyType.getString(); ///
|
|
236
301
|
|
|
@@ -244,15 +309,15 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
244
309
|
|
|
245
310
|
this.fileContext.debug(`The '${propertyTypeString}' property type is not present.`);
|
|
246
311
|
} else {
|
|
247
|
-
|
|
312
|
+
propertyTypeVerifies = true;
|
|
248
313
|
}
|
|
249
314
|
|
|
250
|
-
if (
|
|
315
|
+
if (propertyTypeVerifies) {
|
|
251
316
|
this.fileContext.debug(`...verified the '${propertyTypeString}' property type.`);
|
|
252
317
|
}
|
|
253
318
|
}
|
|
254
319
|
|
|
255
|
-
return
|
|
320
|
+
return propertyTypeVerifies;
|
|
256
321
|
}
|
|
257
322
|
|
|
258
323
|
static name = "ComplexTypeDeclaration";
|
|
@@ -26,33 +26,33 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
verify() {
|
|
29
|
-
let
|
|
29
|
+
let verifies;
|
|
30
30
|
|
|
31
31
|
const constructorDeclarationString = this.getString(); ///
|
|
32
32
|
|
|
33
33
|
this.fileContext.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const constructorTypeVerifies = this.verifyConstructorType();
|
|
36
36
|
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
37
|
+
if (constructorTypeVerifies) {
|
|
38
|
+
const constructorVerifies = this.verifyConstructor();
|
|
39
39
|
|
|
40
|
-
if (
|
|
40
|
+
if (constructorVerifies) {
|
|
41
41
|
this.fileContext.addConstructor(this.constructor);
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
verifies = true;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
if (
|
|
47
|
+
if (verifies) {
|
|
48
48
|
this.fileContext.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
return
|
|
51
|
+
return verifies;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
verifyConstructor() {
|
|
55
|
-
let
|
|
55
|
+
let constructorVerifies;
|
|
56
56
|
|
|
57
57
|
const constructorString = this.constructor.getString();
|
|
58
58
|
|
|
@@ -61,17 +61,17 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
61
61
|
const term = this.constructor.getTerm(),
|
|
62
62
|
termNode = term.getNode();
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
constructorVerifies = constructorVerifier.verifyTerm(termNode, this.fileContext);
|
|
65
65
|
|
|
66
|
-
if (
|
|
66
|
+
if (constructorVerifies) {
|
|
67
67
|
this.fileContext.debug(`...verified the '${constructorString}' constructor.`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
return
|
|
70
|
+
return constructorVerifies;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
verifyConstructorType() {
|
|
74
|
-
let
|
|
74
|
+
let constructorTypeVerifies = false;
|
|
75
75
|
|
|
76
76
|
let type;
|
|
77
77
|
|
|
@@ -101,15 +101,15 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
101
101
|
} else {
|
|
102
102
|
this.constructor.setType(type);
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
constructorTypeVerifies = true;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
if (
|
|
108
|
+
if (constructorTypeVerifies) {
|
|
109
109
|
this.fileContext.debug(`...verified the '${typeString}' type.`);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
return
|
|
112
|
+
return constructorTypeVerifies;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
static name = "ConstructorDeclaration";
|