demo: getcwd; abi.TypeName fix: error interface is public
This commit is contained in:
11
_demo/getcwd/getcwd.go
Normal file
11
_demo/getcwd/getcwd.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/goplus/llgo/c"
|
||||||
|
"github.com/goplus/llgo/c/os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
wd := os.Getcwd(c.Alloca(os.PATH_MAX), os.PATH_MAX)
|
||||||
|
c.Printf(c.Str("cwd: %s\n"), wd)
|
||||||
|
}
|
||||||
@@ -154,7 +154,8 @@ func (b *Builder) TypeName(t types.Type) (ret string, pub bool) {
|
|||||||
return fmt.Sprintf("[%v]%s", t.Len(), ret), pub
|
return fmt.Sprintf("[%v]%s", t.Len(), ret), pub
|
||||||
case *types.Named:
|
case *types.Named:
|
||||||
o := t.Obj()
|
o := t.Obj()
|
||||||
return "_llgo_" + TypeName(o), o.Exported()
|
pkg := o.Pkg()
|
||||||
|
return "_llgo_" + FullName(pkg, o.Name()), (pkg == nil || o.Exported())
|
||||||
case *types.Interface:
|
case *types.Interface:
|
||||||
if t.Empty() {
|
if t.Empty() {
|
||||||
return "_llgo_any", true
|
return "_llgo_any", true
|
||||||
|
|||||||
Reference in New Issue
Block a user