do not add private members references to index + add functional expressions to index
[idea/community.git] / jps / javac-ref-scanner-8 / src / org / jetbrains / jps / javac / ast / Javac8RefScanner.java
index 52a8f17abac717ea9598cab1d02cd28c505d86a6..265d1bf52e351b2f106be3d1f801f03323f5b09f 100644 (file)
@@ -6,7 +6,7 @@ import com.sun.source.tree.Tree;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.tree.JCTree;
-import org.jetbrains.jps.javac.ast.api.JavacRefSymbol;
+import org.jetbrains.jps.javac.ast.api.JavacDefSymbol;
 
 /**
  * Used via reflection in {@link JavacTreeRefScanner#createASTScanner()}
@@ -15,19 +15,18 @@ import org.jetbrains.jps.javac.ast.api.JavacRefSymbol;
 public class Javac8RefScanner extends JavacTreeRefScanner {
   @Override
   public Tree visitLambdaExpression(LambdaExpressionTree node, JavacTreeScannerSink sink) {
-    final Type type = ((JCTree.JCLambda)node).type;
+    JCTree.JCLambda lambda = (JCTree.JCLambda)node;
+    final Type type = lambda.type;
     final Symbol.TypeSymbol symbol = type.asElement();
-    sink.sinkReference(new JavacRefSymbol(symbol, Tree.Kind.LAMBDA_EXPRESSION));
-    //for (Symbol member : symbol.members().getElements()) {
-    //  sink.mySymbols.add(new JavacRefSymbol(member, Tree.Kind.LAMBDA_EXPRESSION));
-    //}
+    sink.sinkDeclaration(new JavacDefSymbol(symbol, Tree.Kind.LAMBDA_EXPRESSION, lambda.pos));
     return super.visitLambdaExpression(node, sink);
   }
 
   @Override
   public Tree visitMemberReference(MemberReferenceTree node, JavacTreeScannerSink sink) {
-    final Symbol methodSymbol = ((JCTree.JCMemberReference)node).sym;
-    sink.sinkReference(new JavacRefSymbol(methodSymbol, Tree.Kind.MEMBER_REFERENCE));
+    JCTree.JCMemberReference memberRef = (JCTree.JCMemberReference)node;
+    final Symbol methodSymbol = memberRef.sym;
+    sink.sinkDeclaration(new JavacDefSymbol(methodSymbol, Tree.Kind.MEMBER_REFERENCE, memberRef.pos));
     return super.visitMemberReference(node, sink);
   }
 }