mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
bind: error for packages with no exported names.
For error message improvement mentioned in golang/go#12842 Change-Id: I066ae9dc9415b34bf93128098199bbb935b7dedc Reviewed-on: https://go-review.googlesource.com/15410 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
committed by
Hyang-Ah Hana Kim
parent
45ed283c80
commit
bb506cefe4
@@ -668,11 +668,13 @@ func (g *javaGen) gen() error {
|
||||
|
||||
scope := g.pkg.Scope()
|
||||
names := scope.Names()
|
||||
hasExported := false
|
||||
for _, name := range names {
|
||||
obj := scope.Lookup(name)
|
||||
if !obj.Exported() {
|
||||
continue
|
||||
}
|
||||
hasExported = true
|
||||
|
||||
switch o := obj.(type) {
|
||||
// TODO(crawshaw): case *types.Var:
|
||||
@@ -700,6 +702,9 @@ func (g *javaGen) gen() error {
|
||||
g.errorf("unsupported exported type: %T", obj)
|
||||
}
|
||||
}
|
||||
if !hasExported {
|
||||
g.errorf("no exported names in the package %q", g.pkg.Path())
|
||||
}
|
||||
|
||||
for i, name := range funcs {
|
||||
g.Printf("private static final int CALL_%s = %d;\n", name, i+1)
|
||||
|
||||
Reference in New Issue
Block a user