occam-verify-cli 1.0.396 → 1.0.404
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/assignment/equality.js +2 -2
- package/lib/context/file.js +4 -5
- package/lib/context/local.js +17 -6
- package/lib/context/partial.js +10 -10
- package/lib/context/temporary.js +102 -52
- package/lib/mixins/step/unify.js +5 -6
- package/lib/node/argument.js +4 -4
- package/lib/node/assertion/contained.js +6 -6
- package/lib/node/assertion/defined.js +6 -6
- package/lib/node/assertion/property.js +6 -6
- package/lib/node/assertion/satisfies.js +6 -6
- package/lib/node/assertion/subproof.js +6 -6
- package/lib/node/assertion/type.js +6 -6
- package/lib/node/assertion.js +107 -0
- package/lib/node/assumption.js +134 -0
- package/lib/node/axiom.js +6 -6
- package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
- package/lib/node/body.js +4 -5
- package/lib/node/combinator.js +4 -4
- package/lib/node/conclusion.js +4 -4
- package/lib/node/conjecture.js +6 -6
- package/lib/node/constructor.js +4 -4
- package/lib/node/declaration/combinator.js +6 -6
- package/lib/node/declaration/complexType.js +6 -6
- package/lib/node/declaration/constructor.js +6 -6
- package/lib/node/declaration/metavariable.js +6 -6
- package/lib/node/declaration/property.js +6 -6
- package/lib/node/declaration/simpleType.js +6 -6
- package/lib/node/declaration/typePrefix.js +6 -6
- package/lib/node/declaration/variable.js +6 -6
- package/lib/node/declaration.js +6 -22
- package/lib/node/deduction.js +4 -4
- package/lib/node/derivation.js +4 -4
- package/lib/node/document.js +107 -0
- package/lib/node/equality.js +4 -4
- package/lib/node/error.js +4 -4
- package/lib/node/frame.js +25 -14
- package/lib/node/header.js +4 -4
- package/lib/node/hypothesis.js +4 -4
- package/lib/node/judgement.js +8 -8
- package/lib/node/label.js +4 -4
- package/lib/node/labels.js +4 -4
- package/lib/node/lemma.js +6 -6
- package/lib/node/metaArgument.js +4 -4
- package/lib/node/metaLemma.js +6 -6
- package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
- package/lib/node/metaType.js +4 -4
- package/lib/node/metatheorem.js +6 -6
- package/lib/node/metavariable.js +4 -4
- package/lib/node/nonsense.js +4 -4
- package/lib/node/parameter.js +4 -4
- package/lib/node/parenthesisedLabel.js +4 -4
- package/lib/node/parenthesisedLabels.js +4 -4
- package/lib/node/placeholder.js +107 -0
- package/lib/node/premise.js +4 -4
- package/lib/node/procedureCall.js +4 -4
- package/lib/node/procedureReference.js +4 -4
- package/lib/node/proof.js +4 -4
- package/lib/node/property.js +4 -4
- package/lib/node/propertyRelation.js +4 -4
- package/lib/node/qualification.js +4 -4
- package/lib/node/reference.js +4 -4
- package/lib/node/rule.js +4 -4
- package/lib/node/section.js +4 -4
- package/lib/node/signature.js +4 -4
- package/lib/node/statement.js +15 -4
- package/lib/node/step.js +4 -4
- package/lib/node/subDerivation.js +4 -4
- package/lib/node/subproof.js +4 -4
- package/lib/node/substitution/frame.js +6 -6
- package/lib/node/substitution/statement.js +6 -6
- package/lib/node/substitution/term.js +6 -6
- package/lib/node/substitution.js +107 -0
- package/lib/node/supposition.js +4 -4
- package/lib/node/term.js +27 -4
- package/lib/node/theorem.js +6 -6
- package/lib/node/type.js +4 -4
- package/lib/node/typePrefix.js +4 -4
- package/lib/node/types.js +4 -4
- package/lib/node/variable.js +4 -4
- package/lib/nominal/parser.js +3 -3
- package/lib/nonTerminalNode.js +222 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ontology/assertion/contained.js +8 -9
- package/lib/ontology/assertion/defined.js +9 -10
- package/lib/ontology/assertion/satisfies.js +4 -4
- package/lib/ontology/assumption.js +379 -0
- package/lib/ontology/declaration/combinator.js +75 -33
- package/lib/ontology/declaration/complexType.js +110 -63
- package/lib/ontology/declaration/constructor.js +81 -38
- package/lib/ontology/declaration/metavariable.js +87 -39
- package/lib/ontology/declaration/simpleType.js +95 -48
- package/lib/ontology/declaration/typePrefix.js +87 -40
- package/lib/ontology/declaration/variable.js +87 -39
- package/lib/ontology/declaration.js +13 -338
- package/lib/ontology/equivalence.js +295 -0
- package/lib/ontology/equivalences.js +264 -0
- package/lib/ontology/frame.js +49 -54
- package/lib/ontology/judgement.js +8 -8
- package/lib/ontology/metavariable.js +4 -4
- package/lib/ontology/premise.js +14 -5
- package/lib/ontology/reference.js +3 -9
- package/lib/ontology/rule.js +3 -4
- package/lib/ontology/statement.js +28 -24
- package/lib/ontology/step.js +2 -3
- package/lib/ontology/subproof.js +2 -3
- package/lib/ontology/substitution/statement.js +77 -36
- package/lib/ontology/substitution/term.js +14 -34
- package/lib/ontology/substitution.js +18 -19
- package/lib/ontology/substitutions.js +425 -0
- package/lib/ontology/supposition.js +14 -5
- package/lib/ontology/term.js +33 -36
- package/lib/ontology/topLevelAssertion.js +2 -3
- package/lib/ontology/topLevelMetaAssertion.js +2 -3
- package/lib/ontology/variable.js +1 -34
- package/lib/preamble.js +7 -4
- package/lib/ruleNames.js +20 -12
- package/lib/unifier/intrinsicLevel.js +4 -12
- package/lib/unifier/metaLevel.js +14 -22
- package/lib/utilities/frame.js +18 -0
- package/lib/utilities/statement.js +18 -0
- package/lib/utilities/substitutions.js +43 -30
- package/lib/utilities/variable.js +5 -17
- package/package.json +10 -10
- package/src/assignment/equality.js +1 -1
- package/src/context/file.js +5 -4
- package/src/context/local.js +28 -5
- package/src/context/partial.js +9 -14
- package/src/context/temporary.js +120 -51
- package/src/mixins/step/unify.js +4 -4
- package/src/node/argument.js +1 -1
- package/src/node/assertion/contained.js +3 -3
- package/src/node/assertion/defined.js +3 -3
- package/src/node/assertion/property.js +3 -3
- package/src/node/assertion/satisfies.js +3 -3
- package/src/node/assertion/subproof.js +3 -3
- package/src/node/assertion/type.js +3 -3
- package/src/node/assertion.js +7 -0
- package/src/node/assumption.js +35 -0
- package/src/node/axiom.js +3 -3
- package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
- package/src/node/body.js +1 -3
- package/src/node/combinator.js +1 -1
- package/src/node/conclusion.js +1 -1
- package/src/node/conjecture.js +3 -3
- package/src/node/constructor.js +1 -1
- package/src/node/declaration/combinator.js +3 -3
- package/src/node/declaration/complexType.js +3 -3
- package/src/node/declaration/constructor.js +3 -3
- package/src/node/declaration/metavariable.js +3 -3
- package/src/node/declaration/property.js +3 -3
- package/src/node/declaration/simpleType.js +3 -3
- package/src/node/declaration/typePrefix.js +3 -3
- package/src/node/declaration/variable.js +3 -3
- package/src/node/declaration.js +2 -18
- package/src/node/deduction.js +1 -1
- package/src/node/derivation.js +1 -1
- package/src/node/document.js +7 -0
- package/src/node/equality.js +1 -1
- package/src/node/error.js +1 -1
- package/src/node/frame.js +23 -11
- package/src/node/header.js +1 -1
- package/src/node/hypothesis.js +1 -1
- package/src/node/judgement.js +6 -6
- package/src/node/label.js +1 -1
- package/src/node/labels.js +1 -1
- package/src/node/lemma.js +3 -3
- package/src/node/metaArgument.js +1 -1
- package/src/node/metaLemma.js +3 -3
- package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
- package/src/node/metaType.js +1 -1
- package/src/node/metatheorem.js +3 -3
- package/src/node/metavariable.js +1 -1
- package/src/node/nonsense.js +1 -1
- package/src/node/parameter.js +1 -1
- package/src/node/parenthesisedLabel.js +1 -1
- package/src/node/parenthesisedLabels.js +1 -1
- package/src/node/placeholder.js +7 -0
- package/src/node/premise.js +1 -1
- package/src/node/procedureCall.js +1 -1
- package/src/node/procedureReference.js +1 -1
- package/src/node/proof.js +1 -1
- package/src/node/property.js +1 -1
- package/src/node/propertyRelation.js +1 -1
- package/src/node/qualification.js +1 -1
- package/src/node/reference.js +1 -1
- package/src/node/rule.js +2 -2
- package/src/node/section.js +1 -1
- package/src/node/signature.js +1 -1
- package/src/node/statement.js +13 -1
- package/src/node/step.js +1 -1
- package/src/node/subDerivation.js +1 -1
- package/src/node/subproof.js +1 -1
- package/src/node/substitution/frame.js +3 -3
- package/src/node/substitution/statement.js +3 -3
- package/src/node/substitution/term.js +3 -3
- package/src/node/substitution.js +7 -0
- package/src/node/supposition.js +1 -1
- package/src/node/term.js +27 -1
- package/src/node/theorem.js +3 -3
- package/src/node/type.js +1 -1
- package/src/node/typePrefix.js +1 -1
- package/src/node/types.js +1 -1
- package/src/node/variable.js +1 -1
- package/src/nominal/parser.js +2 -2
- package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
- package/src/nonTerminalNodeMap.js +10 -5
- package/src/ontology/assertion/contained.js +14 -14
- package/src/ontology/assertion/defined.js +13 -13
- package/src/ontology/assertion/satisfies.js +2 -1
- package/src/ontology/assumption.js +385 -0
- package/src/ontology/declaration/combinator.js +15 -24
- package/src/ontology/declaration/complexType.js +57 -53
- package/src/ontology/declaration/constructor.js +25 -31
- package/src/ontology/declaration/metavariable.js +25 -30
- package/src/ontology/declaration/simpleType.js +34 -38
- package/src/ontology/declaration/typePrefix.js +23 -31
- package/src/ontology/declaration/variable.js +26 -31
- package/src/ontology/declaration.js +8 -372
- package/src/{equivalence.js → ontology/equivalence.js} +4 -3
- package/src/{equivalences.js → ontology/equivalences.js} +14 -12
- package/src/ontology/frame.js +53 -63
- package/src/ontology/judgement.js +8 -8
- package/src/ontology/metavariable.js +2 -2
- package/src/ontology/premise.js +18 -4
- package/src/ontology/reference.js +4 -3
- package/src/ontology/rule.js +4 -3
- package/src/ontology/statement.js +31 -27
- package/src/ontology/step.js +2 -2
- package/src/ontology/subproof.js +2 -2
- package/src/ontology/substitution/statement.js +56 -53
- package/src/ontology/substitution/term.js +9 -35
- package/src/ontology/substitution.js +11 -15
- package/src/{substitutions.js → ontology/substitutions.js} +4 -3
- package/src/ontology/supposition.js +18 -4
- package/src/ontology/term.js +27 -39
- package/src/ontology/topLevelAssertion.js +2 -2
- package/src/ontology/topLevelMetaAssertion.js +2 -2
- package/src/ontology/variable.js +0 -54
- package/src/preamble.js +6 -3
- package/src/ruleNames.js +10 -8
- package/src/unifier/intrinsicLevel.js +3 -14
- package/src/unifier/metaLevel.js +14 -25
- package/src/utilities/frame.js +13 -0
- package/src/utilities/statement.js +13 -0
- package/src/utilities/substitutions.js +59 -31
- package/src/utilities/variable.js +1 -10
- package/lib/equivalence.js +0 -294
- package/lib/equivalences.js +0 -263
- package/lib/node/nonTerminal.js +0 -218
- package/lib/substitutions.js +0 -424
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ontology from "../../ontology";
|
|
4
|
+
import Declaration from "../declaration";
|
|
4
5
|
|
|
5
6
|
import { define } from "../../ontology";
|
|
6
7
|
import { stringFromTypeNameTypePrefixNameAndSuperTypes } from "../../utilities/type";
|
|
7
8
|
|
|
8
|
-
export default define(class SimpleTypeDeclaration {
|
|
9
|
+
export default define(class SimpleTypeDeclaration extends Declaration {
|
|
9
10
|
constructor(context, node, string, type, prefixed) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.string = string;
|
|
11
|
+
super(context, node, string);
|
|
12
|
+
|
|
13
13
|
this.type = type;
|
|
14
14
|
this.prefixed = prefixed;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
getContext() {
|
|
18
|
-
return this.context;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getNode() {
|
|
22
|
-
return this.node;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getString() {
|
|
26
|
-
return this.string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
17
|
getType() {
|
|
30
18
|
return this.type;
|
|
31
19
|
}
|
|
@@ -37,14 +25,16 @@ export default define(class SimpleTypeDeclaration {
|
|
|
37
25
|
verify() {
|
|
38
26
|
let verifies = false;
|
|
39
27
|
|
|
40
|
-
const
|
|
28
|
+
const node = this.getNode(),
|
|
29
|
+
context = this.getContext(),
|
|
30
|
+
simpleTypeDeclarationString = this.getString(); ///
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration...`, node);
|
|
43
33
|
|
|
44
34
|
if (this.prefixed) {
|
|
45
35
|
const typeString = this.type.getString();
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
context.trace(`The '${typeString}' type is prefixed.`);
|
|
48
38
|
} else {
|
|
49
39
|
const typeVerifies = this.verifyType();
|
|
50
40
|
|
|
@@ -52,7 +42,7 @@ export default define(class SimpleTypeDeclaration {
|
|
|
52
42
|
const superTypesVerify = this.verifySuperTypes();
|
|
53
43
|
|
|
54
44
|
if (superTypesVerify) {
|
|
55
|
-
const typePrefix =
|
|
45
|
+
const typePrefix = context.getTypePrefix();
|
|
56
46
|
|
|
57
47
|
if (typePrefix !== null) {
|
|
58
48
|
const typePrefixName = typePrefix.getName(),
|
|
@@ -61,7 +51,7 @@ export default define(class SimpleTypeDeclaration {
|
|
|
61
51
|
this.type.setPrefixName(prefixName);
|
|
62
52
|
}
|
|
63
53
|
|
|
64
|
-
|
|
54
|
+
context.addType(this.type);
|
|
65
55
|
|
|
66
56
|
verifies = true;
|
|
67
57
|
}
|
|
@@ -69,7 +59,7 @@ export default define(class SimpleTypeDeclaration {
|
|
|
69
59
|
}
|
|
70
60
|
|
|
71
61
|
if (verifies) {
|
|
72
|
-
|
|
62
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration.`, node);
|
|
73
63
|
}
|
|
74
64
|
|
|
75
65
|
return verifies;
|
|
@@ -78,30 +68,32 @@ export default define(class SimpleTypeDeclaration {
|
|
|
78
68
|
verifyType() {
|
|
79
69
|
let typeVerifies = false;
|
|
80
70
|
|
|
81
|
-
const
|
|
71
|
+
const node = this.getNode(),
|
|
72
|
+
context = this.getContext(),
|
|
73
|
+
typeString = this.type.getString();
|
|
82
74
|
|
|
83
|
-
|
|
75
|
+
context.trace(`Verifying the '${typeString}' simple type...`, node);
|
|
84
76
|
|
|
85
77
|
const typeName = this.type.getName(),
|
|
86
78
|
includeRelease = true,
|
|
87
79
|
includeDependencies = false,
|
|
88
|
-
typePresent =
|
|
80
|
+
typePresent = context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
|
|
89
81
|
|
|
90
82
|
if (typePresent) {
|
|
91
|
-
|
|
83
|
+
context.trace(`The '${typeString}' type is already present.`, node);
|
|
92
84
|
} else {
|
|
93
85
|
const prefixedTypeName = typeName, ///
|
|
94
|
-
typePresent =
|
|
86
|
+
typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
95
87
|
|
|
96
88
|
if (typePresent) {
|
|
97
|
-
|
|
89
|
+
context.trace(`The '${typeString}' type is already present.`, node);
|
|
98
90
|
} else {
|
|
99
91
|
typeVerifies = true;
|
|
100
92
|
}
|
|
101
93
|
}
|
|
102
94
|
|
|
103
95
|
if (typeVerifies) {
|
|
104
|
-
|
|
96
|
+
context.trace(`...verified the '${typeString}' simple type.`, node);
|
|
105
97
|
}
|
|
106
98
|
|
|
107
99
|
return typeVerifies;
|
|
@@ -110,20 +102,22 @@ export default define(class SimpleTypeDeclaration {
|
|
|
110
102
|
verifySuperType(superType) {
|
|
111
103
|
let superTypeVerifies = false;
|
|
112
104
|
|
|
113
|
-
const
|
|
105
|
+
const node = this.getNode(),
|
|
106
|
+
context = this.getContext(),
|
|
107
|
+
superTypeString = superType.getString();
|
|
114
108
|
|
|
115
|
-
|
|
109
|
+
context.trace(`Verifying the '${superTypeString}' super-type...`, node);
|
|
116
110
|
|
|
117
111
|
const nominalTypeName = superType.getNominalTypeName(),
|
|
118
112
|
typeName = nominalTypeName, ///
|
|
119
113
|
typeNameMatches = this.type.matchTypeName(typeName);
|
|
120
114
|
|
|
121
115
|
if (typeNameMatches) {
|
|
122
|
-
|
|
116
|
+
context.trace(`The super-type's name matches the ${typeName}' simple type's name.`, node);
|
|
123
117
|
} else {
|
|
124
118
|
const oldSuperType = superType;
|
|
125
119
|
|
|
126
|
-
superType =
|
|
120
|
+
superType = context.findTypeByNominalTypeName(nominalTypeName);
|
|
127
121
|
|
|
128
122
|
const superTypePresent = (superType !== null);
|
|
129
123
|
|
|
@@ -137,7 +131,7 @@ export default define(class SimpleTypeDeclaration {
|
|
|
137
131
|
}
|
|
138
132
|
|
|
139
133
|
if (superTypeVerifies) {
|
|
140
|
-
|
|
134
|
+
context.debug(`...verified the '${superTypeString}' super-type.`, node);
|
|
141
135
|
}
|
|
142
136
|
|
|
143
137
|
return superTypeVerifies;
|
|
@@ -146,16 +140,18 @@ export default define(class SimpleTypeDeclaration {
|
|
|
146
140
|
verifySuperTypes() {
|
|
147
141
|
let superTypesVerify;
|
|
148
142
|
|
|
149
|
-
const
|
|
143
|
+
const node = this.getNode(),
|
|
144
|
+
context = this.getContext(),
|
|
145
|
+
typeString = this.type.getString();
|
|
150
146
|
|
|
151
|
-
|
|
147
|
+
context.trace(`Verifying the '${typeString}' simple type's super-types...`, node);
|
|
152
148
|
|
|
153
149
|
const typeBasic = this.type.isBasic();
|
|
154
150
|
|
|
155
151
|
if (typeBasic) {
|
|
156
152
|
superTypesVerify = true;
|
|
157
153
|
|
|
158
|
-
|
|
154
|
+
context.trace(`The '${typeString}' simple type is basic.`, node)
|
|
159
155
|
} else {
|
|
160
156
|
const superTypes = this.type.getSuperTypes();
|
|
161
157
|
|
|
@@ -169,7 +165,7 @@ export default define(class SimpleTypeDeclaration {
|
|
|
169
165
|
}
|
|
170
166
|
|
|
171
167
|
if (superTypesVerify) {
|
|
172
|
-
|
|
168
|
+
context.debug(`...verified the '${typeString}' simple type's super-types.`, node);
|
|
173
169
|
}
|
|
174
170
|
|
|
175
171
|
return superTypesVerify;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ontology from "../../ontology";
|
|
4
|
+
import Declaration from "../declaration";
|
|
4
5
|
|
|
5
6
|
import { define } from "../../ontology";
|
|
6
7
|
|
|
7
|
-
export default define(class TypePrefixDeclaration {
|
|
8
|
+
export default define(class TypePrefixDeclaration extends Declaration {
|
|
8
9
|
constructor(context, node, string, typePrefix) {
|
|
9
|
-
|
|
10
|
-
this.node = node;
|
|
11
|
-
this.string = string;
|
|
12
|
-
this.typePrefix = typePrefix;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
getContext() {
|
|
16
|
-
return this.context;
|
|
17
|
-
}
|
|
10
|
+
super(context, node, string);
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
return this.node;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getString() {
|
|
24
|
-
return this.string;
|
|
12
|
+
this.typePrefix = typePrefix;
|
|
25
13
|
}
|
|
26
14
|
|
|
27
15
|
getTypePrefix() {
|
|
@@ -31,29 +19,31 @@ export default define(class TypePrefixDeclaration {
|
|
|
31
19
|
verify() {
|
|
32
20
|
let verifies = false;
|
|
33
21
|
|
|
34
|
-
const
|
|
22
|
+
const node = this.getNode(),
|
|
23
|
+
context = this.getContext(),
|
|
24
|
+
typePrefixDeclarationString = this.getString(); ///
|
|
35
25
|
|
|
36
|
-
|
|
26
|
+
context.trace(`Verifying the '${typePrefixDeclarationString}' type prefix declaration...`, node);
|
|
37
27
|
|
|
38
28
|
const includeRelease = true,
|
|
39
29
|
includeDependencies = false,
|
|
40
|
-
types =
|
|
30
|
+
types = context.getTypes(includeRelease, includeDependencies),
|
|
41
31
|
typesLength = types.length;
|
|
42
32
|
|
|
43
33
|
if (typesLength > 0) {
|
|
44
|
-
|
|
34
|
+
context.debug(`Cannot verify the '${typePrefixDeclarationString}' type prefix declaration because types have already been declared.`, node);
|
|
45
35
|
} else {
|
|
46
36
|
const typePrefixVerifies = this.verifyTypePrefix();
|
|
47
37
|
|
|
48
38
|
if (typePrefixVerifies) {
|
|
49
|
-
|
|
39
|
+
context.addTypePrefix(this.typePrefix);
|
|
50
40
|
|
|
51
41
|
verifies = true;
|
|
52
42
|
}
|
|
53
43
|
}
|
|
54
44
|
|
|
55
45
|
if (verifies) {
|
|
56
|
-
|
|
46
|
+
context.debug(`...verified the '${typePrefixDeclarationString}' type prefix declaration.`, node);
|
|
57
47
|
}
|
|
58
48
|
|
|
59
49
|
return verifies;
|
|
@@ -62,27 +52,29 @@ export default define(class TypePrefixDeclaration {
|
|
|
62
52
|
verifyTypePrefix() {
|
|
63
53
|
let typePrefixVerifies = false;
|
|
64
54
|
|
|
65
|
-
const
|
|
55
|
+
const node = this.getNode(),
|
|
56
|
+
context = this.getContext(),
|
|
57
|
+
typePrefixString = this.typePrefix.getString();
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
context.trace(`Verifying the '${typePrefixString}' type prefix...`, node);
|
|
68
60
|
|
|
69
|
-
const typePrefix =
|
|
61
|
+
const typePrefix = context.getTypePrefix();
|
|
70
62
|
|
|
71
63
|
if (typePrefix !== null) {
|
|
72
|
-
|
|
64
|
+
context.trace(`The package already has a '${typePrefixString}' type prefix.`, node);
|
|
73
65
|
} else {
|
|
74
66
|
|
|
75
67
|
const typePrefixName = this.typePrefix.getName(),
|
|
76
|
-
typePrefixPresent =
|
|
68
|
+
typePrefixPresent = context.isTypePrefixPresentByTypePrefixName(typePrefixName);
|
|
77
69
|
|
|
78
70
|
if (typePrefixPresent) {
|
|
79
|
-
|
|
71
|
+
context.trace(`The '${typePrefixString}' type prefix is already present.`, node);
|
|
80
72
|
} else {
|
|
81
73
|
const nominalTypeName = typePrefixName, ///
|
|
82
|
-
typePresent =
|
|
74
|
+
typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
83
75
|
|
|
84
76
|
if (typePresent) {
|
|
85
|
-
|
|
77
|
+
context.trace(`The '${typePrefixString}' type is already present.`, node);
|
|
86
78
|
} else {
|
|
87
79
|
typePrefixVerifies = true;
|
|
88
80
|
}
|
|
@@ -90,7 +82,7 @@ export default define(class TypePrefixDeclaration {
|
|
|
90
82
|
}
|
|
91
83
|
|
|
92
84
|
if (typePrefixVerifies) {
|
|
93
|
-
|
|
85
|
+
context.debug(`...verified the '${typePrefixString}' type prefix.`, node);
|
|
94
86
|
}
|
|
95
87
|
|
|
96
88
|
return typePrefixVerifies;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ontology from "../../ontology";
|
|
4
|
+
import Declaration from "../declaration";
|
|
4
5
|
|
|
5
6
|
import { define } from "../../ontology";
|
|
6
7
|
|
|
7
|
-
export default define(class VariableDeclaration {
|
|
8
|
+
export default define(class VariableDeclaration extends Declaration {
|
|
8
9
|
constructor(context, node, string, variable) {
|
|
9
|
-
|
|
10
|
-
this.node = node;
|
|
11
|
-
this.string = string;
|
|
12
|
-
this.variable = variable;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
getContext() {
|
|
16
|
-
return this.context;
|
|
17
|
-
}
|
|
10
|
+
super(context, node, string);
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
return this.node;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getString() {
|
|
24
|
-
return this.string;
|
|
12
|
+
this.variable = variable;
|
|
25
13
|
}
|
|
26
14
|
|
|
27
15
|
getVariable() {
|
|
@@ -31,9 +19,11 @@ export default define(class VariableDeclaration {
|
|
|
31
19
|
verify() {
|
|
32
20
|
let verifies = false;
|
|
33
21
|
|
|
34
|
-
const
|
|
22
|
+
const node = this.getNode(),
|
|
23
|
+
context = this.getContext(),
|
|
24
|
+
variableDeclarationString = this.getString(); ///
|
|
35
25
|
|
|
36
|
-
|
|
26
|
+
context.trace(`Verifying the '${variableDeclarationString}' variable declaration...`, node);
|
|
37
27
|
|
|
38
28
|
const variableTypeVerifies = this.verifyVariableType();
|
|
39
29
|
|
|
@@ -41,14 +31,14 @@ export default define(class VariableDeclaration {
|
|
|
41
31
|
const variableVerifies = this.verifyVariable();
|
|
42
32
|
|
|
43
33
|
if (variableVerifies) {
|
|
44
|
-
|
|
34
|
+
context.addVariable(this.variable);
|
|
45
35
|
|
|
46
36
|
verifies = true;
|
|
47
37
|
}
|
|
48
38
|
}
|
|
49
39
|
|
|
50
40
|
if (verifies) {
|
|
51
|
-
|
|
41
|
+
context.debug(`...verified the '${variableDeclarationString}' variable declaration.`, node);
|
|
52
42
|
}
|
|
53
43
|
|
|
54
44
|
return verifies;
|
|
@@ -57,21 +47,23 @@ export default define(class VariableDeclaration {
|
|
|
57
47
|
verifyVariable() {
|
|
58
48
|
let variableVerifies = false;
|
|
59
49
|
|
|
60
|
-
const
|
|
50
|
+
const node = this.getNode(),
|
|
51
|
+
context = this.getContext(),
|
|
52
|
+
variableString = this.variable.getString();
|
|
61
53
|
|
|
62
|
-
|
|
54
|
+
context.trace(`Verifying the '${variableString}' variable...`, node);
|
|
63
55
|
|
|
64
56
|
const variableIdentifier = this.variable.getIdentifier(),
|
|
65
|
-
variablePresent =
|
|
57
|
+
variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentifier);
|
|
66
58
|
|
|
67
59
|
if (variablePresent) {
|
|
68
|
-
|
|
60
|
+
context.debug(`The '${variableName}' variable is already present.`, node);
|
|
69
61
|
} else {
|
|
70
62
|
variableVerifies = true;
|
|
71
63
|
}
|
|
72
64
|
|
|
73
65
|
if ( variableVerifies) {
|
|
74
|
-
|
|
66
|
+
context.debug(`...verified the '${variableString}' variable.`, node);
|
|
75
67
|
}
|
|
76
68
|
|
|
77
69
|
return variableVerifies;
|
|
@@ -80,22 +72,25 @@ export default define(class VariableDeclaration {
|
|
|
80
72
|
verifyVariableType() {
|
|
81
73
|
let variableTypeVerifies = false;
|
|
82
74
|
|
|
75
|
+
const node = this.getNode(),
|
|
76
|
+
context = this.getContext();
|
|
77
|
+
|
|
83
78
|
let type;
|
|
84
79
|
|
|
85
80
|
type = this.variable.getType();
|
|
86
81
|
|
|
87
82
|
const typeString = type.getString();
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
context.trace(`Verifying the '${typeString}' type...`, node);
|
|
90
85
|
|
|
91
86
|
const nominalTypeName = type.getNominalTypeName();
|
|
92
87
|
|
|
93
|
-
type =
|
|
88
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
94
89
|
|
|
95
90
|
const typePresent = (type !== null)
|
|
96
91
|
|
|
97
92
|
if (!typePresent) {
|
|
98
|
-
|
|
93
|
+
context.debug(`The '${typeString}' type is not present.`, node);
|
|
99
94
|
} else {
|
|
100
95
|
const includeSupertypes = false,
|
|
101
96
|
provisional = type.isProvisional(includeSupertypes),
|
|
@@ -103,8 +98,8 @@ export default define(class VariableDeclaration {
|
|
|
103
98
|
|
|
104
99
|
if (!provisionalMatches) {
|
|
105
100
|
provisional ?
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
context.debug(`The '${typeString}' type is present but not provisional.`, node) :
|
|
102
|
+
context.debug(`The '${typeString}' type is present but provisional.`, node);
|
|
108
103
|
} else {
|
|
109
104
|
this.variable.setType(type);
|
|
110
105
|
|
|
@@ -113,7 +108,7 @@ export default define(class VariableDeclaration {
|
|
|
113
108
|
}
|
|
114
109
|
|
|
115
110
|
if (variableTypeVerifies) {
|
|
116
|
-
|
|
111
|
+
context.debug(`...verified the '${typeString}' type.`, node);
|
|
117
112
|
}
|
|
118
113
|
|
|
119
114
|
return variableTypeVerifies;
|