---- per-tag downcast ---- Only the AST layer knows the concrete subclass behind each gc tag, so this is the one place that can recover a node's source `at`. MakeStruct (and any untagged node) carries no `at` of its own -> nullptr.
| 15 | // one place that can recover a node's source `at`. MakeStruct (and any untagged node) |
| 16 | // carries no `at` of its own -> nullptr. |
| 17 | static const LineInfo * gc_node_at ( const gc_node * node ) { |
| 18 | switch ( node->gc_type_tag() ) { |
| 19 | case GC_TAG_TYPEDECL: return &static_cast<const TypeDecl*>(node)->at; |
| 20 | case GC_TAG_EXPRESSION: return &static_cast<const Expression*>(node)->at; |
| 21 | case GC_TAG_MAKEFIELDDECL: return &static_cast<const MakeFieldDecl*>(node)->at; |
| 22 | case GC_TAG_FUNCTION: return &static_cast<const Function*>(node)->at; |
| 23 | case GC_TAG_ENUMERATION: return &static_cast<const Enumeration*>(node)->at; |
| 24 | case GC_TAG_STRUCTURE: return &static_cast<const Structure*>(node)->at; |
| 25 | case GC_TAG_VARIABLE: return &static_cast<const Variable*>(node)->at; |
| 26 | default: return nullptr; // MakeStruct, untagged, builtins |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | static const char * gc_tag_name ( uint16_t tag ) { |
| 31 | switch ( tag ) { |
no outgoing calls
no test coverage detected