@@ -53,7 +53,7 @@ func Doc(node ast.Node) string {
5353// The target can either be in the current program's scope or it can refer to
5454// an included file using dot notation. Included files must exist in one of the
5555// given search directories.
56- func Resolve (name string , program * ast.Program , dirs [] string ) (ast.Node , error ) {
56+ func Resolve (name string , program * ast.Program , parser * FileParser ) (ast.Node , error ) {
5757 defs := program .Definitions
5858
5959 if strings .Contains (name , "." ) {
@@ -73,7 +73,7 @@ func Resolve(name string, program *ast.Program, dirs []string) (ast.Node, error)
7373 return nil , fmt .Errorf ("missing \" include\" for type reference %q" , name )
7474 }
7575
76- program , _ , err := ParseFile (ipath , dirs )
76+ program , _ , err := parser . ParseFile (ipath )
7777 if err != nil {
7878 return nil , err
7979 }
@@ -98,12 +98,12 @@ func Resolve(name string, program *ast.Program, dirs []string) (ast.Node, error)
9898// - "Enum.Value" (ast.EnumItem)
9999// - "include.Constant" (ast.Constant)
100100// - "include.Enum.Value" (ast.EnumItem)
101- func ResolveConstant (ref ast.ConstantReference , program * ast.Program , dirs [] string ) (ast.Node , error ) {
101+ func ResolveConstant (ref ast.ConstantReference , program * ast.Program , parser * FileParser ) (ast.Node , error ) {
102102 parts := strings .SplitN (ref .Name , "." , 3 )
103103
104- n , err := Resolve (parts [0 ], program , dirs )
104+ n , err := Resolve (parts [0 ], program , parser )
105105 if err != nil && len (parts ) > 1 {
106- n , err = Resolve (parts [0 ]+ "." + parts [1 ], program , dirs )
106+ n , err = Resolve (parts [0 ]+ "." + parts [1 ], program , parser )
107107 }
108108 if err != nil {
109109 return n , fmt .Errorf ("%q could not be resolved" , ref .Name )
@@ -125,8 +125,8 @@ func ResolveConstant(ref ast.ConstantReference, program *ast.Program, dirs []str
125125// resolve the target node's own type. This is useful when the reference
126126// points to an [ast.Typedef] or [ast.Constant], for example, and the caller
127127// is primarily intererested in the target's ast.Type.
128- func ResolveType (ref ast.TypeReference , program * ast.Program , dirs [] string ) (ast.Node , error ) {
129- n , err := Resolve (ref .Name , program , dirs )
128+ func ResolveType (ref ast.TypeReference , program * ast.Program , parser * FileParser ) (ast.Node , error ) {
129+ n , err := Resolve (ref .Name , program , parser )
130130 if err != nil {
131131 return nil , err
132132 }
0 commit comments