Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
initDepPkgs fix: allow pubName not found
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jul 23, 2022
1 parent 3d3e43d commit 8c6a367
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cl/multifiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ func initDepPkgs(pkg *gox.Package, deps *depPkgs) {
for _, dep := range deps.pkgs {
depPkg := pkg.Import(dep.path)
for _, pub := range dep.pubs {
obj := depPkg.Ref(pub.goName)
if old := scope.Insert(gox.NewSubst(token.NoPos, pkg.Types, pub.name, obj)); old != nil {
log.Panicf("conflicted name `%v` in %v, previous definition is %v\n", pub.name, dep.path, old)
if obj := depPkg.TryRef(pub.goName); obj != nil {
if old := scope.Insert(gox.NewSubst(token.NoPos, pkg.Types, pub.name, obj)); old != nil {
log.Panicf("conflicted name `%v` in %v, previous definition is %v\n", pub.name, dep.path, old)
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions testdata/libc/src/foo.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ typedef struct {
typedef size_t foo_t;

foo_t foo();
void unknown();

0 comments on commit 8c6a367

Please sign in to comment.