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 SimpleTypeDeclaration {
9
+ export default define(class SimpleTypeDeclaration 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 SimpleTypeDeclaration {
37
25
  verify() {
38
26
  let verifies = false;
39
27
 
40
- const simpleTypeDeclarationString = this.string; ///
28
+ const node = this.getNode(),
29
+ context = this.getContext(),
30
+ simpleTypeDeclarationString = this.getString(); ///
41
31
 
42
- this.context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration...`, this.node);
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
- 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
 
@@ -52,7 +42,7 @@ export default define(class SimpleTypeDeclaration {
52
42
  const superTypesVerify = this.verifySuperTypes();
53
43
 
54
44
  if (superTypesVerify) {
55
- const typePrefix = this.context.getTypePrefix();
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
- this.context.addType(this.type);
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
- this.context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration.`, this.node);
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 typeString = this.type.getString();
71
+ const node = this.getNode(),
72
+ context = this.getContext(),
73
+ typeString = this.type.getString();
82
74
 
83
- this.context.trace(`Verifying the '${typeString}' simple type...`, this.node);
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 = this.context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
80
+ typePresent = context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
89
81
 
90
82
  if (typePresent) {
91
- this.context.trace(`The '${typeString}' type is already present.`, this.node);
83
+ context.trace(`The '${typeString}' type is already present.`, node);
92
84
  } else {
93
85
  const prefixedTypeName = typeName, ///
94
- typePresent = this.context.isTypePresentByPrefixedTypeName(prefixedTypeName);
86
+ typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
95
87
 
96
88
  if (typePresent) {
97
- this.context.trace(`The '${typeString}' type is already present.`, this.node);
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
- this.context.trace(`...verified the '${typeString}' simple type.`, this.node);
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 superTypeString = superType.getString();
105
+ const node = this.getNode(),
106
+ context = this.getContext(),
107
+ superTypeString = superType.getString();
114
108
 
115
- this.context.trace(`Verifying the '${superTypeString}' super-type...`, this.node);
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
- this.context.trace(`The super-type's name matches the ${typeName}' simple type's name.`, this.node);
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 = this.context.findTypeByNominalTypeName(nominalTypeName);
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
- this.context.debug(`...verified the '${superTypeString}' super-type.`, this.node);
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 typeString = this.type.getString();
143
+ const node = this.getNode(),
144
+ context = this.getContext(),
145
+ typeString = this.type.getString();
150
146
 
151
- this.context.trace(`Verifying the '${typeString}' simple type's super-types...`, this.node);
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
- this.context.trace(`The '${typeString}' simple type is basic.`, this.node)
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
- this.context.debug(`...verified the '${typeString}' simple type's super-types.`, this.node);
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
- this.context = context;
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
- getNode() {
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 typePrefixDeclarationString = this.string; ///
22
+ const node = this.getNode(),
23
+ context = this.getContext(),
24
+ typePrefixDeclarationString = this.getString(); ///
35
25
 
36
- this.context.trace(`Verifying the '${typePrefixDeclarationString}' type prefix declaration...`, this.node);
26
+ context.trace(`Verifying the '${typePrefixDeclarationString}' type prefix declaration...`, node);
37
27
 
38
28
  const includeRelease = true,
39
29
  includeDependencies = false,
40
- types = this.context.getTypes(includeRelease, includeDependencies),
30
+ types = context.getTypes(includeRelease, includeDependencies),
41
31
  typesLength = types.length;
42
32
 
43
33
  if (typesLength > 0) {
44
- this.context.debug(`Cannot verify the '${typePrefixDeclarationString}' type prefix declaration because types have already been declared.`, this.node);
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
- this.context.addTypePrefix(this.typePrefix);
39
+ context.addTypePrefix(this.typePrefix);
50
40
 
51
41
  verifies = true;
52
42
  }
53
43
  }
54
44
 
55
45
  if (verifies) {
56
- this.context.debug(`...verified the '${typePrefixDeclarationString}' type prefix declaration.`, this.node);
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 typePrefixString = this.typePrefix.getString();
55
+ const node = this.getNode(),
56
+ context = this.getContext(),
57
+ typePrefixString = this.typePrefix.getString();
66
58
 
67
- this.context.trace(`Verifying the '${typePrefixString}' type prefix...`, this.node);
59
+ context.trace(`Verifying the '${typePrefixString}' type prefix...`, node);
68
60
 
69
- const typePrefix = this.context.getTypePrefix();
61
+ const typePrefix = context.getTypePrefix();
70
62
 
71
63
  if (typePrefix !== null) {
72
- this.context.trace(`The package already has a '${typePrefixString}' type prefix.`, this.node);
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 = this.context.isTypePrefixPresentByTypePrefixName(typePrefixName);
68
+ typePrefixPresent = context.isTypePrefixPresentByTypePrefixName(typePrefixName);
77
69
 
78
70
  if (typePrefixPresent) {
79
- this.context.trace(`The '${typePrefixString}' type prefix is already present.`, this.node);
71
+ context.trace(`The '${typePrefixString}' type prefix is already present.`, node);
80
72
  } else {
81
73
  const nominalTypeName = typePrefixName, ///
82
- typePresent = this.context.isTypePresentByNominalTypeName(nominalTypeName);
74
+ typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
83
75
 
84
76
  if (typePresent) {
85
- this.context.trace(`The '${typePrefixString}' type is already present.`, this.node);
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
- this.context.debug(`...verified the '${typePrefixString}' type prefix.`, this.node);
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
- this.context = context;
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
- getNode() {
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 variableDeclarationString = this.getString();
22
+ const node = this.getNode(),
23
+ context = this.getContext(),
24
+ variableDeclarationString = this.getString(); ///
35
25
 
36
- this.context.trace(`Verifying the '${variableDeclarationString}' variable declaration...`, this.node);
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
- this.context.addVariable(this.variable);
34
+ context.addVariable(this.variable);
45
35
 
46
36
  verifies = true;
47
37
  }
48
38
  }
49
39
 
50
40
  if (verifies) {
51
- this.context.debug(`...verified the '${variableDeclarationString}' variable declaration.`, this.node);
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 variableString = this.variable.getString();
50
+ const node = this.getNode(),
51
+ context = this.getContext(),
52
+ variableString = this.variable.getString();
61
53
 
62
- this.context.trace(`Verifying the '${variableString}' variable...`, this.node);
54
+ context.trace(`Verifying the '${variableString}' variable...`, node);
63
55
 
64
56
  const variableIdentifier = this.variable.getIdentifier(),
65
- variablePresent = this.context.isVariablePresentByVariableIdentifier(variableIdentifier);
57
+ variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentifier);
66
58
 
67
59
  if (variablePresent) {
68
- this.context.debug(`The '${variableName}' variable is already present.`, this.node);
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
- this.context.debug(`...verified the '${variableString}' variable.`, this.node);
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
- this.context.trace(`Verifying the '${typeString}' type...`, this.node);
84
+ context.trace(`Verifying the '${typeString}' type...`, node);
90
85
 
91
86
  const nominalTypeName = type.getNominalTypeName();
92
87
 
93
- type = this.context.findTypeByNominalTypeName(nominalTypeName);
88
+ type = context.findTypeByNominalTypeName(nominalTypeName);
94
89
 
95
90
  const typePresent = (type !== null)
96
91
 
97
92
  if (!typePresent) {
98
- this.context.debug(`The '${typeString}' type is not present.`, this.node);
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
- this.context.debug(`The '${typeString}' type is present but not provisional.`, this.node) :
107
- this.context.debug(`The '${typeString}' type is present but provisional.`, this.node);
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
- this.context.debug(`...verified the '${typeString}' type.`, this.node);
111
+ context.debug(`...verified the '${typeString}' type.`, node);
117
112
  }
118
113
 
119
114
  return variableTypeVerifies;