-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
fix #20645 - implement C++ style init-statement
for if
#20653
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request and interest in making D better, @thewilsonator! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
init-statement
for `ifinit-statement
for if
auto param = parseAssignCondition(); | ||
auto condition = parseExpression(); |
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.
Silly question: why does the old code do parseAssignCondition
followed by parseExpression
? Does parseAssignCondition
not eat tokens?
Unlike with for
which (assuming its there) unconditionally parses a statement before the first semicolon, I think here we would need to determine if there is a semicolon present before deciding wether or not to sparse a statement or an expression 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.
parseAssignCondition
only eats tokens if it sits on a storage class. If it does not, it just returns null
. It also does not parse an initializer.
AFAIU, in if(auto x = e)
, parseAssignCondition
parses the auto x =
part, and parseExpression
parses the e
part.
Hello I'm baz from styx-lang. What you're doing is bad. What you need is "variable declaration" as a primary expression, but you guys keep on making special cases every each time Manu is upset. |
Sill to do
switch