JamesHenry / typescript-estree

:sparkles: A parser that converts TypeScript source code into an ESTree-compatible form
https://jameshenry.blog
Other
84 stars 13 forks source link

fix: set parent nodes correctly for virtual files #78

Closed armano2 closed 5 years ago

armano2 commented 5 years ago

This PR fixes crashes and issues related to undefined parent node.

TypeError: Cannot read property 'kind' of undefined
      at Object.canContainDirective (src/node-utils.ts:5672:33)
      at convertBodyExpressionsToDirectives (src/convert.ts:18875:155)
      at convert (src/convert.ts:19401:13)
      at converter (src/convert.ts:18818:16)
      at convertChild (src/convert.ts:18835:16)
      at convert (src/convert.ts:19627:80)
      at converter (src/convert.ts:18818:16)
      at convertChild (src/convert.ts:18835:16)
      at node.statements.forEach.statement (src/convert.ts:19373:95)
          at Array.forEach (<anonymous>)

@JamesHenry this is important change, right now it can crash

fixes: #77

armano2 commented 5 years ago

@uniqueiniquity we don't need it but we will have to stop using parent, right now in some places it will crash and some ifs are going to fails..

JamesHenry commented 5 years ago

:tada: This PR is included in version 9.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: