-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ASTGen] Generate anonymous closure parameters #79232
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
Conversation
@swift-ci Please smoke test |
b6fa326
to
cb049d8
Compare
@swift-ci Please smoke test |
return llvm::isa_and_present<swift::ClosureExpr>( | ||
llvm::dyn_cast<swift::AbstractClosureExpr>(dc.unbridged())); |
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.
I believe you should be able to directly check for ClosureExpr
since that implements classof
for DeclContext
return llvm::cast<swift::ClosureExpr>( | ||
llvm::cast<swift::AbstractClosureExpr>(dc.unbridged())); |
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.
Same
let param = BridgedParamDecl.createParsed( | ||
self.ctx, | ||
declContext: expr.asDeclContext, | ||
specifierLoc: nil, | ||
argName: nil, | ||
argNameLoc: nil, | ||
paramName: ctx.getDollarIdentifier(idx), | ||
paramNameLoc: loc, | ||
type: nil, | ||
defaultValue: nil | ||
) | ||
param.setSpecifier(.default) | ||
param.setImplicit() |
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.
IMO it would be nicer to expose a createImplicit
method, but I don't feel too strongly about it
case UInt8(ascii: "0")...UInt8(ascii: "9"): | ||
let digit = Int(c &- UInt8(ascii: "0")) | ||
result = result * 10 + digit |
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 TIL we allow $0001
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.
oh no
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.
Even $0000
😅
Let me address the review comments in followups |
E.g.
$0
Unlike C++ parser, scan the body for
$n
references upfront to createParameterList
, before generating the body.