-
Notifications
You must be signed in to change notification settings - Fork 110
More features for ConstantReader #180
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
|
@matanlurey appease the travis gods... |
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.
One question
| dependencies: | ||
| analyzer: '>=0.29.2 <0.31.0' | ||
| build: ^0.9.0 | ||
| collection: ^1.1.2 |
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.
was this an oops from a previous commit?
| var element = root; | ||
| while (element != null) { | ||
| final field = element.getField(name); | ||
| if (field != null) { |
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.
[nit] consider collapsing this to 1 line so it doesn't take more visual weight than it earns.
| element = element.supertype?.element; | ||
| } | ||
| final allFields = root.fields.toSet(); | ||
| root.allSupertypes.forEach((t) => allFields.addAll(t.element.fields)); |
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.
Could use a for loop, or I think it might still fit on 1 line to split this into 2 steps.
root.allSupertype.map((t) => t.element.fields).forEach(allFields.addAll);
or
allFields.addAll(root.allSupertypes.expand((t) => t.element.fields));
| /// Throws [FormatException] if [isInt] is `false`. | ||
| int get intValue; | ||
|
|
||
| /// Returns whether this constant represents a `List` literal. |
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.
[nit] get methods should be documented like a variable or a field - with a noun so you can omit 'Returns'.
Similar below.
|
@natebosch Oops. I just saw this after refreshing. I'll fix comments upstream. |
* Add a Constant helper class. * Add List and Map. * Add missing field handling. * Oops. * Fix tests.
* Add a Constant helper class. * Add List and Map. * Add missing field handling. * Oops. * Fix tests.
Closes #173
FormatExceptionCloses #169
listValueandmapValue