Skip to content

fix: preserve source.input.file when retokenizing inline comments - #179

Open
jdforrester wants to merge 1 commit into
shellscape:masterfrom
jdforrester:fix-source.input.file
Open

fix: preserve source.input.file when retokenizing inline comments#179
jdforrester wants to merge 1 commit into
shellscape:masterfrom
jdforrester:fix-source.input.file

Conversation

@jdforrester

Copy link
Copy Markdown

Which issue # if any, does this resolve? None filed

Please check one:

  • New tests created for this change
  • Tests updated for this change

This PR:

  • Adds new API
  • Extends existing API, backwards-compatible
  • Introduces a breaking change
  • Fixes a bug

The replacement Input built for the remainder of the file was constructed without options, so from was dropped and every node after an inline comment reported source.input.file === undefined. lib/index.js already repairs the start/end offsets the sub-tokenizer corrupts, but not source.input, so the missing path reached the returned AST.

Input does not retain its opts, so from is reconstructed from this.input.file rather than forwarded wholesale.

The replacement Input built for the remainder of the file was constructed
without options, so `from` was dropped and every node after an inline comment
reported `source.input.file === undefined`. lib/index.js already repairs the
start/end offsets the sub-tokenizer corrupts, but not `source.input`, so the
missing path reached the returned AST.

Input does not retain its opts, so `from` is reconstructed from
`this.input.file` rather than forwarded wholesale.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant