Skip to content

Commit 7a6cf8b

Browse files
committed
cl/convert:name generate & file generate
1 parent f887c1b commit 7a6cf8b

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

cl/internal/convert/convert.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/goplus/llcppg/ast"
99
cfg "github.com/goplus/llcppg/cmd/gogensig/config"
1010
llconfig "github.com/goplus/llcppg/config"
11+
ctoken "github.com/goplus/llcppg/token"
1112
)
1213

1314
var (
@@ -133,18 +134,20 @@ func (p *Converter) Process() {
133134
}
134135

135136
for _, macro := range p.Pkg.Macros {
136-
goName, goFile, err := p.Conf.NodeConv.ConvMacro(macro)
137-
// todo(zzy):goName to New Macro
138-
if err != nil {
139-
if errors.Is(err, ErrSkip) {
140-
continue
137+
if len(macro.Tokens) == 2 && macro.Tokens[1].Token == ctoken.LITERAL {
138+
goName, goFile, err := p.Conf.NodeConv.ConvMacro(macro)
139+
// todo(zzy):goName to New Macro
140+
if err != nil {
141+
if errors.Is(err, ErrSkip) {
142+
continue
143+
}
144+
// todo(zzy):refine error handing
145+
log.Panicln(err)
141146
}
142-
// todo(zzy):refine error handing
143-
log.Panicln(err)
147+
processNode(goFile, func() error {
148+
return p.GenPkg.NewMacro(macro, goName)
149+
})
144150
}
145-
processNode(goFile, func() error {
146-
return p.GenPkg.NewMacro(macro, goName)
147-
})
148151
}
149152

150153
for _, decl := range p.Pkg.Decls {

0 commit comments

Comments
 (0)