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.
Files changed (251) hide show
  1. package/lib/assignment/equality.js +2 -2
  2. package/lib/context/file.js +4 -5
  3. package/lib/context/local.js +17 -6
  4. package/lib/context/partial.js +10 -10
  5. package/lib/context/temporary.js +102 -52
  6. package/lib/mixins/step/unify.js +5 -6
  7. package/lib/node/argument.js +4 -4
  8. package/lib/node/assertion/contained.js +6 -6
  9. package/lib/node/assertion/defined.js +6 -6
  10. package/lib/node/assertion/property.js +6 -6
  11. package/lib/node/assertion/satisfies.js +6 -6
  12. package/lib/node/assertion/subproof.js +6 -6
  13. package/lib/node/assertion/type.js +6 -6
  14. package/lib/node/assertion.js +107 -0
  15. package/lib/node/assumption.js +134 -0
  16. package/lib/node/axiom.js +6 -6
  17. package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
  18. package/lib/node/body.js +4 -5
  19. package/lib/node/combinator.js +4 -4
  20. package/lib/node/conclusion.js +4 -4
  21. package/lib/node/conjecture.js +6 -6
  22. package/lib/node/constructor.js +4 -4
  23. package/lib/node/declaration/combinator.js +6 -6
  24. package/lib/node/declaration/complexType.js +6 -6
  25. package/lib/node/declaration/constructor.js +6 -6
  26. package/lib/node/declaration/metavariable.js +6 -6
  27. package/lib/node/declaration/property.js +6 -6
  28. package/lib/node/declaration/simpleType.js +6 -6
  29. package/lib/node/declaration/typePrefix.js +6 -6
  30. package/lib/node/declaration/variable.js +6 -6
  31. package/lib/node/declaration.js +6 -22
  32. package/lib/node/deduction.js +4 -4
  33. package/lib/node/derivation.js +4 -4
  34. package/lib/node/document.js +107 -0
  35. package/lib/node/equality.js +4 -4
  36. package/lib/node/error.js +4 -4
  37. package/lib/node/frame.js +25 -14
  38. package/lib/node/header.js +4 -4
  39. package/lib/node/hypothesis.js +4 -4
  40. package/lib/node/judgement.js +8 -8
  41. package/lib/node/label.js +4 -4
  42. package/lib/node/labels.js +4 -4
  43. package/lib/node/lemma.js +6 -6
  44. package/lib/node/metaArgument.js +4 -4
  45. package/lib/node/metaLemma.js +6 -6
  46. package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
  47. package/lib/node/metaType.js +4 -4
  48. package/lib/node/metatheorem.js +6 -6
  49. package/lib/node/metavariable.js +4 -4
  50. package/lib/node/nonsense.js +4 -4
  51. package/lib/node/parameter.js +4 -4
  52. package/lib/node/parenthesisedLabel.js +4 -4
  53. package/lib/node/parenthesisedLabels.js +4 -4
  54. package/lib/node/placeholder.js +107 -0
  55. package/lib/node/premise.js +4 -4
  56. package/lib/node/procedureCall.js +4 -4
  57. package/lib/node/procedureReference.js +4 -4
  58. package/lib/node/proof.js +4 -4
  59. package/lib/node/property.js +4 -4
  60. package/lib/node/propertyRelation.js +4 -4
  61. package/lib/node/qualification.js +4 -4
  62. package/lib/node/reference.js +4 -4
  63. package/lib/node/rule.js +4 -4
  64. package/lib/node/section.js +4 -4
  65. package/lib/node/signature.js +4 -4
  66. package/lib/node/statement.js +15 -4
  67. package/lib/node/step.js +4 -4
  68. package/lib/node/subDerivation.js +4 -4
  69. package/lib/node/subproof.js +4 -4
  70. package/lib/node/substitution/frame.js +6 -6
  71. package/lib/node/substitution/statement.js +6 -6
  72. package/lib/node/substitution/term.js +6 -6
  73. package/lib/node/substitution.js +107 -0
  74. package/lib/node/supposition.js +4 -4
  75. package/lib/node/term.js +27 -4
  76. package/lib/node/theorem.js +6 -6
  77. package/lib/node/type.js +4 -4
  78. package/lib/node/typePrefix.js +4 -4
  79. package/lib/node/types.js +4 -4
  80. package/lib/node/variable.js +4 -4
  81. package/lib/nominal/parser.js +3 -3
  82. package/lib/nonTerminalNode.js +222 -0
  83. package/lib/nonTerminalNodeMap.js +5 -3
  84. package/lib/ontology/assertion/contained.js +8 -9
  85. package/lib/ontology/assertion/defined.js +9 -10
  86. package/lib/ontology/assertion/satisfies.js +4 -4
  87. package/lib/ontology/assumption.js +379 -0
  88. package/lib/ontology/declaration/combinator.js +75 -33
  89. package/lib/ontology/declaration/complexType.js +110 -63
  90. package/lib/ontology/declaration/constructor.js +81 -38
  91. package/lib/ontology/declaration/metavariable.js +87 -39
  92. package/lib/ontology/declaration/simpleType.js +95 -48
  93. package/lib/ontology/declaration/typePrefix.js +87 -40
  94. package/lib/ontology/declaration/variable.js +87 -39
  95. package/lib/ontology/declaration.js +13 -338
  96. package/lib/ontology/equivalence.js +295 -0
  97. package/lib/ontology/equivalences.js +264 -0
  98. package/lib/ontology/frame.js +49 -54
  99. package/lib/ontology/judgement.js +8 -8
  100. package/lib/ontology/metavariable.js +4 -4
  101. package/lib/ontology/premise.js +14 -5
  102. package/lib/ontology/reference.js +3 -9
  103. package/lib/ontology/rule.js +3 -4
  104. package/lib/ontology/statement.js +28 -24
  105. package/lib/ontology/step.js +2 -3
  106. package/lib/ontology/subproof.js +2 -3
  107. package/lib/ontology/substitution/statement.js +77 -36
  108. package/lib/ontology/substitution/term.js +14 -34
  109. package/lib/ontology/substitution.js +18 -19
  110. package/lib/ontology/substitutions.js +425 -0
  111. package/lib/ontology/supposition.js +14 -5
  112. package/lib/ontology/term.js +33 -36
  113. package/lib/ontology/topLevelAssertion.js +2 -3
  114. package/lib/ontology/topLevelMetaAssertion.js +2 -3
  115. package/lib/ontology/variable.js +1 -34
  116. package/lib/preamble.js +7 -4
  117. package/lib/ruleNames.js +20 -12
  118. package/lib/unifier/intrinsicLevel.js +4 -12
  119. package/lib/unifier/metaLevel.js +14 -22
  120. package/lib/utilities/frame.js +18 -0
  121. package/lib/utilities/statement.js +18 -0
  122. package/lib/utilities/substitutions.js +43 -30
  123. package/lib/utilities/variable.js +5 -17
  124. package/package.json +10 -10
  125. package/src/assignment/equality.js +1 -1
  126. package/src/context/file.js +5 -4
  127. package/src/context/local.js +28 -5
  128. package/src/context/partial.js +9 -14
  129. package/src/context/temporary.js +120 -51
  130. package/src/mixins/step/unify.js +4 -4
  131. package/src/node/argument.js +1 -1
  132. package/src/node/assertion/contained.js +3 -3
  133. package/src/node/assertion/defined.js +3 -3
  134. package/src/node/assertion/property.js +3 -3
  135. package/src/node/assertion/satisfies.js +3 -3
  136. package/src/node/assertion/subproof.js +3 -3
  137. package/src/node/assertion/type.js +3 -3
  138. package/src/node/assertion.js +7 -0
  139. package/src/node/assumption.js +35 -0
  140. package/src/node/axiom.js +3 -3
  141. package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
  142. package/src/node/body.js +1 -3
  143. package/src/node/combinator.js +1 -1
  144. package/src/node/conclusion.js +1 -1
  145. package/src/node/conjecture.js +3 -3
  146. package/src/node/constructor.js +1 -1
  147. package/src/node/declaration/combinator.js +3 -3
  148. package/src/node/declaration/complexType.js +3 -3
  149. package/src/node/declaration/constructor.js +3 -3
  150. package/src/node/declaration/metavariable.js +3 -3
  151. package/src/node/declaration/property.js +3 -3
  152. package/src/node/declaration/simpleType.js +3 -3
  153. package/src/node/declaration/typePrefix.js +3 -3
  154. package/src/node/declaration/variable.js +3 -3
  155. package/src/node/declaration.js +2 -18
  156. package/src/node/deduction.js +1 -1
  157. package/src/node/derivation.js +1 -1
  158. package/src/node/document.js +7 -0
  159. package/src/node/equality.js +1 -1
  160. package/src/node/error.js +1 -1
  161. package/src/node/frame.js +23 -11
  162. package/src/node/header.js +1 -1
  163. package/src/node/hypothesis.js +1 -1
  164. package/src/node/judgement.js +6 -6
  165. package/src/node/label.js +1 -1
  166. package/src/node/labels.js +1 -1
  167. package/src/node/lemma.js +3 -3
  168. package/src/node/metaArgument.js +1 -1
  169. package/src/node/metaLemma.js +3 -3
  170. package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
  171. package/src/node/metaType.js +1 -1
  172. package/src/node/metatheorem.js +3 -3
  173. package/src/node/metavariable.js +1 -1
  174. package/src/node/nonsense.js +1 -1
  175. package/src/node/parameter.js +1 -1
  176. package/src/node/parenthesisedLabel.js +1 -1
  177. package/src/node/parenthesisedLabels.js +1 -1
  178. package/src/node/placeholder.js +7 -0
  179. package/src/node/premise.js +1 -1
  180. package/src/node/procedureCall.js +1 -1
  181. package/src/node/procedureReference.js +1 -1
  182. package/src/node/proof.js +1 -1
  183. package/src/node/property.js +1 -1
  184. package/src/node/propertyRelation.js +1 -1
  185. package/src/node/qualification.js +1 -1
  186. package/src/node/reference.js +1 -1
  187. package/src/node/rule.js +2 -2
  188. package/src/node/section.js +1 -1
  189. package/src/node/signature.js +1 -1
  190. package/src/node/statement.js +13 -1
  191. package/src/node/step.js +1 -1
  192. package/src/node/subDerivation.js +1 -1
  193. package/src/node/subproof.js +1 -1
  194. package/src/node/substitution/frame.js +3 -3
  195. package/src/node/substitution/statement.js +3 -3
  196. package/src/node/substitution/term.js +3 -3
  197. package/src/node/substitution.js +7 -0
  198. package/src/node/supposition.js +1 -1
  199. package/src/node/term.js +27 -1
  200. package/src/node/theorem.js +3 -3
  201. package/src/node/type.js +1 -1
  202. package/src/node/typePrefix.js +1 -1
  203. package/src/node/types.js +1 -1
  204. package/src/node/variable.js +1 -1
  205. package/src/nominal/parser.js +2 -2
  206. package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
  207. package/src/nonTerminalNodeMap.js +10 -5
  208. package/src/ontology/assertion/contained.js +14 -14
  209. package/src/ontology/assertion/defined.js +13 -13
  210. package/src/ontology/assertion/satisfies.js +2 -1
  211. package/src/ontology/assumption.js +385 -0
  212. package/src/ontology/declaration/combinator.js +15 -24
  213. package/src/ontology/declaration/complexType.js +57 -53
  214. package/src/ontology/declaration/constructor.js +25 -31
  215. package/src/ontology/declaration/metavariable.js +25 -30
  216. package/src/ontology/declaration/simpleType.js +34 -38
  217. package/src/ontology/declaration/typePrefix.js +23 -31
  218. package/src/ontology/declaration/variable.js +26 -31
  219. package/src/ontology/declaration.js +8 -372
  220. package/src/{equivalence.js → ontology/equivalence.js} +4 -3
  221. package/src/{equivalences.js → ontology/equivalences.js} +14 -12
  222. package/src/ontology/frame.js +53 -63
  223. package/src/ontology/judgement.js +8 -8
  224. package/src/ontology/metavariable.js +2 -2
  225. package/src/ontology/premise.js +18 -4
  226. package/src/ontology/reference.js +4 -3
  227. package/src/ontology/rule.js +4 -3
  228. package/src/ontology/statement.js +31 -27
  229. package/src/ontology/step.js +2 -2
  230. package/src/ontology/subproof.js +2 -2
  231. package/src/ontology/substitution/statement.js +56 -53
  232. package/src/ontology/substitution/term.js +9 -35
  233. package/src/ontology/substitution.js +11 -15
  234. package/src/{substitutions.js → ontology/substitutions.js} +4 -3
  235. package/src/ontology/supposition.js +18 -4
  236. package/src/ontology/term.js +27 -39
  237. package/src/ontology/topLevelAssertion.js +2 -2
  238. package/src/ontology/topLevelMetaAssertion.js +2 -2
  239. package/src/ontology/variable.js +0 -54
  240. package/src/preamble.js +6 -3
  241. package/src/ruleNames.js +10 -8
  242. package/src/unifier/intrinsicLevel.js +3 -14
  243. package/src/unifier/metaLevel.js +14 -25
  244. package/src/utilities/frame.js +13 -0
  245. package/src/utilities/statement.js +13 -0
  246. package/src/utilities/substitutions.js +59 -31
  247. package/src/utilities/variable.js +1 -10
  248. package/lib/equivalence.js +0 -294
  249. package/lib/equivalences.js +0 -263
  250. package/lib/node/nonTerminal.js +0 -218
  251. 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 ComplexTypeDeclaration {
9
+ export default define(class ComplexTypeDeclaration extends Declaration {
9
10
  constructor(context, node, string, type, prefixed) {
10
- this.context = context;
11
- this.node = node;
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 ComplexTypeDeclaration {
37
25
  verify() {
38
26
  let verifies = false;
39
27
 
40
- const complexTypeDeclarationString = this.string; ///
28
+ const node = this.getNode(),
29
+ context = this.getContext(),
30
+ complexTypeDeclarationString = this.getString(); ///
41
31
 
42
- this.context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`, this.node);
32
+ context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`, node);
43
33
 
44
34
  if (this.prefixed) {
45
35
  const typeString = this.type.getString();
46
36
 
47
- this.context.trace(`The '${typeString}' type is prefixed.`);
37
+ context.trace(`The '${typeString}' type is prefixed.`);
48
38
  } else {
49
39
  const typeVerifies = this.verifyType();
50
40
 
@@ -55,7 +45,7 @@ export default define(class ComplexTypeDeclaration {
55
45
  const propertiesVerify = this.verifyProperties();
56
46
 
57
47
  if (propertiesVerify) {
58
- const typePrefix = this.context.getTypePrefix();
48
+ const typePrefix = context.getTypePrefix();
59
49
 
60
50
  if (typePrefix !== null) {
61
51
  const typePrefixName = typePrefix.getName(),
@@ -64,7 +54,7 @@ export default define(class ComplexTypeDeclaration {
64
54
  this.type.setPrefixName(prefixName);
65
55
  }
66
56
 
67
- this.context.addType(this.type);
57
+ context.addType(this.type);
68
58
 
69
59
  verifies = true;
70
60
  }
@@ -73,7 +63,7 @@ export default define(class ComplexTypeDeclaration {
73
63
  }
74
64
 
75
65
  if (verifies) {
76
- this.context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration.`, this.node);
66
+ context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration.`, node);
77
67
  }
78
68
 
79
69
  return verifies;
@@ -82,30 +72,32 @@ export default define(class ComplexTypeDeclaration {
82
72
  verifyType() {
83
73
  let typeVerifies = false;
84
74
 
85
- const typeString = this.type.getString();
75
+ const node = this.getNode(),
76
+ context = this.getContext(),
77
+ typeString = this.type.getString();
86
78
 
87
- this.context.trace(`Verifying the '${typeString}' complex type...`, this.node);
79
+ context.trace(`Verifying the '${typeString}' complex type...`, node);
88
80
 
89
81
  const typeName = this.type.getName(),
90
82
  includeRelease = true,
91
83
  includeDependencies = false,
92
- typePresent = this.context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
84
+ typePresent = context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
93
85
 
94
86
  if (typePresent) {
95
- this.context.trace(`The '${typeString}' type is already present.`, this.node);
87
+ context.trace(`The '${typeString}' type is already present.`, node);
96
88
  } else {
97
89
  const prefixedTypeName = typeName, ///
98
- typePresent = this.context.isTypePresentByPrefixedTypeName(prefixedTypeName);
90
+ typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
99
91
 
100
92
  if (typePresent) {
101
- this.context.trace(`The '${typeString}' type is already present.`, this.node);
93
+ context.trace(`The '${typeString}' type is already present.`, node);
102
94
  } else {
103
95
  typeVerifies = true;
104
96
  }
105
97
  }
106
98
 
107
99
  if (typeVerifies) {
108
- this.context.trace(`...verified the '${typeString}' complex type.`, this.node);
100
+ context.trace(`...verified the '${typeString}' complex type.`, node);
109
101
  }
110
102
 
111
103
  return typeVerifies;
@@ -114,20 +106,22 @@ export default define(class ComplexTypeDeclaration {
114
106
  verifySuperType(superType) {
115
107
  let superTypeVerifies = false;
116
108
 
117
- const superTypeString = superType.getString();
109
+ const node = this.getNode(),
110
+ context = this.getContext(),
111
+ superTypeString = superType.getString();
118
112
 
119
- this.context.trace(`Verifying the '${superTypeString}' super-type...`, this.node);
113
+ context.trace(`Verifying the '${superTypeString}' super-type...`, node);
120
114
 
121
115
  const nominalTypeName = superType.getNominalTypeName(),
122
116
  typeName = nominalTypeName, ///
123
117
  typeNameMatches = this.type.matchTypeName(typeName);
124
118
 
125
119
  if (typeNameMatches) {
126
- this.context.trace(`The super-type's name matches the ${typeName}' complex type's name.`, this.node);
120
+ context.trace(`The super-type's name matches the ${typeName}' complex type's name.`, node);
127
121
  } else {
128
122
  const oldSuperType = superType;
129
123
 
130
- superType = this.context.findTypeByNominalTypeName(nominalTypeName);
124
+ superType = context.findTypeByNominalTypeName(nominalTypeName);
131
125
 
132
126
  const superTypePresent = (superType !== null);
133
127
 
@@ -141,7 +135,7 @@ export default define(class ComplexTypeDeclaration {
141
135
  }
142
136
 
143
137
  if (superTypeVerifies) {
144
- this.context.debug(`...verified the '${superTypeString}' super-type.`, this.node);
138
+ context.debug(`...verified the '${superTypeString}' super-type.`, node);
145
139
  }
146
140
 
147
141
  return superTypeVerifies;
@@ -150,16 +144,18 @@ export default define(class ComplexTypeDeclaration {
150
144
  verifySuperTypes() {
151
145
  let superTypesVerify;
152
146
 
153
- const typeString = this.type.getString();
147
+ const node = this.getNode(),
148
+ context = this.getContext(),
149
+ typeString = this.type.getString();
154
150
 
155
- this.context.trace(`Verifying the '${typeString}' complex type's super-types...`, this.node);
151
+ context.trace(`Verifying the '${typeString}' complex type's super-types...`, node);
156
152
 
157
153
  const typeBasic = this.type.isBasic();
158
154
 
159
155
  if (typeBasic) {
160
156
  superTypesVerify = true;
161
157
 
162
- this.context.trace(`The '${typeString}' complex type is basic.`, this.node)
158
+ context.trace(`The '${typeString}' complex type is basic.`, node)
163
159
  } else {
164
160
  const superTypes = this.type.getSuperTypes();
165
161
 
@@ -173,7 +169,7 @@ export default define(class ComplexTypeDeclaration {
173
169
  }
174
170
 
175
171
  if (superTypesVerify) {
176
- this.context.debug(`...verified the '${typeString}' complex type's super-types.`, this.node);
172
+ context.debug(`...verified the '${typeString}' complex type's super-types.`, node);
177
173
  }
178
174
 
179
175
  return superTypesVerify;
@@ -182,9 +178,11 @@ export default define(class ComplexTypeDeclaration {
182
178
  verifyProperty(property, properties) {
183
179
  let propertyVerifies = false;
184
180
 
185
- const propertyString = property.getString();
181
+ const node = this.getNode(),
182
+ context = this.getContext(),
183
+ propertyString = property.getString();
186
184
 
187
- this.context.trace(`Verifying the '${propertyString}' property...`, this.node);
185
+ context.trace(`Verifying the '${propertyString}' property...`, node);
188
186
 
189
187
  const propertyNameVerifies = this.verifyPropertyName(property, properties);
190
188
 
@@ -197,7 +195,7 @@ export default define(class ComplexTypeDeclaration {
197
195
  }
198
196
 
199
197
  if (propertyVerifies) {
200
- this.context.debug(`...verified the '${propertyString}' property.`, this.node);
198
+ context.debug(`...verified the '${propertyString}' property.`, node);
201
199
  }
202
200
 
203
201
  return propertyVerifies;
@@ -206,9 +204,11 @@ export default define(class ComplexTypeDeclaration {
206
204
  verifyProperties() {
207
205
  let propertiesVerify;
208
206
 
209
- const typeString = this.type.getString();
207
+ const node = this.getNode(),
208
+ context = this.getContext(),
209
+ typeString = this.type.getString();
210
210
 
211
- this.context.trace(`Verifying the '${typeString}' complex type's properties...`, this.node);
211
+ context.trace(`Verifying the '${typeString}' complex type's properties...`, node);
212
212
 
213
213
  const includeSuperTypes = false,
214
214
  properties = this.type.getProperties(includeSuperTypes);
@@ -222,7 +222,7 @@ export default define(class ComplexTypeDeclaration {
222
222
  });
223
223
 
224
224
  if (propertiesVerify) {
225
- this.context.debug(`...verified the '${typeString}' complex type's properties.`, this.node);
225
+ context.debug(`...verified the '${typeString}' complex type's properties.`, node);
226
226
  }
227
227
 
228
228
  return propertiesVerify;
@@ -231,9 +231,11 @@ export default define(class ComplexTypeDeclaration {
231
231
  verifyPropertyName(property, properties) {
232
232
  let propertyNameVerifies = false;
233
233
 
234
- const propertyString = property.getString();
234
+ const node = this.getNode(),
235
+ context = this.getContext(),
236
+ propertyString = property.getString();
235
237
 
236
- this.context.trace(`Verifying the '${propertyString}' property's name...`, this.node);
238
+ context.trace(`Verifying the '${propertyString}' property's name...`, node);
237
239
 
238
240
  const propertyName = property.getName(),
239
241
  count = properties.reduce((count, property) => {
@@ -247,7 +249,7 @@ export default define(class ComplexTypeDeclaration {
247
249
  }, 0);
248
250
 
249
251
  if (count > 1) {
250
- this.context.debug(`The '${propertyString}' property appears more than once.`, this.node);
252
+ context.debug(`The '${propertyString}' property appears more than once.`, node);
251
253
  } else {
252
254
  const superTypes = this.type.getSuperTypes(),
253
255
  superType = superTypes.find((superType) => {
@@ -268,14 +270,14 @@ export default define(class ComplexTypeDeclaration {
268
270
  if (superType !== null) {
269
271
  const superTypeString = superType.getString();
270
272
 
271
- this.context.debug(`The '${superTypeString}' super-type has the same property.`, this.node);
273
+ context.debug(`The '${superTypeString}' super-type has the same property.`, node);
272
274
  } else {
273
275
  propertyNameVerifies = true;
274
276
  }
275
277
  }
276
278
 
277
279
  if (propertyNameVerifies) {
278
- this.context.debug(`...verified the '${propertyString}' property's name.`, this.node);
280
+ context.debug(`...verified the '${propertyString}' property's name.`, node);
279
281
  }
280
282
 
281
283
  return propertyNameVerifies;
@@ -284,17 +286,19 @@ export default define(class ComplexTypeDeclaration {
284
286
  verifyPropertyNominalTypeName(property) {
285
287
  let propertyNominalTypeNameVerifies = false;
286
288
 
287
- const propertyString = property.getString(),
289
+ const node = this.getNode(),
290
+ context = this.getContext(),
291
+ propertyString = property.getString(),
288
292
  nominalTypeName = property.getNominalTypeName();
289
293
 
290
- this.context.trace(`Verifying the '${propertyString}' property's '${nominalTypeName}' nominal type name...`, this.node);
294
+ context.trace(`Verifying the '${propertyString}' property's '${nominalTypeName}' nominal type name...`, node);
291
295
 
292
296
  const nominalTypeNameMatches = this.type.matchNominalTypeName(nominalTypeName);
293
297
 
294
298
  if (nominalTypeNameMatches) {
295
299
  propertyNominalTypeNameVerifies = true;
296
300
  } else {
297
- const typePresent = this.context.isTypePresentByNominalTypeName(nominalTypeName);
301
+ const typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
298
302
 
299
303
  if (typePresent) {
300
304
  propertyNominalTypeNameVerifies = true;
@@ -302,7 +306,7 @@ export default define(class ComplexTypeDeclaration {
302
306
  }
303
307
 
304
308
  if (propertyNominalTypeNameVerifies) {
305
- this.context.debug(`...verifies the '${propertyString}' property's '${nominalTypeName}' nominal type name.`, this.node);
309
+ context.debug(`...verifies the '${propertyString}' property's '${nominalTypeName}' nominal type name.`, node);
306
310
  }
307
311
 
308
312
  return propertyNominalTypeNameVerifies;
@@ -1,29 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../../ontology";
4
-
4
+ import Declaration from "../declaration";
5
5
  import constructorVerifier from "../../verifier/constructor";
6
6
 
7
7
  import { define } from "../../ontology";
8
8
 
9
- export default define(class ConstructorDeclaration {
9
+ export default define(class ConstructorDeclaration extends Declaration {
10
10
  constructor(context, node, string, constructor) {
11
- this.context = context;
12
- this.node = node;
13
- this.string = string;
14
- this.constructor = constructor;
15
- }
16
-
17
- getContext() {
18
- return this.context;
19
- }
11
+ super(context, node, string);
20
12
 
21
- getNode() {
22
- return this.node;
23
- }
24
-
25
- getString() {
26
- return this.string;
13
+ this.constructor = constructor;
27
14
  }
28
15
 
29
16
  getConstructor() {
@@ -33,9 +20,11 @@ export default define(class ConstructorDeclaration {
33
20
  verify() {
34
21
  let verifies;
35
22
 
36
- const constructorDeclarationString = this.string; ///
23
+ const node = this.getNode(),
24
+ context = this.getContext(),
25
+ constructorDeclarationString = this.getString(); ///
37
26
 
38
- this.context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`, this.node);
27
+ context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`, node);
39
28
 
40
29
  const constructorTypeVerifies = this.verifyConstructorType();
41
30
 
@@ -43,14 +32,14 @@ export default define(class ConstructorDeclaration {
43
32
  const constructorVerifies = this.verifyConstructor();
44
33
 
45
34
  if (constructorVerifies) {
46
- this.context.addConstructor(this.constructor);
35
+ context.addConstructor(this.constructor);
47
36
 
48
37
  verifies = true;
49
38
  }
50
39
  }
51
40
 
52
41
  if (verifies) {
53
- this.context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`, this.node);
42
+ context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`, node);
54
43
  }
55
44
 
56
45
  return verifies;
@@ -59,17 +48,19 @@ export default define(class ConstructorDeclaration {
59
48
  verifyConstructor() {
60
49
  let constructorVerifies;
61
50
 
62
- const constructorString = this.constructor.getString();
51
+ const node = this.getNode(),
52
+ context = this.getContext(),
53
+ constructorString = this.constructor.getString();
63
54
 
64
- this.context.trace(`Verifying the '${constructorString}' constructor...`, this.node);
55
+ context.trace(`Verifying the '${constructorString}' constructor...`, node);
65
56
 
66
57
  const term = this.constructor.getTerm(),
67
58
  termNode = term.getNode();
68
59
 
69
- constructorVerifies = constructorVerifier.verifyTerm(termNode, this.context);
60
+ constructorVerifies = constructorVerifier.verifyTerm(termNode, context);
70
61
 
71
62
  if (constructorVerifies) {
72
- this.context.debug(`...verified the '${constructorString}' constructor.`, this.node);
63
+ context.debug(`...verified the '${constructorString}' constructor.`, node);
73
64
  }
74
65
 
75
66
  return constructorVerifies;
@@ -78,22 +69,25 @@ export default define(class ConstructorDeclaration {
78
69
  verifyConstructorType() {
79
70
  let constructorTypeVerifies = false;
80
71
 
72
+ const node = this.getNode(),
73
+ context = this.getContext();
74
+
81
75
  let type;
82
76
 
83
77
  type = this.constructor.getType();
84
78
 
85
79
  const typeString = type.getString();
86
80
 
87
- this.context.trace(`Verifying the '${typeString}' type...`, this.node);
81
+ context.trace(`Verifying the '${typeString}' type...`, node);
88
82
 
89
83
  const nominalTypeName = type.getNominalTypeName();
90
84
 
91
- type = this.context.findTypeByNominalTypeName(nominalTypeName);
85
+ type = context.findTypeByNominalTypeName(nominalTypeName);
92
86
 
93
87
  const typePresent = (type !== null)
94
88
 
95
89
  if (!typePresent) {
96
- this.context.debug(`The '${typeString}' type is not present.`, this.node);
90
+ context.debug(`The '${typeString}' type is not present.`, node);
97
91
  } else {
98
92
  const includeSupertypes = false,
99
93
  provisional = type.isProvisional(includeSupertypes),
@@ -101,8 +95,8 @@ export default define(class ConstructorDeclaration {
101
95
 
102
96
  if (!provisionalMatches) {
103
97
  provisional ?
104
- this.context.debug(`The '${typeString}' type is present but not provisional.`, this.node) :
105
- this.context.debug(`The '${typeString}' type is present but provisional.`, this.node);
98
+ context.debug(`The '${typeString}' type is present but not provisional.`, node) :
99
+ context.debug(`The '${typeString}' type is present but provisional.`, node);
106
100
  } else {
107
101
  this.constructor.setType(type);
108
102
 
@@ -111,7 +105,7 @@ export default define(class ConstructorDeclaration {
111
105
  }
112
106
 
113
107
  if (constructorTypeVerifies) {
114
- this.context.debug(`...verified the '${typeString}' type.`, this.node);
108
+ context.debug(`...verified the '${typeString}' type.`, node);
115
109
  }
116
110
 
117
111
  return constructorTypeVerifies;
@@ -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 MetavariableDeclaration {
8
+ export default define(class MetavariableDeclaration extends Declaration {
8
9
  constructor(context, node, string, metavariable) {
9
- this.context = context;
10
- this.node = node;
11
- this.string = string;
12
- this.metavariable = metavariable;
13
- }
14
-
15
- getContext() {
16
- return this.context;
17
- }
10
+ super(context, node, string);
18
11
 
19
- getNode() {
20
- return this.node;
21
- }
22
-
23
- getString() {
24
- return this.string;
12
+ this.metavariable = metavariable;
25
13
  }
26
14
 
27
15
  getMetavariable() {
@@ -31,20 +19,22 @@ export default define(class MetavariableDeclaration {
31
19
  verify() {
32
20
  let verifies;
33
21
 
34
- const metavariableDeclarationString = this.string; ///
22
+ const node = this.getNode(),
23
+ context = this.getContext(),
24
+ metavariableDeclarationString = this.getString(); ///
35
25
 
36
- this.context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`, this.node);
26
+ context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`, node);
37
27
 
38
28
  const metavariableVerifies = this.verifyMetavariable(this.metavariable);
39
29
 
40
30
  if (metavariableVerifies) {
41
- this.context.addMetavariable(this.metavariable);
31
+ context.addMetavariable(this.metavariable);
42
32
 
43
33
  verifies = true;
44
34
  }
45
35
 
46
36
  if (verifies) {
47
- this.context.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration.`, this.node);
37
+ context.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration.`, node);
48
38
  }
49
39
 
50
40
  return verifies;
@@ -53,24 +43,27 @@ export default define(class MetavariableDeclaration {
53
43
  verifyType(type) {
54
44
  let typeVerifies;
55
45
 
46
+ const node = this.getNode(),
47
+ context = this.getContext();
48
+
56
49
  if (type === null) {
57
50
  typeVerifies = true;
58
51
  } else {
59
52
  const typeString = type.getString();
60
53
 
61
- this.context.trace(`Verifying the '${typeString}' type...`, this.node);
54
+ context.trace(`Verifying the '${typeString}' type...`, node);
62
55
 
63
56
  const nominalTypeName = type.getNominalTypeName(),
64
- typePresent = this.context.isTypePresentByNominalTypeName(nominalTypeName);
57
+ typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
65
58
 
66
59
  if (!typePresent) {
67
- this.context.debug(`The '${typeString}' type is not present.`, this.node);
60
+ context.debug(`The '${typeString}' type is not present.`, node);
68
61
  } else {
69
62
  typeVerifies = true;
70
63
  }
71
64
 
72
65
  if (typeVerifies) {
73
- this.context.debug(`...verified the '${typeString}' type.`, this.node);
66
+ context.debug(`...verified the '${typeString}' type.`, node);
74
67
  }
75
68
  }
76
69
 
@@ -80,21 +73,23 @@ export default define(class MetavariableDeclaration {
80
73
  verifyMetavariable(metavariable) {
81
74
  let metavariableVerifies = false;
82
75
 
83
- const metavariableString = metavariable.getString();
76
+ const node = this.getNode(),
77
+ context = this.getContext(),
78
+ metavariableString = metavariable.getString();
84
79
 
85
- this.context.trace(`Verifying the '${metavariableString}' metavariable when declared...`, this.node);
80
+ context.trace(`Verifying the '${metavariableString}' metavariable when declared...`, node);
86
81
 
87
82
  const metavariableNode = metavariable.getNode(), ///
88
83
  termNode = metavariableNode.getTermNode();
89
84
 
90
85
  if (termNode !== null) {
91
- this.context.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`, this.node);
86
+ context.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`, node);
92
87
  } else {
93
88
  const metavariableName = metavariable.getName(),
94
- metavariablePresent = this.context.isMetavariablePresentByMetavariableName(metavariableName);
89
+ metavariablePresent = context.isMetavariablePresentByMetavariableName(metavariableName);
95
90
 
96
91
  if (metavariablePresent) {
97
- this.context.debug(`The '${metavariableName}' metavariable is already present.`, this.node);
92
+ context.debug(`The '${metavariableName}' metavariable is already present.`, node);
98
93
  } else {
99
94
  const type = metavariable.getType(),
100
95
  typeVerifies = this.verifyType(type);
@@ -104,7 +99,7 @@ export default define(class MetavariableDeclaration {
104
99
  }
105
100
 
106
101
  if (metavariableVerifies) {
107
- this.context.debug(`...verified the '${metavariableString}' metavariable when declared.`, this.node);
102
+ context.debug(`...verified the '${metavariableString}' metavariable when declared.`, node);
108
103
  }
109
104
 
110
105
  return metavariableVerifies;