occam-verify-cli 0.0.443 → 0.0.445
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/bin/action/verify.js +17 -11
- package/bin/callbacks.js +1 -1
- package/lib/axiom.js +18 -22
- package/lib/combinator.js +3 -3
- package/lib/conclusion.js +3 -7
- package/lib/constructor.js +8 -5
- package/lib/context/file.js +21 -21
- package/lib/context/release/file.js +22 -28
- package/lib/context/release.js +13 -1
- package/lib/label.js +3 -7
- package/lib/premise.js +3 -7
- package/lib/rule.js +20 -33
- package/lib/type.js +7 -4
- package/lib/utilities/releaseContext.js +13 -3
- package/lib/verify/file.js +15 -10
- package/package.json +1 -1
- package/src/axiom.js +23 -24
- package/src/combinator.js +3 -2
- package/src/conclusion.js +5 -9
- package/src/constructor.js +13 -6
- package/src/context/file.js +23 -23
- package/src/context/release/file.js +25 -33
- package/src/context/release.js +13 -0
- package/src/label.js +3 -8
- package/src/premise.js +5 -9
- package/src/rule.js +22 -32
- package/src/type.js +9 -3
- package/src/utilities/releaseContext.js +18 -2
- package/src/verify/file.js +22 -14
package/src/type.js
CHANGED
|
@@ -119,15 +119,21 @@ export default class Type {
|
|
|
119
119
|
return json;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
static fromJSON(json) {
|
|
122
|
+
static fromJSON(json, releaseContext) {
|
|
123
123
|
const { name } = json;
|
|
124
124
|
|
|
125
125
|
let { superType } = json;
|
|
126
126
|
|
|
127
127
|
if (superType !== null) {
|
|
128
|
-
|
|
128
|
+
const superTypeJSON = superType; ///
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
json = superTypeJSON; ///
|
|
131
|
+
|
|
132
|
+
superType = Type.fromJSON(json, releaseContext);
|
|
133
|
+
|
|
134
|
+
const superTypeName = superType.getName();
|
|
135
|
+
|
|
136
|
+
superType = releaseContext.findTypeByTypeName(superTypeName); ///
|
|
131
137
|
}
|
|
132
138
|
|
|
133
139
|
const type = new Type(name, superType);
|
|
@@ -39,7 +39,7 @@ export function createReleaseContext(dependency, dependentNames, context, callba
|
|
|
39
39
|
}, context);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function initialiseReleaseContext(dependency, context) {
|
|
42
|
+
export function initialiseReleaseContext(dependency, dependentName, verified, context) {
|
|
43
43
|
const { releaseContextMap } = context,
|
|
44
44
|
dependencyName = dependency.getName(),
|
|
45
45
|
releaseName = dependencyName, ///
|
|
@@ -55,10 +55,26 @@ export function initialiseReleaseContext(dependency, context) {
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
const releaseContextVerified = releaseContext.isVerified();
|
|
59
|
+
|
|
60
|
+
if (verified) {
|
|
61
|
+
if (!releaseContextVerified) {
|
|
62
|
+
const { log } = context;
|
|
63
|
+
|
|
64
|
+
log .error(`Unable to initialise the '${releaseName}' dependency's context because its '${dependentName}' dependent is a package.`);
|
|
65
|
+
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
verified = releaseContextVerified; ///
|
|
71
|
+
|
|
72
|
+
dependentName = releaseName; ///
|
|
73
|
+
|
|
58
74
|
const dependencies = releaseContext.getDependencies();
|
|
59
75
|
|
|
60
76
|
dependencies.forEachDependency((dependency) => {
|
|
61
|
-
initialiseReleaseContext(dependency, context);
|
|
77
|
+
initialiseReleaseContext(dependency, dependentName, verified, context);
|
|
62
78
|
});
|
|
63
79
|
|
|
64
80
|
const dependencyReleaseContexts = retrieveDependencyReleaseContexts(dependency, context);
|
package/src/verify/file.js
CHANGED
|
@@ -5,7 +5,8 @@ import verifyTopLevelDeclaration from "./declaration/topLevel";
|
|
|
5
5
|
|
|
6
6
|
import { nodesQuery } from "../utilities/query";
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const errorNodesQuery = nodesQuery("/document/error"),
|
|
9
|
+
topLevelDeclarationNodesQuery = nodesQuery("/document/topLevelDeclaration");
|
|
9
10
|
|
|
10
11
|
export default function verifyFile(filePath, releaseContext) {
|
|
11
12
|
let fileVerified = false;
|
|
@@ -14,19 +15,26 @@ export default function verifyFile(filePath, releaseContext) {
|
|
|
14
15
|
|
|
15
16
|
const fileContext = FileContext.fromReleaseContextAndFilePath(releaseContext, filePath),
|
|
16
17
|
node = fileContext.getNode(),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
errorNodes = errorNodesQuery(node),
|
|
19
|
+
errorNodesLength = errorNodes.length;
|
|
20
|
+
|
|
21
|
+
if (errorNodesLength > 0) {
|
|
22
|
+
releaseContext.error(`The '${filePath}' file cannot be verified because it contains errors.`);
|
|
23
|
+
} else {
|
|
24
|
+
const topLevelDeclarationNodes = topLevelDeclarationNodesQuery(node),
|
|
25
|
+
topLevelDeclarationsVerified = topLevelDeclarationNodes.every((topLevelDeclarationNode) => {
|
|
26
|
+
const topLevelDeclarationVerified = verifyTopLevelDeclaration(topLevelDeclarationNode, fileContext);
|
|
27
|
+
|
|
28
|
+
if (topLevelDeclarationVerified) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (topLevelDeclarationsVerified) {
|
|
34
|
+
releaseContext.addFileContext(fileContext);
|
|
35
|
+
|
|
36
|
+
fileVerified = true;
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
if (fileVerified) {
|