occam-verify-cli 0.0.539 → 0.0.541

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 (62) hide show
  1. package/bin/utilities/releaseContext.js +30 -40
  2. package/lib/axiom.js +4 -4
  3. package/lib/axiomLemmaTheoremConjecture.js +6 -6
  4. package/lib/combinator.js +4 -4
  5. package/lib/conclusion.js +4 -4
  6. package/lib/conjecture.js +4 -4
  7. package/lib/constructor.js +6 -6
  8. package/lib/context/file.js +185 -78
  9. package/lib/context/metaproof.js +3 -3
  10. package/lib/context/release.js +222 -3
  11. package/lib/index.js +1 -9
  12. package/lib/kinds.js +9 -1
  13. package/lib/label.js +4 -4
  14. package/lib/lemma.js +4 -4
  15. package/lib/metaType.js +9 -7
  16. package/lib/metavariable.js +32 -1
  17. package/lib/premise.js +4 -4
  18. package/lib/rule.js +7 -7
  19. package/lib/ruleNames.js +16 -4
  20. package/lib/supposition.js +4 -4
  21. package/lib/theorem.js +4 -4
  22. package/lib/type.js +14 -14
  23. package/lib/utilities/node.js +31 -3
  24. package/lib/utilities/releaseContext.js +6 -5
  25. package/lib/variable.js +32 -1
  26. package/lib/verifier.js +1 -1
  27. package/lib/verify/file.js +2 -2
  28. package/lib/verify/metastatement.js +147 -3
  29. package/lib/verify/statement.js +2 -2
  30. package/package.json +3 -3
  31. package/src/axiom.js +1 -1
  32. package/src/axiomLemmaTheoremConjecture.js +4 -4
  33. package/src/combinator.js +3 -3
  34. package/src/conclusion.js +3 -3
  35. package/src/conjecture.js +1 -1
  36. package/src/constructor.js +5 -5
  37. package/src/context/file.js +161 -28
  38. package/src/context/metaproof.js +1 -1
  39. package/src/context/release.js +266 -3
  40. package/src/index.js +0 -2
  41. package/src/kinds.js +2 -0
  42. package/src/label.js +3 -3
  43. package/src/lemma.js +1 -1
  44. package/src/metaType.js +8 -5
  45. package/src/metavariable.js +36 -0
  46. package/src/premise.js +3 -3
  47. package/src/rule.js +5 -5
  48. package/src/ruleNames.js +4 -1
  49. package/src/supposition.js +3 -3
  50. package/src/theorem.js +1 -1
  51. package/src/type.js +13 -13
  52. package/src/utilities/node.js +57 -2
  53. package/src/utilities/releaseContext.js +4 -2
  54. package/src/variable.js +36 -0
  55. package/src/verifier.js +1 -1
  56. package/src/verify/file.js +1 -1
  57. package/src/verify/metastatement.js +65 -2
  58. package/src/verify/statement.js +2 -2
  59. package/lib/context/release/directory.js +0 -313
  60. package/lib/context/release/file.js +0 -387
  61. package/src/context/release/directory.js +0 -251
  62. package/src/context/release/file.js +0 -312
@@ -2,20 +2,25 @@
2
2
 
3
3
  import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
4
4
 
5
- import { combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
5
+ import FileContext from "./file";
6
+
7
+ import { push } from "../utilities/array";
8
+ import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
6
9
 
7
10
  const { florenceLexerFromCombinedCustomGrammar } = lexersUtilities,
8
11
  { florenceParserFromCombinedCustomGrammar } = parsersUtilities;
9
12
 
10
13
  export default class ReleaseContext {
11
- constructor(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts) {
14
+ constructor(log, json, name, entries, lexer, parser, verified, customGrammar, fileContexts, dependencyReleaseContexts) {
12
15
  this.log = log;
16
+ this.json = json;
13
17
  this.name = name;
14
18
  this.entries = entries;
15
19
  this.lexer = lexer;
16
20
  this.parser = parser;
17
21
  this.verified = verified;
18
22
  this.customGrammar = customGrammar;
23
+ this.fileContexts = fileContexts;
19
24
  this.dependencyReleaseContexts = dependencyReleaseContexts;
20
25
  }
21
26
 
@@ -23,6 +28,10 @@ export default class ReleaseContext {
23
28
  return log;
24
29
  }
25
30
 
31
+ getJSON() {
32
+ return this.json;
33
+ }
34
+
26
35
  getName() {
27
36
  return this.name;
28
37
  }
@@ -47,10 +56,223 @@ export default class ReleaseContext {
47
56
  return this.customGrammar;
48
57
  }
49
58
 
59
+ getFileContexts() {
60
+ return this.fileContexts;
61
+ }
62
+
50
63
  getDependencyReleaseContexts() {
51
64
  return this.dependencyReleaseContexts;
52
65
  }
53
66
 
67
+ getLabels(includeDependencies = true) {
68
+ const labels = [];
69
+
70
+ this.fileContexts.forEach((fileContext) => {
71
+ const includeRelease = false,
72
+ fileContextLabels = fileContext.getLabels(includeRelease);
73
+
74
+ push(labels, fileContextLabels);
75
+ });
76
+
77
+ if (includeDependencies) {
78
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
79
+
80
+ dependencyReleaseContexts.forEach((releaseContext) => {
81
+ const includeDependencies = false,
82
+ releaseContextLabels = releaseContext.getLabels(includeDependencies);
83
+
84
+ push(labels, releaseContextLabels);
85
+ });
86
+ }
87
+
88
+ return labels;
89
+ }
90
+
91
+ getTypes(includeDependencies = true) {
92
+ const types = [];
93
+
94
+ this.fileContexts.forEach((fileContext) => {
95
+ const includeRelease = false,
96
+ fileContextTypes = fileContext.getTypes(includeRelease);
97
+
98
+ push(types, fileContextTypes);
99
+ });
100
+
101
+ if (includeDependencies) {
102
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
103
+
104
+ dependencyReleaseContexts.forEach((releaseContext) => {
105
+ const includeDependencies = false,
106
+ releaseContextTypes = releaseContext.getTypes(includeDependencies);
107
+
108
+ push(types, releaseContextTypes);
109
+ });
110
+ }
111
+
112
+ return types;
113
+ }
114
+
115
+ getRules(includeDependencies = true) {
116
+ const rules = [];
117
+
118
+ this.fileContexts.forEach((fileContext) => {
119
+ const includeRelease = false,
120
+ fileContextRules = fileContext.getRules(includeRelease);
121
+
122
+ push(rules, fileContextRules);
123
+ });
124
+
125
+ if (includeDependencies) {
126
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
127
+
128
+ dependencyReleaseContexts.forEach((releaseContext) => {
129
+ const includeDependencies = false,
130
+ releaseContextRules = releaseContext.getRules(includeDependencies);
131
+
132
+ push(rules, releaseContextRules);
133
+ });
134
+ }
135
+
136
+ return rules;
137
+ }
138
+
139
+ getAxioms(includeDependencies = true) {
140
+ const axioms = [];
141
+
142
+ this.fileContexts.forEach((fileContext) => {
143
+ const includeRelease = false,
144
+ fileContextAxioms = fileContext.getAxioms(includeRelease);
145
+
146
+ push(axioms, fileContextAxioms);
147
+ });
148
+
149
+ if (includeDependencies) {
150
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
151
+
152
+ dependencyReleaseContexts.forEach((releaseContext) => {
153
+ const includeDependencies = false,
154
+ releaseContextAxioms = releaseContext.getAxioms(includeDependencies);
155
+
156
+ push(axioms, releaseContextAxioms);
157
+ });
158
+ }
159
+
160
+ return axioms;
161
+ }
162
+
163
+ getLemmas(includeDependencies = true) {
164
+ const lemmas = [];
165
+
166
+ this.fileContexts.forEach((fileContext) => {
167
+ const includeRelease = false,
168
+ fileContextLemmas = fileContext.getLemmas(includeRelease);
169
+
170
+ push(lemmas, fileContextLemmas);
171
+ });
172
+
173
+ return lemmas;
174
+ }
175
+
176
+ getTheorems(includeDependencies = true) {
177
+ const theorems = [];
178
+
179
+ this.fileContexts.forEach((fileContext) => {
180
+ const includeRelease = false,
181
+ fileContextTheorems = fileContext.getTheorems(includeRelease);
182
+
183
+ push(theorems, fileContextTheorems);
184
+ });
185
+
186
+ if (includeDependencies) {
187
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
188
+
189
+ dependencyReleaseContexts.forEach((releaseContext) => {
190
+ const includeDependencies = false,
191
+ releaseContextTheorems = releaseContext.getTheorems(includeDependencies);
192
+
193
+ push(theorems, releaseContextTheorems);
194
+ });
195
+ }
196
+
197
+ return theorems;
198
+ }
199
+
200
+ getConjectures(includeDependencies = true) {
201
+ const conjectures = [];
202
+
203
+ this.fileContexts.forEach((fileContext) => {
204
+ const includeRelease = false,
205
+ fileContextConjectures = fileContext.getConjectures(includeRelease);
206
+
207
+ push(conjectures, fileContextConjectures);
208
+ });
209
+
210
+ if (includeDependencies) {
211
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
212
+
213
+ dependencyReleaseContexts.forEach((releaseContext) => {
214
+ const includeDependencies = false,
215
+ releaseContextConjectures = releaseContext.getConjectures(includeDependencies);
216
+
217
+ push(conjectures, releaseContextConjectures);
218
+ });
219
+ }
220
+
221
+ return conjectures;
222
+ }
223
+
224
+ getCombinators(includeDependencies = true) {
225
+ const combinators = [];
226
+
227
+ this.fileContexts.forEach((fileContext) => {
228
+ const includeRelease = false,
229
+ fileContextCombinators = fileContext.getCombinators(includeRelease);
230
+
231
+ push(combinators, fileContextCombinators);
232
+ });
233
+
234
+ if (includeDependencies) {
235
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
236
+
237
+ dependencyReleaseContexts.forEach((releaseContext) => {
238
+ const includeDependencies = false,
239
+ releaseContextCombinators = releaseContext.getCombinators(includeDependencies);
240
+
241
+ push(combinators, releaseContextCombinators);
242
+ });
243
+ }
244
+
245
+ return combinators;
246
+ }
247
+
248
+ getConstructors(includeDependencies = true) {
249
+ const constructors = [];
250
+
251
+ this.fileContexts.forEach((fileContext) => {
252
+ const includeRelease = false,
253
+ fileContextConstructors = fileContext.getConstructors(includeRelease);
254
+
255
+ push(constructors, fileContextConstructors);
256
+ });
257
+
258
+ if (includeDependencies) {
259
+ const dependencyReleaseContexts = this.getDependencyReleaseContexts();
260
+
261
+ dependencyReleaseContexts.forEach((releaseContext) => {
262
+ const includeDependencies = false,
263
+ releaseContextConstructors = releaseContext.getConstructors(includeDependencies);
264
+
265
+ push(constructors, releaseContextConstructors);
266
+ });
267
+ }
268
+
269
+ return constructors;
270
+ }
271
+
272
+ addFileContext(fileContext) {
273
+ this.fileContexts.push(fileContext);
274
+ }
275
+
54
276
  findTypeByTypeName(typeName) {
55
277
  const types = this.getTypes(),
56
278
  type = types.find((type) => {
@@ -108,7 +330,8 @@ export default class ReleaseContext {
108
330
  fatal(message, node = null, tokens = null, filePath = null) { this.log.fatal(message, node, tokens, filePath); }
109
331
 
110
332
  initialise(dependencyReleaseContexts) {
111
- const releaseContext = this, ///
333
+ const fileContexts = [],
334
+ releaseContext = this, ///
112
335
  releaseContexts = [
113
336
  releaseContext,
114
337
  ...dependencyReleaseContexts
@@ -117,10 +340,50 @@ export default class ReleaseContext {
117
340
  florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar),
118
341
  florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
119
342
 
343
+ if (this.json !== null) {
344
+ const fileContextsJSON = this.json; ///
345
+
346
+ fileContextsJSON.forEach((fileContextJSON) => {
347
+ const json = fileContextJSON, ///
348
+ { filePath } = json,
349
+ fileContext = FileContext.fromFilePathAndReleaseContext(filePath, releaseContext);
350
+
351
+ fileContext.initialise(json);
352
+
353
+ fileContexts.push(fileContext);
354
+ });
355
+ }
356
+
120
357
  this.lexer = florenceLexer; ///
121
358
 
122
359
  this.parser = florenceParser; ///
123
360
 
361
+ this.fileContexts = fileContexts;
362
+
124
363
  this.dependencyReleaseContexts = dependencyReleaseContexts;
125
364
  }
365
+
366
+ toJSON() {
367
+ const json = [];
368
+
369
+ this.fileContexts.forEach((fileContext) => {
370
+ const fileContextJSON = fileContext.toJSON();
371
+
372
+ push(json, fileContextJSON);
373
+ });
374
+
375
+ return json;
376
+ }
377
+
378
+ static fromLogJSONNameAndEntries(log, json, name, entries) {
379
+ const lexer = null,
380
+ parser = null,
381
+ verified = false,
382
+ customGrammar = customGrammarFromNameAndEntries(name, entries),
383
+ fileContexts = null,
384
+ dependencyReleaseContexts = null,
385
+ releaseContext = new ReleaseContext(log, json, name, entries, lexer, parser, verified, customGrammar, fileContexts, dependencyReleaseContexts);
386
+
387
+ return releaseContext;
388
+ }
126
389
  }
package/src/index.js CHANGED
@@ -4,8 +4,6 @@ export { default as Log } from "./log";
4
4
 
5
5
  export { default as verifyRelease } from "./verify/release";
6
6
  export { default as ReleaseContext } from "./context/release";
7
- export { default as FileReleaseContext } from "./context/release/file";
8
- export { default as DirectoryReleaseContext } from "./context/release/directory";
9
7
 
10
8
  export { default as customGrammarUtilities } from "./utilities/customGrammar";
11
9
  export { default as releaseContextUtilities } from "./utilities/releaseContext";
package/src/kinds.js CHANGED
@@ -5,7 +5,9 @@ export const RULE_KIND = "rule";
5
5
  export const AXIOM_KIND = "axiom";
6
6
  export const LEMMA_KIND = "lemma";
7
7
  export const THEOREM_KIND = "theorem";
8
+ export const VARIABLE_KIND = "variable";
8
9
  export const META_TYPE_KIND = "meta-type";
9
10
  export const CONJECTURE_KIND = "conjecture";
10
11
  export const COMBINATOR_KIND = "combinator";
11
12
  export const CONSTRUCTOR_KIND = "constructor";
13
+ export const METAVARIABLE_KIND = "metavariable";
package/src/label.js CHANGED
@@ -34,10 +34,10 @@ export default class Label {
34
34
  return json;
35
35
  }
36
36
 
37
- static fromJSON(json, context) {
37
+ static fromJSONAndFileContext(json, fileContext) {
38
38
  const labelString = json, ///
39
- lexer = context.getLexer(),
40
- parser = context.getParser(),
39
+ lexer = fileContext.getLexer(),
40
+ parser = fileContext.getParser(),
41
41
  labelNode = labelNodeFromLabelString(labelString, lexer, parser),
42
42
  node = labelNode, ///
43
43
  label = new Label(node);
package/src/lemma.js CHANGED
@@ -7,7 +7,7 @@ import { LEMMA_KIND } from "./kinds";
7
7
  export default class Lemma extends AxiomLemmaTheoremConjecture {
8
8
  static kind = LEMMA_KIND;
9
9
 
10
- static fromJSON(json, context) { return AxiomLemmaTheoremConjecture.fromJSON(Lemma, json, context); }
10
+ static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Lemma,json, fileContext); }
11
11
 
12
12
  static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Lemma, labels, suppositions, consequence, proofContext); }
13
13
  }
package/src/metaType.js CHANGED
@@ -54,16 +54,19 @@ export default class MetaType {
54
54
  return json;
55
55
  }
56
56
 
57
- static fromJSON(json, context) {
58
- const { name } = json,
57
+ static fromMetaTypeName(metaTypeName) {
58
+ const name = metaTypeName, ///
59
59
  metaType = new MetaType(name);
60
60
 
61
61
  return metaType;
62
62
  }
63
63
 
64
- static fromMetaTypeName(metaTypeName) {
65
- const name = metaTypeName, ///
66
- metaType = new MetaType(name);
64
+ static fromJSONAndFileContext(json, fileContext) {
65
+ let metaType;
66
+
67
+ const { name } = json;
68
+
69
+ metaType = new MetaType(name);
67
70
 
68
71
  return metaType;
69
72
  }
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ import MetaType from "./metaType";
4
+
5
+ import { METAVARIABLE_KIND } from "./kinds";
6
+
3
7
  export default class Metavariable {
4
8
  constructor(name, metaType) {
5
9
  this.name = name;
@@ -20,6 +24,20 @@ export default class Metavariable {
20
24
  return matchesName;
21
25
  }
22
26
 
27
+ toJSON(tokens) {
28
+ const metaTypeJSON = this.metaType.toJSON(tokens),
29
+ kind = METAVARIABLE_KIND,
30
+ name = this.name, ///
31
+ metaType = metaTypeJSON, ///
32
+ json = {
33
+ kind,
34
+ name,
35
+ metaType
36
+ };
37
+
38
+ return json;
39
+ }
40
+
23
41
  asString(tokens) {
24
42
  const metaTypeName = this.metaType.getName(),
25
43
  string = `${this.name}:${metaTypeName}`;
@@ -32,4 +50,22 @@ export default class Metavariable {
32
50
 
33
51
  return metavariable;
34
52
  }
53
+
54
+ static fromJSONAndFileContext(json, fileContext) {
55
+ const { name } = json;
56
+
57
+ let { metaType } = json;
58
+
59
+ json = metaType; ///
60
+
61
+ metaType = MetaType.fromJSONAndFileContext(json, fileContext);
62
+
63
+ const metaTypeName = metaType.getName();
64
+
65
+ metaType = fileContext.findTypeByTypeName(metaTypeName); ///
66
+
67
+ const metavariable = new Metavariable(name, metaType);
68
+
69
+ return metavariable;
70
+ }
35
71
  }
package/src/premise.js CHANGED
@@ -124,11 +124,11 @@ export default class Premise {
124
124
  return json;
125
125
  }
126
126
 
127
- static fromJSON(json, context) {
127
+ static fromJSONAndFileContext(json, fileContext) {
128
128
  const { metastatement } = json,
129
129
  metastatementString = metastatement, ///
130
- lexer = context.getLexer(),
131
- parser = context.getParser(),
130
+ lexer = fileContext.getLexer(),
131
+ parser = fileContext.getParser(),
132
132
  metastatementNode = metastatementNodeFromMetastatementString(metastatementString, lexer, parser),
133
133
  premise = new Premise(metastatementNode);
134
134
 
package/src/rule.js CHANGED
@@ -139,7 +139,7 @@ export default class Rule {
139
139
  return json;
140
140
  }
141
141
 
142
- static fromJSON(json, context) {
142
+ static fromJSONAndFileContext(json, fileContext) {
143
143
  let rule;
144
144
 
145
145
  let { labels } = json;
@@ -148,7 +148,7 @@ export default class Rule {
148
148
 
149
149
  labels = labelsJSON.map((labelJSON) => {
150
150
  const json = labelJSON, ///
151
- label = Label.fromJSON(json, context);
151
+ label = Label.fromJSONAndFileContext(json, fileContext);
152
152
 
153
153
  return label;
154
154
  });
@@ -159,7 +159,7 @@ export default class Rule {
159
159
 
160
160
  premises = premisesJSON.map((premiseJSON) => {
161
161
  const json = premiseJSON, ///
162
- premise = Premise.fromJSON(json, context);
162
+ premise = Premise.fromJSONAndFileContext(json, fileContext);
163
163
 
164
164
  return premise;
165
165
  });
@@ -170,9 +170,9 @@ export default class Rule {
170
170
 
171
171
  json = conclusionJSON; ///
172
172
 
173
- conclusion = Conclusion.fromJSON(json, context);
173
+ conclusion = Conclusion.fromJSONAndFileContext(json, fileContext);
174
174
 
175
- rule = new Rule(labels, premises, conclusion);
175
+ rule = new Rule(labels, premises, conclusion, fileContext);
176
176
 
177
177
  return rule;
178
178
  }
package/src/ruleNames.js CHANGED
@@ -3,14 +3,17 @@
3
3
  export const TERM_RULE_NAME = "term";
4
4
  export const TYPE_RULE_NAME = "type";
5
5
  export const LABEL_RULE_NAME = "label";
6
+ export const VARIABLE_RULE_NAME = "variable";
6
7
  export const ARGUMENT_RULE_NAME = "argument";
7
8
  export const SUBPROOF_RULE_NAME = "subproof";
8
9
  export const STATEMENT_RULE_NAME = "statement";
10
+ export const META_TYPE_RULE_NAME = "meta-type";
11
+ export const METAVARIABLE_RULE_NAME = "metavariable";
9
12
  export const METASTATEMENT_RULE_NAME = "metastatement";
10
13
  export const RULE_SUBPROOF_RULE_NAME = "ruleSubproof";
11
14
  export const META_ARGUMENT_RULE_NAME = "metaArgument";
12
15
  export const QUALIFIED_STATEMENT_RULE_NAME = "qualifiedStatement";
13
16
  export const UNQUALIFIED_STATEMENT_RULE_NAME = "unqualifiedStatement";
14
- export const CONSTRUCTOR_DECLARATIONRULE_NAME = "constructorDeclaration";
17
+ export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
15
18
  export const QUALIFIED_METASTATEMENT_RULE_NAME = "qualifiedMetastatement";
16
19
  export const UNQUALIFIED_METASTATEMENT_RULE_NAME = "unqualifiedMetastatement";
@@ -75,11 +75,11 @@ export default class Supposition {
75
75
  return json;
76
76
  }
77
77
 
78
- static fromJSON(json, context) {
78
+ static fromJSONAndFileContext(json, fileContext) {
79
79
  const { statement } = json,
80
80
  statementString = statement, ///
81
- lexer = context.getLexer(),
82
- parser = context.getParser(),
81
+ lexer = fileContext.getLexer(),
82
+ parser = fileContext.getParser(),
83
83
  statementNode = statementNodeFromStatementString(statementString, lexer, parser),
84
84
  supposition = new Supposition(statementNode);
85
85
 
package/src/theorem.js CHANGED
@@ -7,7 +7,7 @@ import { THEOREM_KIND } from "./kinds";
7
7
  export default class Theorem extends AxiomLemmaTheoremConjecture {
8
8
  static kind = THEOREM_KIND;
9
9
 
10
- static fromJSON(json, context) { return AxiomLemmaTheoremConjecture.fromJSON(Theorem, json, context); }
10
+ static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Theorem, json, fileContext); }
11
11
 
12
12
  static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Theorem, labels, suppositions, consequence, proofContext); }
13
13
  }
package/src/type.js CHANGED
@@ -133,14 +133,22 @@ export default class Type {
133
133
  return json;
134
134
  }
135
135
 
136
- static fromJSON(json, context) {
136
+ static fromTypeName(typeName) {
137
+ const name = typeName, ///
138
+ superType = objectType, ///
139
+ type = new Type(name, superType);
140
+
141
+ return type;
142
+ }
143
+
144
+ static fromJSONAndFileContext(json, fileContext) {
137
145
  let type;
138
146
 
139
147
  let { superType } = json;
140
148
 
141
149
  const superTypeJSON = superType; ///
142
150
 
143
- superType = superTypeFromSuperTypeJSON(superTypeJSON, context);
151
+ superType = superTypeFromSuperTypeJSONAndFileContext(superTypeJSON, fileContext);
144
152
 
145
153
  const { name } = json;
146
154
 
@@ -149,14 +157,6 @@ export default class Type {
149
157
  return type;
150
158
  }
151
159
 
152
- static fromTypeName(typeName) {
153
- const name = typeName, ///
154
- superType = objectType, ///
155
- type = new Type(name, superType);
156
-
157
- return type;
158
- }
159
-
160
160
  static fromTypeNameAndSuperType(typeName, superType) {
161
161
  const name = typeName, ///
162
162
  type = new Type(name, superType);
@@ -190,7 +190,7 @@ class ObjectType extends Type {
190
190
 
191
191
  export const objectType = ObjectType.fromNothing();
192
192
 
193
- function superTypeFromSuperTypeJSON(superTypeJSON, context) {
193
+ function superTypeFromSuperTypeJSONAndFileContext(superTypeJSON, fileContext) {
194
194
  let superType;
195
195
 
196
196
  const json = superTypeJSON, ///
@@ -200,11 +200,11 @@ function superTypeFromSuperTypeJSON(superTypeJSON, context) {
200
200
  superType = objectType; ///
201
201
  } else {
202
202
  const typeName = name, ///
203
- type = context.findTypeByTypeName(typeName);
203
+ type = fileContext.findTypeByTypeName(typeName);
204
204
 
205
205
  superType = (type !== null) ?
206
206
  type : ///
207
- Type.fromJSON(json, context); ///
207
+ Type.fromJSONAndFileContext(json, fileContext); ///
208
208
  }
209
209
 
210
210
  return superType;