sdedic commented on a change in pull request #997: Simplifying semantic
highlighter.
URL: https://github.com/apache/incubator-netbeans/pull/997#discussion_r234206866
##########
File path:
java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java
##########
@@ -1097,90 +978,18 @@ public Void visitMethod(MethodTree tree,
EnumSet<UseTypes> d) {
}
@Override
- public Void visitExpressionStatement(ExpressionStatementTree tree,
EnumSet<UseTypes> d) {
-// if (tree instanceof IdentifierTree) {
-// handlePossibleIdentifier(tree, EnumSet.of(UseTypes.READ));
-// }
-
- super.visitExpressionStatement(tree, null);
- return null;
- }
-
- @Override
- public Void visitParenthesized(ParenthesizedTree tree,
EnumSet<UseTypes> d) {
- ExpressionTree expr = tree.getExpression();
-
- if (expr instanceof IdentifierTree) {
- handlePossibleIdentifier(new TreePath(getCurrentPath(), expr),
EnumSet.of(UseTypes.READ));
- }
-
- super.visitParenthesized(tree, d);
- return null;
- }
-
- @Override
- public Void visitEnhancedForLoop(EnhancedForLoopTree tree,
EnumSet<UseTypes> d) {
- scan(tree.getVariable(), EnumSet.of(UseTypes.WRITE));
-
- if (tree.getExpression().getKind() == Kind.IDENTIFIER)
- handlePossibleIdentifier(new TreePath(getCurrentPath(),
tree.getExpression()), EnumSet.of(UseTypes.READ));
-
- scan(tree.getExpression(), null);
- scan(tree.getStatement(), null);
-
- return null;
- }
-
- private boolean isStar(ImportTree tree) {
- Tree qualIdent = tree.getQualifiedIdentifier();
-
- if (qualIdent == null || qualIdent.getKind() == Kind.IDENTIFIER) {
- return false;
- }
-
- return ((MemberSelectTree)
qualIdent).getIdentifier().contentEquals("*");
- }
-
- @Override
- public Void visitVariable(VariableTree tree, EnumSet<UseTypes> d) {
+ public Void visitVariable(VariableTree tree, Void p) {
tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(),
tree));
if (tree.getType() != null) {
- TreePath type = new TreePath(getCurrentPath(), tree.getType());
-
- if (type.getLeaf() instanceof ArrayTypeTree) {
- type = new TreePath(type, ((ArrayTypeTree)
type.getLeaf()).getType());
- }
-
- if (type.getLeaf().getKind() == Kind.IDENTIFIER)
- handlePossibleIdentifier(type, EnumSet.of(UseTypes.CLASS_USE));
- }
-
- Collection<UseTypes> uses = null;
-
- Element e = info.getTrees().getElement(getCurrentPath());
- if (tree.getInitializer() != null) {
- uses = EnumSet.of(UseTypes.DECLARATION, UseTypes.WRITE);
- if (tree.getInitializer().getKind() == Kind.IDENTIFIER)
- handlePossibleIdentifier(new TreePath(getCurrentPath(),
tree.getInitializer()), EnumSet.of(UseTypes.READ));
- } else {
- if (e != null && e.getKind() == ElementKind.FIELD) {
- uses = EnumSet.of(UseTypes.DECLARATION, UseTypes.WRITE);
- } else {
- uses = EnumSet.of(UseTypes.DECLARATION);
+ TreePath type = new TreePath(getCurrentPath(), tree.getType());
+
+ if (type.getLeaf() instanceof ArrayTypeTree) {
Review comment:
What about multi-dimensional arrays ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists