occam-verify-cli 1.0.642 → 1.0.649
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/action/verify.js +23 -3
- package/lib/context/file/nominal.js +14 -14
- package/lib/context.js +22 -8
- package/lib/element/assertion/type.js +9 -6
- package/lib/element/combinator.js +12 -8
- package/lib/element/conclusion.js +4 -15
- package/lib/element/constructor.js +43 -8
- package/lib/element/declaration/combinator.js +25 -15
- package/lib/element/declaration/complexType.js +43 -33
- package/lib/element/declaration/constructor.js +45 -100
- package/lib/element/declaration/simpleType.js +77 -53
- package/lib/element/declaration/typePrefix.js +30 -20
- package/lib/element/declaration/variable.js +3 -5
- package/lib/element/metavariable.js +2 -2
- package/lib/element/statement.js +2 -2
- package/lib/element/term.js +1 -1
- package/lib/element/topLevelAssertion/axiom.js +2 -2
- package/lib/element/type.js +6 -5
- package/lib/node/declaration/complexType.js +1 -8
- package/lib/node/declaration/simpleType.js +1 -8
- package/lib/process/assign.js +11 -24
- package/lib/process/unify.js +41 -1
- package/lib/process/verify.js +61 -13
- package/lib/utilities/element.js +31 -19
- package/lib/utilities/fileContext.js +1 -1
- package/lib/utilities/json.js +1 -1
- package/lib/utilities/type.js +3 -3
- package/package.json +4 -4
- package/src/action/verify.js +35 -1
- package/src/context/file/nominal.js +13 -13
- package/src/context.js +24 -10
- package/src/element/assertion/type.js +10 -6
- package/src/element/combinator.js +13 -11
- package/src/element/conclusion.js +3 -27
- package/src/element/constructor.js +54 -3
- package/src/element/declaration/combinator.js +5 -2
- package/src/element/declaration/complexType.js +9 -6
- package/src/element/declaration/constructor.js +33 -99
- package/src/element/declaration/simpleType.js +73 -44
- package/src/element/declaration/typePrefix.js +5 -2
- package/src/element/declaration/variable.js +3 -8
- package/src/element/metavariable.js +1 -1
- package/src/element/statement.js +1 -1
- package/src/element/term.js +7 -7
- package/src/element/topLevelAssertion/axiom.js +1 -1
- package/src/element/type.js +4 -3
- package/src/node/declaration/complexType.js +0 -7
- package/src/node/declaration/simpleType.js +0 -7
- package/src/process/assign.js +15 -23
- package/src/process/unify.js +32 -0
- package/src/process/verify.js +48 -18
- package/src/utilities/element.js +33 -18
- package/src/utilities/fileContext.js +1 -1
- package/src/utilities/json.js +1 -0
- package/src/utilities/type.js +2 -3
|
@@ -87,26 +87,10 @@ export default define(class Conclusion extends Element {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
toJSON() {
|
|
90
|
-
let frames,
|
|
91
|
-
terms;
|
|
92
|
-
|
|
93
|
-
frames = this.context.getFrames();
|
|
94
|
-
|
|
95
|
-
terms = this.context.getTerms();
|
|
96
|
-
|
|
97
90
|
const statementJSON = statementToStatementJSON(this.statement),
|
|
98
|
-
|
|
99
|
-
termsJSON = termsToTermsJSON(terms);
|
|
100
|
-
|
|
101
|
-
frames = framesJSON; ///
|
|
102
|
-
|
|
103
|
-
terms = termsJSON; ///
|
|
104
|
-
|
|
105
|
-
const statement = statementJSON, ///
|
|
91
|
+
statement = statementJSON, ///
|
|
106
92
|
json = {
|
|
107
|
-
statement
|
|
108
|
-
frames,
|
|
109
|
-
terms
|
|
93
|
+
statement
|
|
110
94
|
};
|
|
111
95
|
|
|
112
96
|
return json;
|
|
@@ -115,14 +99,6 @@ export default define(class Conclusion extends Element {
|
|
|
115
99
|
static name = "Conclusion";
|
|
116
100
|
|
|
117
101
|
static fromJSON(json, context) {
|
|
118
|
-
|
|
119
|
-
node = null,
|
|
120
|
-
string = statement.getString();
|
|
121
|
-
|
|
122
|
-
context = ephemeralContext; ///
|
|
123
|
-
|
|
124
|
-
const conclusion = new Conclusion(context, string, node, statement);
|
|
125
|
-
|
|
126
|
-
return conclusion;
|
|
102
|
+
debugger
|
|
127
103
|
}
|
|
128
104
|
});
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
+
import { attempt } from "../utilities/context";
|
|
7
|
+
import { verifyTermAsConstructor } from "../process/verify";
|
|
6
8
|
import { unifyTermWithConstructor } from "../process/unify";
|
|
7
9
|
import { termFromJSON, termToTermJSON } from "../utilities/json";
|
|
8
10
|
|
|
@@ -24,12 +26,53 @@ export default define(class Constructor extends Element {
|
|
|
24
26
|
return constructorNode;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
isProvisional() { return this.term.isProvisional(); }
|
|
28
|
-
|
|
29
29
|
getType() { return this.term.getType(); }
|
|
30
30
|
|
|
31
|
+
getString() {
|
|
32
|
+
let string;
|
|
33
|
+
|
|
34
|
+
const type = this.getType();
|
|
35
|
+
|
|
36
|
+
if (type === null) {
|
|
37
|
+
const termString = this.term.getString();
|
|
38
|
+
|
|
39
|
+
string = termString; ///
|
|
40
|
+
} else {
|
|
41
|
+
const typeString = type.getString(),
|
|
42
|
+
termString = this.term.getString();
|
|
43
|
+
|
|
44
|
+
string = `${termString}.${typeString}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return string;
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
setType(type) { this.term.setType(type); }
|
|
32
51
|
|
|
52
|
+
verify(context) {
|
|
53
|
+
let verifies = false;
|
|
54
|
+
|
|
55
|
+
const constructorString = this.getString(); ///
|
|
56
|
+
|
|
57
|
+
context.trace(`Verifying the '${constructorString}' constructor...`);
|
|
58
|
+
|
|
59
|
+
attempt((context) => {
|
|
60
|
+
const termVerifiesAsConstructor = verifyTermAsConstructor(this.term, context);
|
|
61
|
+
|
|
62
|
+
if (termVerifiesAsConstructor) {
|
|
63
|
+
this.setContext(context);
|
|
64
|
+
|
|
65
|
+
verifies = true;
|
|
66
|
+
}
|
|
67
|
+
}, context);
|
|
68
|
+
|
|
69
|
+
if (verifies) {
|
|
70
|
+
context.debug(`...verified the '${constructorString}' constructor.`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return verifies;
|
|
74
|
+
}
|
|
75
|
+
|
|
33
76
|
unifyTerm(term, context, validateForwards) {
|
|
34
77
|
let termUnifies = false;
|
|
35
78
|
|
|
@@ -38,8 +81,16 @@ export default define(class Constructor extends Element {
|
|
|
38
81
|
|
|
39
82
|
context.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`);
|
|
40
83
|
|
|
84
|
+
const specifiContext = context; ///
|
|
85
|
+
|
|
86
|
+
context = this.getContext();
|
|
87
|
+
|
|
88
|
+
const generalContext = context; ///
|
|
89
|
+
|
|
90
|
+
context = specifiContext; ///
|
|
91
|
+
|
|
41
92
|
const constructor = this, ///
|
|
42
|
-
termUnifiesWithConstructor = unifyTermWithConstructor(term, constructor,
|
|
93
|
+
termUnifiesWithConstructor = unifyTermWithConstructor(term, constructor, generalContext, specifiContext);
|
|
43
94
|
|
|
44
95
|
if (termUnifiesWithConstructor) {
|
|
45
96
|
let validatesForwards;
|
|
@@ -25,8 +25,11 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
25
25
|
async verify() {
|
|
26
26
|
let verifies = false;
|
|
27
27
|
|
|
28
|
-
const context = this.getContext()
|
|
29
|
-
|
|
28
|
+
const context = this.getContext();
|
|
29
|
+
|
|
30
|
+
await this.break(context);
|
|
31
|
+
|
|
32
|
+
const combinatorDeclarationString = this.getString(); ///
|
|
30
33
|
|
|
31
34
|
context.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
32
35
|
|
|
@@ -5,19 +5,19 @@ import Declaration from "../declaration";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
|
|
7
7
|
export default define(class ComplexTypeDeclaration extends Declaration {
|
|
8
|
-
constructor(context, string, node, type,
|
|
8
|
+
constructor(context, string, node, type, superTypes) {
|
|
9
9
|
super(context, string, node);
|
|
10
10
|
|
|
11
11
|
this.type = type;
|
|
12
|
-
this.
|
|
12
|
+
this.superTypes = superTypes;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getType() {
|
|
16
16
|
return this.type;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
return this.
|
|
19
|
+
getSuperTypes() {
|
|
20
|
+
return this.superTypes;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
getComplexTypeDeclarationNode() {
|
|
@@ -266,8 +266,11 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
266
266
|
async verify() {
|
|
267
267
|
let verifies = false;
|
|
268
268
|
|
|
269
|
-
const context = this.getContext()
|
|
270
|
-
|
|
269
|
+
const context = this.getContext();
|
|
270
|
+
|
|
271
|
+
await this.break(context);
|
|
272
|
+
|
|
273
|
+
const complexTypeDeclarationString = this.getString(); ///
|
|
271
274
|
|
|
272
275
|
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`);
|
|
273
276
|
|
|
@@ -17,7 +17,7 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
17
17
|
return this.type;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
isProvisional() {
|
|
21
21
|
return this.provisional;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -32,37 +32,6 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
32
32
|
return constructorDeclarationNode;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
async verify() {
|
|
36
|
-
let verifies = false;
|
|
37
|
-
|
|
38
|
-
const context = this.getContext(),
|
|
39
|
-
constructorDeclarationString = this.getString(); ///
|
|
40
|
-
|
|
41
|
-
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
42
|
-
|
|
43
|
-
const typeVerified = this.verifyType();
|
|
44
|
-
|
|
45
|
-
if (typeVerified) {
|
|
46
|
-
const constructorVerifies = this.verifyConstructor();
|
|
47
|
-
|
|
48
|
-
if (constructorVerifies) {
|
|
49
|
-
const constructorTypeVerifies = this.verifyConstructorType();
|
|
50
|
-
|
|
51
|
-
if (constructorTypeVerifies) {
|
|
52
|
-
context.addConstructor(this.constructor);
|
|
53
|
-
|
|
54
|
-
verifies = true;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (verifies) {
|
|
60
|
-
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return verifies;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
35
|
verifyType() {
|
|
67
36
|
let typeVerifies = false;
|
|
68
37
|
|
|
@@ -76,8 +45,7 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
76
45
|
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
77
46
|
|
|
78
47
|
if (type !== null) {
|
|
79
|
-
const
|
|
80
|
-
provisional = this.isProvisional(includeSupertypes),
|
|
48
|
+
const provisional = this.isProvisional(),
|
|
81
49
|
typeComparesToProvisional = type.compareProvisional(provisional);
|
|
82
50
|
|
|
83
51
|
if (!typeComparesToProvisional) {
|
|
@@ -118,71 +86,37 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
118
86
|
return constructorVerifies;
|
|
119
87
|
}
|
|
120
88
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
-
// const context = this.getContext(),
|
|
125
|
-
// constructorType = this,
|
|
126
|
-
// constructorTypeString = constructorType.getString(),
|
|
127
|
-
// constructorDeclarationString = this.getString(); ///
|
|
128
|
-
//
|
|
129
|
-
// context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's '${constructorTypeString}' type...`);
|
|
130
|
-
//
|
|
131
|
-
// const nominalTypeName = this.type.getNominalTypeName(),
|
|
132
|
-
// typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
133
|
-
//
|
|
134
|
-
// if (!typePresent) {
|
|
135
|
-
// context.debug(`The '${typeString}' type is not present.`);
|
|
136
|
-
// } else {
|
|
137
|
-
// const includeSupertypes = false,
|
|
138
|
-
// provisional = type.isProvisional(includeSupertypes),
|
|
139
|
-
// typeComparesToProvisional = type.compareProvisional(provisional);
|
|
140
|
-
//
|
|
141
|
-
// if (!typeComparesToProvisional) {
|
|
142
|
-
// provisional ?
|
|
143
|
-
// context.debug(`The '${typeString}' type is present but not provisional.`) :
|
|
144
|
-
// context.debug(`The '${typeString}' type is present but provisional.`);
|
|
145
|
-
// } else {
|
|
146
|
-
// this.constructor.setType(type);
|
|
147
|
-
//
|
|
148
|
-
// constructorTypeVerifies = true;
|
|
149
|
-
// }
|
|
150
|
-
// }
|
|
151
|
-
//
|
|
152
|
-
// if (constructorTypeVerifies) {
|
|
153
|
-
// context.debug(`...verified the '${constructorDeclarationString}' constructor declaration's '${typeString}' type.`);
|
|
154
|
-
// }
|
|
155
|
-
//
|
|
156
|
-
// return constructorTypeVerifies;
|
|
157
|
-
// }
|
|
89
|
+
async verify() {
|
|
90
|
+
let verifies = false;
|
|
158
91
|
|
|
159
|
-
|
|
160
|
-
|
|
92
|
+
const context = this.getContext();
|
|
93
|
+
|
|
94
|
+
await this.break(context);
|
|
95
|
+
|
|
96
|
+
const constructorDeclarationString = this.getString(); ///
|
|
97
|
+
|
|
98
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
99
|
+
|
|
100
|
+
const typeVerified = this.verifyType();
|
|
101
|
+
|
|
102
|
+
if (typeVerified) {
|
|
103
|
+
const constructorVerifies = this.verifyConstructor();
|
|
104
|
+
|
|
105
|
+
if (constructorVerifies) {
|
|
106
|
+
this.constructor.setType(this.type);
|
|
107
|
+
|
|
108
|
+
context.addConstructor(this.constructor);
|
|
161
109
|
|
|
110
|
+
verifies = true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
162
113
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
// termNode = term.getNode(),
|
|
173
|
-
// termValidates = validateTerm(termNode, context, () => {
|
|
174
|
-
// const validatesFormards = true;
|
|
175
|
-
//
|
|
176
|
-
// return validatesFormards;
|
|
177
|
-
// });
|
|
178
|
-
//
|
|
179
|
-
// if (termValidates) {
|
|
180
|
-
// constructorValidates = true;
|
|
181
|
-
// }
|
|
182
|
-
//
|
|
183
|
-
// if (constructorValidates) {
|
|
184
|
-
// context.debug(`...verified the '${constructorString}' constructor.`);
|
|
185
|
-
// }
|
|
186
|
-
//
|
|
187
|
-
// return constructorValidates;
|
|
188
|
-
// }
|
|
114
|
+
if (verifies) {
|
|
115
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return verifies;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static name = "ConstructorDeclaration";
|
|
122
|
+
});
|
|
@@ -4,28 +4,29 @@ import Declaration from "../declaration";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { superTypesStringFromSuperTypes } from "../../utilities/string";
|
|
7
|
+
import {baseTypeFromNothing} from "../../utilities/type";
|
|
7
8
|
|
|
8
9
|
export default define(class SimpleTypeDeclaration extends Declaration {
|
|
9
|
-
constructor(context, string, node, type,
|
|
10
|
+
constructor(context, string, node, type, superTypes, provisional) {
|
|
10
11
|
super(context, string, node);
|
|
11
12
|
|
|
12
13
|
this.type = type;
|
|
13
|
-
this.prefixed = prefixed;
|
|
14
14
|
this.superTypes = superTypes;
|
|
15
|
+
this.provisional = provisional;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
getType() {
|
|
18
19
|
return this.type;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
isPrefixed() {
|
|
22
|
-
return this.prefixed;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
22
|
getSuperTypes() {
|
|
26
23
|
return this.superTypes;
|
|
27
24
|
}
|
|
28
25
|
|
|
26
|
+
isProvisional() {
|
|
27
|
+
return this.provisional;
|
|
28
|
+
}
|
|
29
|
+
|
|
29
30
|
getSimpleTypeDeclarationNode() {
|
|
30
31
|
const node = this.getNode(),
|
|
31
32
|
simpleTypeDeclarationNode = node; ///
|
|
@@ -52,6 +53,8 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
52
53
|
typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
53
54
|
|
|
54
55
|
if (!typePresent) {
|
|
56
|
+
this.type.setProvisional(this.provisional);
|
|
57
|
+
|
|
55
58
|
typeVerifies = true;
|
|
56
59
|
} else {
|
|
57
60
|
context.debug(`The '${typeString}' type is already present.`);
|
|
@@ -67,14 +70,14 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
67
70
|
return typeVerifies;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
verifySuperType(superType,
|
|
73
|
+
verifySuperType(superType, superTypes) {
|
|
71
74
|
let superTypeVerifies = false;
|
|
72
75
|
|
|
73
76
|
const context = this.getContext(),
|
|
74
77
|
superTypeString = superType.getString(),
|
|
75
78
|
simpleTypeDeclarationString = this.getString(); ///;
|
|
76
79
|
|
|
77
|
-
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-
|
|
80
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-type...`);
|
|
78
81
|
|
|
79
82
|
const nominalTypeName = superType.getNominalTypeName(),
|
|
80
83
|
typeName = nominalTypeName, ///
|
|
@@ -84,7 +87,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
84
87
|
superType = context.findTypeByNominalTypeName(nominalTypeName);
|
|
85
88
|
|
|
86
89
|
if (superType !== null) {
|
|
87
|
-
|
|
90
|
+
superTypes.push(superType);
|
|
88
91
|
|
|
89
92
|
superTypeVerifies = true;
|
|
90
93
|
} else {
|
|
@@ -95,7 +98,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
if (superTypeVerifies) {
|
|
98
|
-
context.debug(`...verified the '${superTypeString}' super-type.`);
|
|
101
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-type.`);
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
return superTypeVerifies;
|
|
@@ -104,66 +107,92 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
104
107
|
verifySuperTypes() {
|
|
105
108
|
let superTypesVerify;
|
|
106
109
|
|
|
107
|
-
const
|
|
110
|
+
const context = this.getContext(),
|
|
111
|
+
superTypes = [],
|
|
112
|
+
superTypesString = superTypesStringFromSuperTypes(this.superTypes),
|
|
113
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
simpleTypeDeclarationString = this.getString(); ///;
|
|
115
|
+
(superTypesString !== null) ?
|
|
116
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types...`) :
|
|
117
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's super-types...`);
|
|
113
118
|
|
|
114
|
-
|
|
119
|
+
superTypesVerify = this.superTypes.every((superType) => {
|
|
120
|
+
const superTypeVerifies = this.verifySuperType(superType, superTypes);
|
|
115
121
|
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
if (superTypeVerifies) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
118
126
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
});
|
|
127
|
+
if (superTypesVerify) {
|
|
128
|
+
const superTypesLength = superTypes.length;
|
|
123
129
|
|
|
124
|
-
if (
|
|
125
|
-
|
|
130
|
+
if (superTypesLength === 0) {
|
|
131
|
+
const baseType = baseTypeFromNothing(),
|
|
132
|
+
superTyupe = baseType; ///
|
|
133
|
+
|
|
134
|
+
superTypes.push(superTyupe);
|
|
126
135
|
}
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
|
|
137
|
+
this.type.setSuperTypes(superTypes);
|
|
138
|
+
|
|
139
|
+
(superTypesString !== null) ?
|
|
140
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types.`) :
|
|
141
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's super-types.`);
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
return superTypesVerify;
|
|
132
145
|
}
|
|
133
146
|
|
|
147
|
+
verifyTypePrefix() {
|
|
148
|
+
let typePrefixVerifies = false;
|
|
149
|
+
|
|
150
|
+
const context = this.getContext(),
|
|
151
|
+
typeString = this.type.getString(),
|
|
152
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
153
|
+
|
|
154
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's prefix...`);
|
|
155
|
+
|
|
156
|
+
const typePrefixed = this.type.isPrefixed();
|
|
157
|
+
|
|
158
|
+
if (!typePrefixed) {
|
|
159
|
+
typePrefixVerifies = true;
|
|
160
|
+
} else {
|
|
161
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type is prefixed.`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (typePrefixVerifies) {
|
|
165
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's prefix.`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return typePrefixVerifies;
|
|
169
|
+
}
|
|
170
|
+
|
|
134
171
|
async verify() {
|
|
135
172
|
let verifies = false;
|
|
136
173
|
|
|
137
|
-
const context = this.getContext()
|
|
138
|
-
simpleTypeDeclarationString = this.getString(); ///
|
|
174
|
+
const context = this.getContext();
|
|
139
175
|
|
|
140
|
-
|
|
176
|
+
await this.break(context);
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
const typeVerifies = this.verifyType();
|
|
178
|
+
const simpleTypeDeclarationString = this.getString(); ///
|
|
144
179
|
|
|
145
|
-
|
|
146
|
-
const superTypesVerify = this.verifySuperTypes();
|
|
180
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration...`);
|
|
147
181
|
|
|
148
|
-
|
|
149
|
-
const typePrefix = context.getTypePrefix();
|
|
182
|
+
const typeVerifies = this.verifyType();
|
|
150
183
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
prefixName = typePrefixName; ///
|
|
184
|
+
if (typeVerifies) {
|
|
185
|
+
const superTypesVerify = this.verifySuperTypes();
|
|
154
186
|
|
|
155
|
-
|
|
156
|
-
|
|
187
|
+
if (superTypesVerify) {
|
|
188
|
+
const typePrefixVerifies = this.verifyTypePrefix();
|
|
157
189
|
|
|
190
|
+
if (typePrefixVerifies) {
|
|
158
191
|
context.addType(this.type);
|
|
159
192
|
|
|
160
193
|
verifies = true;
|
|
161
194
|
}
|
|
162
195
|
}
|
|
163
|
-
} else {
|
|
164
|
-
const typeString = this.type.getString();
|
|
165
|
-
|
|
166
|
-
context.trace(`The '${typeString}' type is prefixed.`);
|
|
167
196
|
}
|
|
168
197
|
|
|
169
198
|
if (verifies) {
|
|
@@ -63,8 +63,11 @@ export default define(class TypePrefixDeclaration extends Declaration {
|
|
|
63
63
|
async verify() {
|
|
64
64
|
let verifies = false;
|
|
65
65
|
|
|
66
|
-
const context = this.getContext()
|
|
67
|
-
|
|
66
|
+
const context = this.getContext();
|
|
67
|
+
|
|
68
|
+
await this.break(context);
|
|
69
|
+
|
|
70
|
+
const typePrefixDeclarationString = this.getString(); ///
|
|
68
71
|
|
|
69
72
|
context.trace(`Verifying the '${typePrefixDeclarationString}' type prefix declaration...`);
|
|
70
73
|
|
|
@@ -79,20 +79,15 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
79
79
|
context.trace(`Verifying the '${variableDeclarationString}' variable declaration's '${variableString}' variable...`);
|
|
80
80
|
|
|
81
81
|
const variableIdentifier = this.variable.getIdentifier(),
|
|
82
|
-
|
|
83
|
-
variablePresent = (variable !== null);
|
|
82
|
+
variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentifier);
|
|
84
83
|
|
|
85
84
|
if (variablePresent) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
context.debug(`The '${variableIdentifier}' variable is already present.`);
|
|
85
|
+
context.debug(`The '${variableString}' variable is already present.`);
|
|
89
86
|
} else {
|
|
90
|
-
this.variable.setType(this.type);
|
|
91
|
-
|
|
92
87
|
variableVerifies = true;
|
|
93
88
|
}
|
|
94
89
|
|
|
95
|
-
if (
|
|
90
|
+
if (variableVerifies) {
|
|
96
91
|
context.debug(`...verified the '${variableDeclarationString}' variable declaration's '${variableString}' variable.`);
|
|
97
92
|
}
|
|
98
93
|
|
package/src/element/statement.js
CHANGED
package/src/element/term.js
CHANGED
|
@@ -197,16 +197,16 @@ export default define(class Term extends Element {
|
|
|
197
197
|
context.trace(`Validating the '${termString}' term given the '${typeString}' type...`);
|
|
198
198
|
|
|
199
199
|
const validates = this.validate(context, () => {
|
|
200
|
-
|
|
200
|
+
let validatesForwards;
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
const typeEqualToOrSubTypeOfGivenTypeType = this.type.isEqualToOrSubTypeOf(type);
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
if (typeEqualToOrSubTypeOfGivenTypeType) {
|
|
205
|
+
validatesForwards = true;
|
|
206
|
+
}
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
return validatesForwards;
|
|
209
|
+
});
|
|
210
210
|
|
|
211
211
|
if (validates) {
|
|
212
212
|
validatesGivenType = true;
|
package/src/element/type.js
CHANGED
|
@@ -233,12 +233,12 @@ export default define(class Type extends Element {
|
|
|
233
233
|
return comparesToTypeName;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
compareProvisional(provisional) {
|
|
236
|
+
compareProvisional(provisional, includeSupertypes = true) {
|
|
237
237
|
let comparesToProvisional;
|
|
238
238
|
|
|
239
239
|
const provisionalA = provisional; ///
|
|
240
240
|
|
|
241
|
-
provisional = this.isProvisional();
|
|
241
|
+
provisional = this.isProvisional(includeSupertypes);
|
|
242
242
|
|
|
243
243
|
const provisionalB = provisional; ///
|
|
244
244
|
|
|
@@ -326,12 +326,13 @@ export default define(class Type extends Element {
|
|
|
326
326
|
return type;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
static
|
|
329
|
+
static fromName(name, context) {
|
|
330
330
|
const string = name, ///
|
|
331
331
|
node = null,
|
|
332
332
|
prefixName = null,
|
|
333
333
|
superTypes = [],
|
|
334
334
|
properties = [],
|
|
335
|
+
provisional = false,
|
|
335
336
|
type = new Type(context, string, node, name, prefixName, superTypes, properties, provisional);
|
|
336
337
|
|
|
337
338
|
return type;
|
|
@@ -28,13 +28,6 @@ export default class ComplexTypeDeclarationNode extends DeclarationNode {
|
|
|
28
28
|
return provisional;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
isPrefixed() {
|
|
32
|
-
const typeNode = this.getTypeNode(),
|
|
33
|
-
prefixed = typeNode.isPrefixed();
|
|
34
|
-
|
|
35
|
-
return prefixed;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
31
|
getTypeName() {
|
|
39
32
|
const typeNode = this.getTypeNode(),
|
|
40
33
|
typeName = typeNode.getTypeName();
|