diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2020-02-16 13:19:51 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-21 20:45:59 -0500 |
commit | be7068a6130f394dcefbcb5d09c2944deca2270d (patch) | |
tree | 7cebbd7dfa58087696b23335bce466104e97c317 /compiler/nativeGen/NCGMonad.hs | |
parent | 0482f58ab0490b2394ad60946dde3214a0ca1810 (diff) | |
download | haskell-be7068a6130f394dcefbcb5d09c2944deca2270d.tar.gz |
Parser API annotations: RealSrcLoc
During parsing, GHC collects lexical information about AST nodes and
stores it in a map. It is needed to faithfully restore original source
code, e.g. compare these expressions:
a = b
a = b
The position of the equality sign is not recorded in the AST, so it must
be stored elsewhere.
This system is described in Note [Api annotations].
Before this patch, the mapping was represented by:
Map (SrcSpan, AnnKeywordId) SrcSpan
After this patch, the mapping is represented by:
Map (RealSrcSpan, AnnKeywordId) RealSrcSpan
The motivation behind this change is to avoid using the Ord SrcSpan
instance (required by Map here), as it interferes with #17632 (see the
discussion there).
SrcSpan is isomorphic to Either String RealSrcSpan, but we shouldn't
use those strings as Map keys. Those strings are intended as hints to
the user, e.g. "<interactive>" or "<compiler-generated code>", so they
are not a valid way to identify nodes in the source code.
Diffstat (limited to 'compiler/nativeGen/NCGMonad.hs')
0 files changed, 0 insertions, 0 deletions