| 222 | }; |
| 223 | |
| 224 | void printSimFunction ( TextWriter & ss, Context * context, Function * fun, SimNode * node, bool debugHash ) { |
| 225 | SimPrint prv(ss,context); |
| 226 | prv.displayHash = debugHash; |
| 227 | // append return type and result type |
| 228 | if ( debugHash ) { |
| 229 | ss << "// " << fun->name << " " << fun->getMangledName() << "\n"; |
| 230 | } |
| 231 | string resT = fun->result->describe(); |
| 232 | if ( debugHash ) { |
| 233 | ss << "(result " << resT << " "; |
| 234 | } |
| 235 | prv.write(resT.c_str(), uint32_t(resT.length())); |
| 236 | if ( debugHash ) { |
| 237 | ss << ")\n"; |
| 238 | } |
| 239 | for ( auto & arg : fun->arguments ) { |
| 240 | string argT = arg->type->describe(); |
| 241 | if ( debugHash ) { |
| 242 | ss << "(argument " << argT << " "; |
| 243 | } |
| 244 | prv.write(argT.c_str(), uint32_t(argT.length())); |
| 245 | if ( debugHash ) { |
| 246 | ss << ")\n"; |
| 247 | } |
| 248 | } |
| 249 | node->visit(prv); |
| 250 | } |
| 251 | |
| 252 | void printSimNode ( TextWriter & ss, Context * context, SimNode * node, bool debugHash ) { |
| 253 | SimPrint prv(ss,context); |