-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors build methods onto Context object
- Loading branch information
Showing
6 changed files
with
625 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
package parsing | ||
|
||
import "go/types" | ||
import ( | ||
"go/types" | ||
) | ||
|
||
type Argument struct { | ||
Name string | ||
Type types.Type | ||
Variadic bool | ||
Package string | ||
} | ||
|
||
func NewArgument(v *types.Var, variadic bool) Argument { | ||
var pkg string | ||
if t, ok := v.Type().(*types.Named); ok { | ||
if t.Obj().Pkg() != nil { | ||
pkg = t.Obj().Pkg().Path() | ||
} | ||
} | ||
|
||
return Argument{ | ||
Name: v.Name(), | ||
Type: v.Type(), | ||
Variadic: variadic, | ||
Package: pkg, | ||
} | ||
} |
Oops, something went wrong.