From 5ce8942fbcfcf577e52ef184faed6dc5114c0dc1 Mon Sep 17 00:00:00 2001 From: visualfc Date: Wed, 10 Jan 2024 15:48:52 +0800 Subject: [PATCH] cl: export classNameAndExt --- cl/builtin_test.go | 2 +- cl/classfile.go | 4 ++-- cl/compile.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cl/builtin_test.go b/cl/builtin_test.go index 899c5895e..5df2153d3 100644 --- a/cl/builtin_test.go +++ b/cl/builtin_test.go @@ -40,7 +40,7 @@ func getGoxConf() *gox.Config { } func TestClassNameAndExt(t *testing.T) { - name, ext := classNameAndExt("/foo/bar.abc_yap.gox") + name, ext := ClassNameAndExt("/foo/bar.abc_yap.gox") if name != "bar" || ext != "_yap.gox" { t.Fatal("classNameAndExt:", name, ext) } diff --git a/cl/classfile.go b/cl/classfile.go index f7f90b36b..727772891 100644 --- a/cl/classfile.go +++ b/cl/classfile.go @@ -60,7 +60,7 @@ func (p *gmxSettings) getScheds(cb *gox.CodeBuilder) []goast.Stmt { return p.schedStmts } -func classNameAndExt(file string) (name, ext string) { +func ClassNameAndExt(file string) (name, ext string) { fname := filepath.Base(file) name, ext = modfile.SplitFname(fname) if idx := strings.Index(name, "."); idx > 0 { @@ -70,7 +70,7 @@ func classNameAndExt(file string) (name, ext string) { } func newGmx(ctx *pkgCtx, pkg *gox.Package, file string, f *ast.File, conf *Config) *gmxSettings { - tname, ext := classNameAndExt(file) + tname, ext := ClassNameAndExt(file) gt, ok := conf.LookupClass(ext) if !ok { panic("TODO: class not found") diff --git a/cl/compile.go b/cl/compile.go index d11931456..696be9321 100644 --- a/cl/compile.go +++ b/cl/compile.go @@ -696,7 +696,7 @@ func preloadGopFile(p *gox.Package, ctx *blockCtx, file string, f *ast.File, con } case f.IsClass: var classExt string - classType, classExt = classNameAndExt(file) + classType, classExt = ClassNameAndExt(file) if parent.gmxSettings != nil { o, ok := parent.sprite[classExt] if ok {