-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.go
41 lines (37 loc) · 841 Bytes
/
structs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"go/ast"
"go/token"
"golang.org/x/tools/go/types"
)
// Library represents a collection of classes, variables, and functions.
type Library struct {
Name string
Classes map[string]*Class
Interfaces []*ast.GenDecl
FuncTypes []*ast.GenDecl
Funcs []*ast.FuncDecl
Vars []*ast.GenDecl
Types *types.Info
Imports []*ast.ImportSpec
Files []string
CommentMap []ast.CommentMap
Fset *token.FileSet
}
func NewLibrary() *Library {
return &Library{
Name: "",
Classes: map[string]*Class{},
Interfaces: []*ast.GenDecl{},
Funcs: []*ast.FuncDecl{},
Vars: []*ast.GenDecl{},
Types: nil,
Imports: []*ast.ImportSpec{},
}
}
// Class represents a dart class
type Class struct {
Name string
Fields []*ast.Field
Methods []*ast.FuncDecl
}