-
Notifications
You must be signed in to change notification settings - Fork 40
add support for binary operator trees in annotations #182
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
olafurpg
left a comment
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.
Nice! I didn't know Java supported expressions inside annotations, but I'm not surprised. A few minor questions about the names, otherwise this looks good
semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbVisitor.java
Outdated
Show resolved
Hide resolved
| binOp.setOp(Semanticdb.BinaryOperator.MODULO); | ||
| break; | ||
| case LESS_THAN: | ||
| binOp.setOp(Semanticdb.BinaryOperator.LESSER); |
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.
Is there a motivation for using LESSER instead of LESS_THAN? What do you think about using the same names as the ones from the compiler?
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.
no motivation for the names, am completely not beholden to the choices 🙂
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.
In the absence of opinions I think it's best to use the same names as the compiler
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.
Ive updated a few of the names to closer match the compiler. For the shift operators, Ive taken some "creative freedom" to allow for imo nicer prefix-grouping.
Wouldve liked to group XOR/OR/AND, but theyre not just bitwise but logical too https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-15.22
semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbVisitor.java
Outdated
Show resolved
Hide resolved
69a451d to
088de87
Compare
088de87 to
30114ed
Compare
olafurpg
left a comment
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.
LGTM 🔥
|
Just as a heads up, ternary operators are still not included. If we come across actual usage of it (none found with a sourcegraph search), then we can look into that |
Previously, lsif-java would throw an exception for annotations in the form such as
@Annotation(IDENT + literal)or any other binary operation AST.This PR adds more to be upstreamed in scalameta/scalameta#2281
Closes #178