Refine the template to fix excessive newlines
This commit is contained in:
28
types.go
28
types.go
@@ -1,10 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
type (
|
||||
Class struct {
|
||||
ClassName string
|
||||
Fields []Field
|
||||
Methods []Method
|
||||
ClassName string
|
||||
Fields []Field
|
||||
Methods []Method
|
||||
Constructors []Constructor
|
||||
}
|
||||
Field struct {
|
||||
Name string
|
||||
@@ -26,4 +32,20 @@ type (
|
||||
Type string
|
||||
Comment string
|
||||
}
|
||||
Constructor struct {
|
||||
Params []Param
|
||||
Comment string
|
||||
}
|
||||
)
|
||||
|
||||
func (c *Class) GetOutFile() (*os.File, error) {
|
||||
if c.ClassName == "" {
|
||||
return nil, fmt.Errorf("ClassName is empty")
|
||||
}
|
||||
filename := fmt.Sprintf("%s.lua", c.ClassName)
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user