未验证 提交 71f7e0e9 编写于 作者: P Phodal HUANG

fix: any import issue

上级 a7ec0597
...@@ -3,7 +3,6 @@ package base ...@@ -3,7 +3,6 @@ package base
import ( import (
. "../../language/java" . "../../language/java"
. "./models" . "./models"
"fmt"
) )
var node *JFullIdentifier; var node *JFullIdentifier;
...@@ -24,6 +23,9 @@ func (s *JavaRefactorListener) EnterPackageDeclaration(ctx *PackageDeclarationCo ...@@ -24,6 +23,9 @@ func (s *JavaRefactorListener) EnterPackageDeclaration(ctx *PackageDeclarationCo
func (s *JavaRefactorListener) EnterImportDeclaration(ctx *ImportDeclarationContext) { func (s *JavaRefactorListener) EnterImportDeclaration(ctx *ImportDeclarationContext) {
importText := ctx.QualifiedName().GetText() importText := ctx.QualifiedName().GetText()
if ctx.MUL() != nil {
importText = importText + ".*"
}
startLine := ctx.GetStart().GetLine() startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine() stopLine := ctx.GetStop().GetLine()
...@@ -99,7 +101,6 @@ func (s *JavaRefactorListener) EnterLambdaParameters(ctx *LambdaParametersContex ...@@ -99,7 +101,6 @@ func (s *JavaRefactorListener) EnterLambdaParameters(ctx *LambdaParametersContex
func (s *JavaRefactorListener) EnterMethodCall(ctx *MethodCallContext) { func (s *JavaRefactorListener) EnterMethodCall(ctx *MethodCallContext) {
text := ctx.IDENTIFIER().GetText() text := ctx.IDENTIFIER().GetText()
fmt.Println(ctx.IDENTIFIER().GetText(), "......")
startLine := ctx.GetStart().GetLine() startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine() stopLine := ctx.GetStop().GetLine()
field := &JField{text, node.Pkg, startLine, stopLine} field := &JField{text, node.Pkg, startLine, stopLine}
......
...@@ -62,11 +62,12 @@ func handleNode(node *JFullIdentifier) { ...@@ -62,11 +62,12 @@ func handleNode(node *JFullIdentifier) {
for index := range imports { for index := range imports {
imp := imports[index] imp := imports[index]
ss := strings.Split(imp.Name, ".") ss := strings.Split(imp.Name, ".")
fmt.Println(ss)
lastField := ss[len(ss)-1] lastField := ss[len(ss)-1]
var isOk = false var isOk = false
for _, field := range fields { for _, field := range fields {
if field.Name == lastField { if field.Name == lastField || lastField == "*" {
isOk = true isOk = true
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册