@@ -231,7 +231,6 @@ struct SmtModule {
231
231
auto node_to_string = [&](FunctionalIR::Node n) { return scope[n.name ()]; };
232
232
SmtPrintVisitor<decltype (node_to_string)> visitor (node_to_string, scope);
233
233
234
- std::string nested_lets;
235
234
for (auto it = ir.begin (); it != ir.end (); ++it) {
236
235
const FunctionalIR::Node &node = *it;
237
236
@@ -241,31 +240,29 @@ struct SmtModule {
241
240
std::string node_name = replaceCharacters (scope[node.name ()]);
242
241
std::string node_expr = node.visit (visitor);
243
242
244
- nested_lets += " (let ( (" + node_name + " " + node_expr + " )) " ;
243
+ writer. print ( " (let ( (%s %s)) " , node_name. c_str (), node_expr. c_str ()) ;
245
244
}
246
245
247
- nested_lets += " (let (" ;
246
+ writer. print ( " (let (" ) ;
248
247
for (const auto &output : ir.outputs ()) {
249
248
std::string output_name = scope[output.first ];
250
249
const std::string output_assignment = ir.get_output_node (output.first ).name ().c_str ();
251
- nested_lets += " ( " + output_name + " " + replaceCharacters (output_assignment).substr (1 ) + " ) " ;
250
+ writer. print ( " (%s %s) " , output_name. c_str (), replaceCharacters (output_assignment).substr (1 ). c_str ()) ;
252
251
}
253
- nested_lets += " )" ;
254
- nested_lets += " (mk_outputs" ;
255
-
252
+ writer.print (" )" );
253
+ writer.print (" (mk_outputs" );
256
254
for (const auto &output : ir.outputs ()) {
257
255
std::string output_name = scope[output.first ];
258
- nested_lets += " " + output_name;
256
+ writer. print ( " %s " , output_name. c_str ()) ;
259
257
}
260
- nested_lets += " ) " ;
261
- nested_lets += " ) " ;
258
+ writer. print ( " ) " ) ;
259
+ writer. print ( " ) " ) ;
262
260
263
261
// Close the nested lets
264
262
for (size_t i = 0 ; i < ir.size () - ir.inputs ().size (); ++i) {
265
- nested_lets += " ) " ;
263
+ writer. print ( " ) " ) ;
266
264
}
267
265
268
- writer.print (" %s" , nested_lets.c_str ());
269
266
writer.print (" )" );
270
267
writer.print (" )\n " );
271
268
}
0 commit comments