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

jsux opened this Issue Aug 12, 2013 · 1 comment

2 participants


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.

Mozilla member

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.

@fitzgen fitzgen closed this Aug 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment