| 296 | |
| 297 | |
| 298 | void |
| 299 | SymbolTable::print () |
| 300 | { |
| 301 | if (TypeSpec::struct_list().size()) { |
| 302 | std::cout << "Structure table:\n"; |
| 303 | int structid = 1; |
| 304 | for (auto&& s : TypeSpec::struct_list()) { |
| 305 | if (! s) |
| 306 | continue; |
| 307 | std::cout << " " << structid << ": struct " << s->mangled(); |
| 308 | if (s->scope()) |
| 309 | std::cout << " (" << s->name() |
| 310 | << " in scope " << s->scope() << ")"; |
| 311 | std::cout << " :\n"; |
| 312 | for (size_t i = 0; i < (size_t)s->numfields(); ++i) { |
| 313 | const StructSpec::FieldSpec & f (s->field(i)); |
| 314 | std::cout << "\t" << f.name << " : " |
| 315 | << f.type.string() << "\n"; |
| 316 | } |
| 317 | ++structid; |
| 318 | } |
| 319 | std::cout << "\n"; |
| 320 | } |
| 321 | |
| 322 | std::cout << "Symbol table:\n"; |
| 323 | for (auto&& s : m_allsyms) { |
| 324 | if (s->is_structure()) |
| 325 | continue; |
| 326 | std::cout << "\t" << s->mangled() << " : "; |
| 327 | if (s->is_structure()) { |
| 328 | std::cout << "struct " << s->typespec().structure() << " " |
| 329 | << s->typespec().structspec()->name(); |
| 330 | } else { |
| 331 | std::cout << s->typespec().string(); |
| 332 | } |
| 333 | if (s->scope()) |
| 334 | std::cout << " (" << s->name() << " in scope " |
| 335 | << s->scope() << ")"; |
| 336 | if (s->is_function()) { |
| 337 | const FunctionSymbol *f = (const FunctionSymbol *) s; |
| 338 | const char *args = f->argcodes().c_str(); |
| 339 | int advance = 0; |
| 340 | args += advance; |
| 341 | std::cout << " function (" << m_comp.typelist_from_code(args) << ") "; |
| 342 | } |
| 343 | std::cout << "\n"; |
| 344 | } |
| 345 | std::cout << "\n"; |
| 346 | } |
| 347 | |
| 348 | |
| 349 |
nothing calls this directly
no test coverage detected