File tree 1 file changed +24
-0
lines changed 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,30 @@ export class CompilerVisitor implements IRVisitor {
158
158
return this . errorTracker . runtimeErrors
159
159
}
160
160
161
+ exitAssume ( assume : ir . QuintAssume ) {
162
+ const comp = this . compStack . pop ( )
163
+ if ( comp === undefined ) {
164
+ this . errorTracker . addCompileError ( assume . id , 'QNT501' , `No expression for ${ assume . name } on compStack` )
165
+ return
166
+ }
167
+
168
+ const result = comp . eval ( )
169
+ if ( result . isLeft ( ) ) {
170
+ this . errorTracker . addRuntimeError ( assume . id , result . value )
171
+ return
172
+ }
173
+
174
+ const value = result . value . toQuintEx ( zerog )
175
+ if ( value . kind !== "bool" ) {
176
+ this . errorTracker . addRuntimeError ( assume . id , { code : 'QNT509' , message : 'Assume must be a boolean expression' } )
177
+ return
178
+ }
179
+
180
+ if ( ! value . value ) {
181
+ this . errorTracker . addRuntimeError ( assume . id , { code : 'QNT510' , message : 'Assumption failed' } )
182
+ }
183
+ }
184
+
161
185
exitOpDef ( opdef : ir . QuintOpDef ) {
162
186
// Either a runtime value, or a def, action, etc.
163
187
// All of them are compiled to callables, which may have zero parameters.
You can’t perform that action at this time.
0 commit comments