From 7188f7b210a8114be4e344bbfe3d4ff8d3ffdb01 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 25 Sep 2022 15:45:33 +0200 Subject: [PATCH] Pretty print THIS_TOKEN and SUPER_TOKEN Internally the special THIS_TOKEN("@") and SUPER_TOKEN("#") are used to represent the special `this` and `super` keywords in a component name. When printing an identifier replace the tokens with their keywords. This generates nicer error and debug messages. Signed-off-by: Lars-Peter Clausen --- pform_dump.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pform_dump.cc b/pform_dump.cc index fdf6fcfae..5b72cbeb4 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -87,7 +87,12 @@ ostream& operator<< (ostream&out, const index_component_t&that) ostream& operator<< (ostream&out, const name_component_t&that) { - out << that.name.str(); + if (that.name == THIS_TOKEN) + out << "this"; + else if (that.name == SUPER_TOKEN) + out << "super"; + else + out << that.name.str(); typedef std::list::const_iterator index_it_t; for (index_it_t idx = that.index.begin()