Commit Graph

6 Commits

Author SHA1 Message Date
Hamish Knight
c02fb8b1a1 [AST] Factor out printMemberwiseInit
Move the printing logic into libAST such that it can be used both by
the refactoring and by fix-it logic in Sema.
2025-12-08 23:22:35 +00:00
Hamish Knight
01b965fe3c [IDE] Use Identifier for printing member name in generateMemberwiseInit
Avoid relying on the source text and print the identifier, escaping
if needed.
2025-12-08 23:22:35 +00:00
Rintaro Ishizaki
b839718351 [AST] Use scoped enum for attribute kinds
Align with other kind enum e.g. DeclKind.
2024-02-02 09:36:48 -08:00
Rintaro Ishizaki
07bb0380a1 [AST] Use class names for type attribute kind enum
Align with DeclAttrKind.
2024-02-02 09:36:47 -08:00
John McCall
41cdfb04ad Introduce a proper TypeAttribute class hierarchy.
The old TypeAttributes reprsentation wasn't too bad for a small number of
simple attributes.  Unfortunately, the number of attributes has grown over
the years by quite a bit, which makes TypeAttributes fairly bulky even at
just a single SourceLoc per attribute.  The bigger problem is that we want
to carry more information than that on some of these attributes, which is
all super ad hoc and awkward.  And given that we want to do some things
for each attribute we see, like diagnosing unapplied attributes, the linear
data structure does require a fair amount of extra work.

I switched around the checking logic quite a bit in order to try to fit in
with the new representation better.  The most significant change here is the
change to how we handle implicit noescape, where now we're passing the
escaping attribute's presence down in the context instead of resetting the
context anytime we see any attributes at all.  This should be cleaner overall.

The source range changes around some of the @escaping checking is really a
sort of bugfix --- the existing code was really jumping from the @ sign
all the way past the autoclosure keyword in a way that I'm not sure always
works and is definitely a little unintentional-feeling.

I tried to make the parser logic more consistent around recognizing these
parameter specifiers; it seems better now, at least.
2024-01-28 22:30:26 -05:00
Alex Hoppen
a48d0f2579 [Refactoring] Move MemberwiseInitLocalRefactoring to its own file 2023-09-11 16:45:31 -07:00