-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
parse global enums #1387
parse global enums #1387
Conversation
Codecov ReportBase: 95.71% // Head: 95.55% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #1387 +/- ##
==========================================
- Coverage 95.71% 95.55% -0.17%
==========================================
Files 14 16 +2
Lines 2826 2994 +168
==========================================
+ Hits 2705 2861 +156
- Misses 66 74 +8
- Partials 55 59 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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 implementation was written in a hurry, The review was done in the same manner. Hope the results won't get worst.
return value | ||
} | ||
return cv.Value | ||
} |
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 behavior of this function is quite unusual. it value is an ast.Expresion , it populates the ConstVariable type and value , otherwise, it returns a value that may be ni ?
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.
cv.Value is initialized in the func collectConstVariables
with a ast.Expr, and then will be reassigned with the evaluated non-nil value of integer or string type,so it would never be nil.
* enhancement: evaluate const across packages
Describe the PR
if a global custom type is defined based on an underlying integer or string type, it will be considered as an enum type.
an enum type exists with two extensions:
x-enum-varnames: record their names
x-enum-comments: record their comments associated to their names.
Relation issue
#1367