Improved type system
This commit is contained in:
@ -10,25 +10,27 @@ func ByName(name string, pkg string, structs map[string]*Struct) Type {
|
||||
to := strings.TrimPrefix(name, "*")
|
||||
typ := ByName(to, pkg, structs)
|
||||
|
||||
if typ != nil {
|
||||
return &Pointer{To: typ}
|
||||
if typ == Any {
|
||||
return AnyPointer
|
||||
}
|
||||
|
||||
return nil
|
||||
return &Pointer{To: typ}
|
||||
}
|
||||
|
||||
if strings.HasPrefix(name, "[]") {
|
||||
to := strings.TrimPrefix(name, "[]")
|
||||
typ := ByName(to, pkg, structs)
|
||||
|
||||
if typ != nil {
|
||||
return &Array{Of: typ}
|
||||
if typ == Any {
|
||||
return AnyArray
|
||||
}
|
||||
|
||||
return nil
|
||||
return &Array{Of: typ}
|
||||
}
|
||||
|
||||
switch name {
|
||||
case "Any":
|
||||
return Any
|
||||
case "Int":
|
||||
return Int
|
||||
case "Int64":
|
||||
@ -45,8 +47,6 @@ func ByName(name string, pkg string, structs map[string]*Struct) Type {
|
||||
return Float64
|
||||
case "Float32":
|
||||
return Float32
|
||||
case "Pointer":
|
||||
return AnyPointer
|
||||
}
|
||||
|
||||
typ, exists := structs[pkg+"."+name]
|
||||
|
Reference in New Issue
Block a user