Skip to content

Commit

Permalink
Merge pull request #1634 from visualfc/parser_file
Browse files Browse the repository at this point in the history
parser: ParseFSDir/ParseFSEntry set class kind if file valid
  • Loading branch information
xushiwei committed Jan 16, 2024
2 parents eeee3f9 + cac3456 commit eddeaa2
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions parser/parser_gop.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,19 @@ func ParseFSDir(fset *token.FileSet, fs FileSystem, dir string, conf Config) (pk
} else {
first = err
}
} else if f, err := ParseFSFile(fset, fs, filename, nil, mode); err == nil {
f.IsProj, f.IsClass = isProj, isClass
f.IsNormalGox = isNormalGox
pkg := reqPkg(pkgs, f.Name.Name)
pkg.Files[filename] = f
} else if first == nil {
first = err
} else {
f, err := ParseFSFile(fset, fs, filename, nil, mode)
if f != nil {
f.IsProj, f.IsClass = isProj, isClass
f.IsNormalGox = isNormalGox
if f.Name != nil {
pkg := reqPkg(pkgs, f.Name.Name)
pkg.Files[filename] = f
}
}
if err != nil && first == nil {
first = err
}
}
}
}
Expand Down Expand Up @@ -214,7 +220,7 @@ func ParseFSEntry(fset *token.FileSet, fs FileSystem, filename string, src inter
mode |= ParseGoPlusClass
}
f, err = ParseFSFile(fset, fs, filename, src, mode)
if err == nil {
if f != nil {
f.IsProj, f.IsClass = isProj, isClass
f.IsNormalGox = isNormalGox
}
Expand Down

0 comments on commit eddeaa2

Please sign in to comment.