Commit Graph
7 Commits
Author SHA1 Message Date
Richard SmithandJon Ross-Perkins 0c33dead70 Remove the type field from semantics nodes that don't produce values of that type. (#3049)
For `Assign` and `ReturnExpression`, this field wasn't used for
anything. For `StructTypeField`, we stored the type of the field here,
and now store it as an argument of the node instead.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2023-08-02 17:30:27 +00:00
Richard Smith ab709b4117 Fix crash type-checking member access into an invalid expression. (#3046)
Found by fuzzer.
2023-08-01 21:47:13 +00:00
Richard Smith c4b880c6ef Parsing for pointer types and pointer operators. (#3026)
This provides parsing support for the functionality added in #2006.
2023-07-26 21:24:54 +00:00
Jon Ross-Perkins 446b0ce4ae Refactor declaration name context logic to its own class. (#2989)
This started with cleaning up the remaining Name/expression type punning
in the node stack, and grew. I'm factoring out a class because we've
previously expressed the desire to factor logic out of SemanticsContext
where possible, and this seemed like a reasonable cut.

NameExpression as the first node as a QualifiedExpression allows the
qualifier handling to consider Name in one less spot, an incremental
simplification. However, the additional complexity caused by this makes
me split ApplyNameQualifier/ApplyExpressionQualifier in order to avoid
repeat checks of the parse node's kind. The logic is still largely
shared, thus a couple helper functions. I think this is all fairly well
structured in the isolated class.

I can see that we may want to avoid passing SemanticsContext as an
argument in the future if it elides a step of lookup.
2023-07-17 21:55:29 +00:00
Jon Ross-Perkins 43065a1257 Finish refactoring Push/Pop for stronger type handling. (#2987)
This adds a distinction between Unused and SoloParseNode, rather than
equating the two. This is intended to help identify nodes which are
getting pushed but maybe don't need to be.

Not totally done because I want to adjust declaration name handling due
to a quirk with how it mixes Name with Expression, but almost done. Once
that's done the type punning will be completely gone.
2023-07-14 23:16:16 +00:00
Jon Ross-Perkins 9751b4701d Start node stack push/pop setting IdT based on ParseNodeKind. (#2985)
I think there's more we can do here, but this seemed like a good
checkpoint to make sure the path I'm going down is roughly what you
expected. There's one actual edit in if expression structure to match
the increased enforcement.
2023-07-12 23:26:53 +00:00
Jon Ross-Perkins 239cdcc457 Finish splitting out semantics_handle.cpp (#2976)
I was running into some difficult merges in #2940, so I'm wanting to
finish splitting this last file to minimize the chance of future issues.
2023-07-06 22:56:36 +00:00