absolutePath
should be available for imports in the AST when using stopAfter: parsing
#11756
Labels
absolutePath
should be available for imports in the AST when using stopAfter: parsing
#11756
Abstract
Tools should be using
absolutePath
fromImportDirective
AST node for more reliable import resolution but it's not available whenstopAfter: parsing
option is used - even though that's when they need it the most.Motivation
One of the uses case for
stopAfter: parsing
is to make it possible for tools to easily scan source files for imports. The raw path used in the import statement however is of limited utility - many tools are actually interested in a resolved path that can be used as a key insources
in Standard JSON. This resolution must account for relative imports and remappings and current compiler logic for doing that is full of unintuitive corner cases so it's easy to get it wrong. Doing it wrong, however, results in the compiler not being able to find the file matching the import where it expects it to be.The compiler does make the resolved path available in the AST but it's not there yet when
stopAfter: parsing
setting is used.Specification
Either perform import resolution earlier so that
absolutePath
is already in the AST whenstopAfter: parsing
is used or introduce a new value forstopAfter
(parsingAndImportResolution
?) that still stops before analysis but after import resolution.Backwards Compatibility
Making a previously unavailable AST key available is fully backwards-compatible.
Example showing the current output
With
stopAfter: parsing
Input
AST from the output
Without
stopAfter: parsing
Input
AST from the output
The text was updated successfully, but these errors were encountered: