Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


SourceMapConsumer.originalPositionFor does not return correct value, unless at begining of mapping #74

brenmar opened this Issue · 1 comment

2 participants

brenmar Nick Fitzgerald

SourceMapConsumer.originalPositionFor does not return the original position it returns the position of the start of the block in which that position is found.

i.e. (where x and y are constant)

SourceMapConsumer.originalPositionFor({line: y, column: x});


SourceMapConsumer.originalPositionFor({line: y, column: x + 1});


SourceMapConsumer.originalPositionFor({line: y, column: x + 2});

Will all yield the same result if the positions all fall inside the same mapping - the start position of the mapping, which is incorrect.

Nick Fitzgerald

This is expected behavior. We can't make any assumptions about the relationship between the original sources and the generated source. If you want those to return different locations, create more mappings. I find that in general the best detail of mapping is one for every token.

Nick Fitzgerald fitzgen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.