Skip to content

Refactor range handling #112

Open
Open

Description

@differentmatt

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions