Refactor varname_to_string functions

Bug #690456 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Fix Released
Low
Matt Giuca

Bug Description

We started with ir.varname_to_string, which performed some annoying escaping to make the variable name look like a regular identifier. It turned out that this was only really useful for backends that generate code for programming languages (e.g., Python), and that was backend-specific. In most cases, it is best not to escape variable names. Thus ir.varname_to_string_noescape was born, which is now used throughout the codebase as a means of stringifying varnames. There is also ir.varname_to_string_dodgy and I'm not sure what that's used for, but it sounds ... dodgy.

No code anywhere should be using anything other than ir.varname_to_string_noescape. As a special exception, a future backend which generates programming code (such as Python or JavaScript) might have its own special escaping function, but that would be part of the backend, not core functionality.

Delete ir.varname_to_string and ir.varname_to_string_dodgy and fix up any calls to those functions. Rename ir.varname_to_string_noescape to simply ir.varname_string. I am sick of typing that.

Related branches

Revision history for this message
Matt Giuca (mgiuca) wrote :

The only remaining call to varname_to_string is in tables, in an error message. This would be improved by changing it into a call to varname_to_string_noescape. There are no remaining calls to varname_to_string_dodgy. I wonder what that was for?

summary: - Fix varname_to_string functions
+ Refactor varname_to_string functions
Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r1251.

Changed in mars:
status: Triaged → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.