dillon1000/react
Commit
Browse files Resolve type aliases
The goal of this PR is to move towards a uniform representation for all type declarations, whether they are named type aliases, function declarations, or inline annotations. We now assign every non-primitive type declaration (named or anonymous) a unique DeclarationId. In the next PR, we'll also re-map inline annotations back to this declaration id when encountering them. This PR is extremely gross and my intent is to refactor a bunch of things in the HIR to allow this to be less gross. Challenges: * Babel name resolution requires using scopes but i really want to just work with plain nodes, since NodePath and TypeScript do _not_ get along. So here, i find all identifiers and store a mapping of identifier -> scope, so that i can later look them up if necessary. * HIR doesn't have a notion of a declaration id, and in general we don't want to extend HIR. So i end up with a whole bunch of side table information and indirection. For example, a function doesn't know it's own declaration id. So we have to look it up. Function params don't track their Forest type, so we have to look them up on the function declaration. Etc.
Changed paths1 file
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…