@@ -48,23 +48,27 @@ public ImmutableList<ValueAssignment> asList() throws InterruptedException, Solv
4848 Preconditions .checkState (!isClosed ());
4949 ImmutableList .Builder <ValueAssignment > out = ImmutableList .builder ();
5050
51- // Iterate through constants.
52- for (int constIdx = 0 ; constIdx < Native .modelGetNumConsts (z3context , model ); constIdx ++) {
53- long keyDecl = Native .modelGetConstDecl (z3context , model , constIdx );
54- Native .incRef (z3context , keyDecl );
55- out .addAll (getConstAssignments (keyDecl ));
56- Native .decRef (z3context , keyDecl );
57- }
51+ try {
52+ // Iterate through constants.
53+ for (int constIdx = 0 ; constIdx < Native .modelGetNumConsts (z3context , model ); constIdx ++) {
54+ long keyDecl = Native .modelGetConstDecl (z3context , model , constIdx );
55+ Native .incRef (z3context , keyDecl );
56+ out .addAll (getConstAssignments (keyDecl ));
57+ Native .decRef (z3context , keyDecl );
58+ }
5859
59- // Iterate through function applications.
60- for (int funcIdx = 0 ; funcIdx < Native .modelGetNumFuncs (z3context , model ); funcIdx ++) {
61- long funcDecl = Native .modelGetFuncDecl (z3context , model , funcIdx );
62- Native .incRef (z3context , funcDecl );
63- if (!isInternalSymbol (funcDecl )) {
64- String functionName = z3creator .symbolToString (Native .getDeclName (z3context , funcDecl ));
65- out .addAll (getFunctionAssignments (funcDecl , funcDecl , functionName ));
60+ // Iterate through function applications.
61+ for (int funcIdx = 0 ; funcIdx < Native .modelGetNumFuncs (z3context , model ); funcIdx ++) {
62+ long funcDecl = Native .modelGetFuncDecl (z3context , model , funcIdx );
63+ Native .incRef (z3context , funcDecl );
64+ if (!isInternalSymbol (funcDecl )) {
65+ String functionName = z3creator .symbolToString (Native .getDeclName (z3context , funcDecl ));
66+ out .addAll (getFunctionAssignments (funcDecl , funcDecl , functionName ));
67+ }
68+ Native .decRef (z3context , funcDecl );
6669 }
67- Native .decRef (z3context , funcDecl );
70+ } catch (Z3Exception e ) {
71+ throw z3creator .handleZ3Exception (e );
6872 }
6973
7074 return out .build ();
0 commit comments