Merge branch 'master' of github.com:multilang-depends/depends

This commit is contained in:
gangz 2023-05-10 13:05:35 +08:00
commit 933150b026
2 changed files with 4 additions and 1 deletions

View File

@ -50,7 +50,7 @@ The CLI tool usage could be listed by ```depends --help```, like following:
-h, --help Display this help and exit
-s, --strip-leading-path Strip the leading path.
-m, --map Output DV8 dependency map file.
-m, --n-map-files Output DV8 dependency map file.
-p, --namepattern=<namePathPattern>
The name path separators.[default(/),dot(.)

View File

@ -150,6 +150,9 @@ public abstract class DependencyGenerator {
Entity fromFile = fromEntity.getAncestorOfType(FileEntity.class);
Entity toFile = toEntity.getAncestorOfType(FileEntity.class);
// If the toEntity is above the file level (e.g. a package), then toFile will be null.
if (toFile == null) return null;
return new DependencyDetail(
new LocationInfo(stripper.stripFilename(fromObject),typeOf(fromEntity),stripper.stripFilename(fromFile.getQualifiedName()),fromLineNumber),
new LocationInfo(stripper.stripFilename(toObject),typeOf(toEntity),stripper.stripFilename(toFile.getQualifiedName()),toEntity.getLine()));