Skip to content

change rangePos() in Globals to always return a range position #2110

@scabug

Description

@scabug

Hi all,

I have a plugin which requires range positions for tree elements, so I can locate corresponding source. While it would suffice to have a plugin-specific option (e.g. detect if a plugin requires range positions to be maintained), I'm not convinced that the code complexity is worth it (also, if accepted, the interpreter's Global could be simplified to not override this). Stripping off the start and end data from each position object seems to be a premature optimization.

I did some benchmarks of compiling scala, and it doesn't seem to make much of a difference. For the first four, I ran `ant` after `ant clean`; the last was one run of `ant strap.lib` (sorry there aren't that many runs, the entire thing takes quite a bit of time).

rangepos: 8:34, 8:23, 8:27, 8:25; strap.lib 2:15
offset position: 8:18, 8:22, 8:32, 8:29; strap.lib 2:13

Also, if anyone wants another plugin example for documentation, I could try to get authorization to post that on a public URL (mine adds a unique identifier constant to a few function calls, and emits an XML file with source locations).

regards,
Nicholas

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions