Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor range handling #112

Open
differentmatt opened this issue Oct 10, 2014 · 0 comments
Open

Refactor range handling #112

differentmatt opened this issue Oct 10, 2014 · 0 comments

Comments

@differentmatt
Copy link
Contributor

We need to cleanup range handling in Aether. There is currently a lot of range calculating code, all with different assumptions and consumers.

Complications

We have three variations of ranges

  1. Original user code
  2. Wrapped user code, no indentation
  3. Wrapped user code, with indentation (e.g. Python)

We have two types of range objects
[10, 40]
[ { ofs : 6, row : 1, col : 0 }, { ofs : 19, row : 1, col : 13 } ]

We need to return errors to Aether clients with original ranges, because the clients don't know what crazy things we've done to their code. Internal to Aether we need to have nodes with range info accurate for the current stage of processing (e.g. post-normalization), so we can accurately process and modify it.

Errors thrown from some transforms are not passed through a per-language processor so we hack it in on the fly:
https://github.com/codecombat/aether/blob/master/src/transforms.coffee#L300
https://github.com/codecombat/aether/blob/master/src/problems.coffee#L27

We have per-reporter processing and per-language processing.

Suggestions

Consolidate all our range handling into one place.

Clearly document the input, output, and why when we're translating one range to another. This stuff is not fun to modify after it's been marinating for awhile.

Add Python-compatible indentation for all languages so Python doesn't wreck us with one-offs (nice suggestion @nwinter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant