authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-05 03:09:17-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-05 03:09:17-04:00
logdfe8c5a2e9b1778c1911e987c9286d05db307fe7
treeedc23db0fb6afaa52e2ae9fff3ce0321d0ffe447
parenta7763c06f9941bdeccc0679abf863b21f7cc33a3
signature Commit is signed but in an unrecognized format.

add a src() method to AstNode to aid debugging


2 files changed, 10 insertions(+), 0 deletions(-)

src/all_types.hpp+4
...@@ -1009,6 +1009,10 @@ struct AstNode {...@@ -1009,6 +1009,10 @@ struct AstNode {
1009 AstNodeAnyFrameType anyframe_type;1009 AstNodeAnyFrameType anyframe_type;
1010 AstNodeEnumLiteral enum_literal;1010 AstNodeEnumLiteral enum_literal;
1011 } data;1011 } data;
1012
1013 // This is a function for use in the debugger to print
1014 // the source location.
1015 void src();
1012};1016};
10131017
1014// this struct is allocated with allocate_nonzero1018// this struct is allocated with allocate_nonzero
src/ast_render.cpp+6
...@@ -1186,3 +1186,9 @@ void ast_render(FILE *f, AstNode *node, int indent_size) {...@@ -1186,3 +1186,9 @@ void ast_render(FILE *f, AstNode *node, int indent_size) {
11861186
1187 render_node_grouped(&ar, node);1187 render_node_grouped(&ar, node);
1188}1188}
1189
1190void AstNode::src() {
1191 fprintf(stderr, "%s:%" ZIG_PRI_usize ":%" ZIG_PRI_usize "\n",
1192 buf_ptr(this->owner->data.structure.root_struct->path),
1193 this->line + 1, this->column + 1);
1194}