chore:remove the capital of Path

This commit is contained in:
luoliwoshang
2024-08-15 09:27:41 +08:00
parent 6b1bc15f37
commit f613316046
3 changed files with 16 additions and 15 deletions

View File

@@ -271,7 +271,9 @@ func (ct *Converter) ProcessBuiltinType(t clang.Type) *ast.BuiltinType {
kind = ast.Float128 kind = ast.Float128
default: default:
// like IBM128,NullPtr,Accum // like IBM128,NullPtr,Accum
fmt.Fprintln(os.Stderr, "todo: unknown builtin type:", c.GoString(t.Kind.String().CStr())) kindStr := t.Kind.String()
defer kindStr.Dispose()
fmt.Fprintln(os.Stderr, "todo: unknown builtin type:", c.GoString(kindStr.CStr()))
} }
if IsExplicitSigned(t) { if IsExplicitSigned(t) {

View File

@@ -2,7 +2,7 @@
Test Case 1: Test Case 1:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,
@@ -28,7 +28,7 @@ Test Case 1:
Test Case 2: Test Case 2:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,
@@ -64,7 +64,7 @@ Test Case 2:
Test Case 3: Test Case 3:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,
@@ -110,7 +110,7 @@ Test Case 3:
Test Case 4: Test Case 4:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,
@@ -158,7 +158,7 @@ Test Case 4:
Test Case 5: Test Case 5:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,
@@ -208,7 +208,7 @@ Test Case 5:
Test Case 6: Test Case 6:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,
@@ -262,7 +262,7 @@ Test Case 6:
Test Case 7: Test Case 7:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,
@@ -313,7 +313,7 @@ Test Case 7:
Test Case 8: Test Case 8:
{ {
"temp.h": { "temp.h": {
"Path": "temp.h", "path": "temp.h",
"decls": [{ "decls": [{
"Loc": null, "Loc": null,
"Doc": null, "Doc": null,

View File

@@ -9,15 +9,13 @@ import (
func (ct *Converter) GetFilesJSON() *cjson.JSON { func (ct *Converter) GetFilesJSON() *cjson.JSON {
root := cjson.Object() root := cjson.Object()
for _, file := range ct.files { for _, file := range ct.files {
f := cjson.Object() root.SetItem(c.AllocaCStr(file.Path), ct.FileJSON(file))
f.SetItem(c.Str("Path"), cjson.String(c.AllocaCStr(file.Path)))
ct.FileJSON(file, f)
root.SetItem(c.AllocaCStr(file.Path), f)
} }
return root return root
} }
func (ct *Converter) FileJSON(file *ast.File, root *cjson.JSON) { func (ct *Converter) FileJSON(file *ast.File) *cjson.JSON {
root := cjson.Object()
decls := cjson.Array() decls := cjson.Array()
includes := cjson.Array() includes := cjson.Array()
macros := cjson.Array() macros := cjson.Array()
@@ -26,9 +24,11 @@ func (ct *Converter) FileJSON(file *ast.File, root *cjson.JSON) {
decls.AddItem(ct.DeclJSON(decl)) decls.AddItem(ct.DeclJSON(decl))
} }
root.SetItem(c.Str("path"), cjson.String(c.AllocaCStr(file.Path)))
root.SetItem(c.Str("decls"), decls) root.SetItem(c.Str("decls"), decls)
root.SetItem(c.Str("includes"), includes) root.SetItem(c.Str("includes"), includes)
root.SetItem(c.Str("macros"), macros) root.SetItem(c.Str("macros"), macros)
return root
} }
func (ct *Converter) DeclJSON(decl ast.Decl) *cjson.JSON { func (ct *Converter) DeclJSON(decl ast.Decl) *cjson.JSON {
@@ -106,7 +106,6 @@ func (ct *Converter) TypeJSON(t ast.Expr) *cjson.JSON {
} }
list := cjson.Array() list := cjson.Array()
for _, c := range d.List { for _, c := range d.List {
println(c.Text)
list.AddItem(ct.TypeJSON(c)) list.AddItem(ct.TypeJSON(c))
} }
root.SetItem(c.Str("List"), list) root.SetItem(c.Str("List"), list)