-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ASTGen] Generate MagicIdentifierLiteralExpr #79353
Conversation
@swift-ci Please smoke test |
3e674a8
to
2edc31e
Compare
Nothing is using it.
2edc31e
to
563ddc4
Compare
@swift-ci Please smoke test |
default: | ||
// Fallback to MacroExpansionExpr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to handle things like #error
, #warning
, #assert
, #fileLiteral
, #colorLiteral
, and #imageLiteral
, right? Would it be worth bridging an enum for POUND_KEYWORD
such that we make sure we don't miss any cases here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I thought #fileLiteral
et al were removed from the language, yeah we might want a bridging enum for POUND_OBJECT_LITERAL
(i.e. ObjectLiteralExpr::LiteralKind
).
As for #error
, #warning
, and #assert
, they are not expressions so we can't handle it here.
#assert
is a statement, #warrning
and #error
are decl, considering how to handle them in ASTGen and POUND_KEYWORD
would include some noise (i.e. #if
, #sourceLocation
etc.), I'm not sure POUND_KEYWORD
bridging enum would be beneficial. I will think about it.
Anyway, thank you for reminding me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for
#error
,#warning
, and#assert
, they are not expressions so we can't handle it here.
We'd want to diagnose them though, right? AFAIK swift-syntax won't reject them
E.g.
#file
. These are parsed asMacroExpansionExprSyntax
in SwiftParser.Also while I'm here, eliminate
SYNTAX_KIND
from MagicIdentifierKinds.def because nothing is using it anymore.