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

Bug on ExportDefatultDeclaration's sourcemap generation #373

Open
clark-t opened this issue Jun 8, 2018 · 0 comments
Open

Bug on ExportDefatultDeclaration's sourcemap generation #373

clark-t opened this issue Jun 8, 2018 · 0 comments

Comments

@clark-t
Copy link

clark-t commented Jun 8, 2018

Bug description

raw code like:

export default {
  a() {}
}

escodegen generates sourcemap now is:

{
  mappings: 'AAAA;AAAA;AAAA;AAAA',
  // other properties
}

the correct sourcemap should be:

{
  mappings: 'AAAA,eAAe;AAAA,IACdA,CAAA,GAAI;AAAA,KADU;AAAA,CAAf'
}

Reason

I found out that L1213 cause this problem, which this.generateExpression(xxx) + this.semicolon(flags) turns SourceNode tree into string and lost sourcemap information.

I think the correct code should be:

// LINE 1213
result = join(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT));
result.push(this.semicolon(flags));
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

No branches or pull requests

1 participant