-
Notifications
You must be signed in to change notification settings - Fork 60
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 #158 - handle identifier list containing an indexing expression #159
Conversation
The fix is wrong, In background the problem is that some kind of simplifications make the good fix harder than it looks. |
I've made a nicer fix. As expected i had to create a new AST node type, so that each indexer of the chain is stored. As expected too all the tools break: D-Scanner, D-Symbol. The user tools that used Type2 will also break. There's no other way to do that. I repeat myself but even if the bug was trivial, libdparse simplifies the AST so that things can be re-used ( Finally, if this get accepted i think that we should schedule this week, two hours during which the other tools could be fixed (because it requires each a time a review, a tag, etc). |
…ifierList can be named IdentifierList as in D specs - extern decl content is also an IdentifierList
This good now. Summary of the changes:
|
@@ -3867,3 +3903,35 @@ protected: | |||
"postblit" | |||
]; | |||
} | |||
|
|||
version (unittest) | |||
void testFormatNode(Node)(string sourceCode) |
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.
use this new function to fix #135 and also problems in harbored-mod (which uses dparse formatter apparently...)
Codecov Report
@@ Coverage Diff @@
## master #159 +/- ##
=========================================
- Coverage 81.68% 81.39% -0.3%
=========================================
Files 7 7
Lines 4542 4573 +31
=========================================
+ Hits 3710 3722 +12
- Misses 832 851 +19
Continue to review full report at Codecov.
|
src/dparse/parser.d
Outdated
* ;) | ||
* $(RULE identifierOrTemplateInstance) | ||
* | $(RULE identifierOrTemplateInstance) $(LITERAL '.') $(RULE identifierList) | ||
* | $(RULE identifierOrTemplateInstance) $(LITERAL '[') $(RULE assignExpression) $(LITERAL ']') $(LITERAL '.') $(RULE identifierList) |
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.
The language spec and I disagree on the idea of "IdentifierList" being only a list of identifiers.
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.
That and the idea of "lists" being separated by commas.
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.
It's a chain, clearly.
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'm not objecting to your change. It's consistent with the spec. I'm just upset with the spec.
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.
There must be "chain" in the name. It's not a list.
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.
The only other use is with extern(c++)
.
src/dparse/formatter.d
Outdated
stuff.accept(this); | ||
format(&fmt, stuff); | ||
assert(fmt.data.canFind(code), fmt.data); | ||
writeln(fmt.data); |
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.
gotta remove this writeln.
reverted. The changes are hard to handle. |
No description provided.