diff --git a/pkg/service/features/app.feature b/pkg/service/features/app.feature index 3831217..c3c67fb 100644 --- a/pkg/service/features/app.feature +++ b/pkg/service/features/app.feature @@ -92,6 +92,7 @@ package test type device struct { a,b int c,d,e string + g [GPIO_count]bool } ``` * Результат: @@ -100,6 +101,7 @@ class device { public: int a,b; std::string c,d,e; + bool g[GPIO_count]; }; ``` diff --git a/pkg/service/type.go b/pkg/service/type.go index b856761..3670efe 100644 --- a/pkg/service/type.go +++ b/pkg/service/type.go @@ -30,6 +30,12 @@ func optionallyAddArrayDetails(s *ast.TypeSpec) (code string) { code += "]" return } +func optionallyAddArrayDetailsArrayType(a *ast.ArrayType) (code string) { + code += "[" + code += handleArrayLen(a) + code += "]" + return +} func handleArrayLen(a *ast.ArrayType) (code string) { return handleExpr(a.Len) @@ -59,6 +65,8 @@ func handleField(f *ast.Field) (code string) { code += handleIdentExpr(t) case *ast.FuncType: code += handleFuncDeclType(t) + case *ast.ArrayType: + code += handleArray(t) } code += " " @@ -70,6 +78,12 @@ func handleField(f *ast.Field) (code string) { code += handleIdentExpr(n) nado_zapyatuyu = true } + + switch t := f.Type.(type) { + case *ast.ArrayType: + code += optionallyAddArrayDetailsArrayType(t) + } + code += ";\n" return }