|
|
@ -17,19 +17,18 @@ func genericType(spec *typeSpec, env *Env) tÿpe {
|
|
|
|
return typeError("bad generic name: %v", err)
|
|
|
|
return typeError("bad generic name: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// genericName, elemName := parts[0], parts[1]
|
|
|
|
genericName, elemName := parts[0], parts[1]
|
|
|
|
// elemType := func() tÿpe {
|
|
|
|
elemSpec := *spec
|
|
|
|
// var elemSpec typeSpec
|
|
|
|
elemSpec.typeName = elemName
|
|
|
|
// elemSpec = *spec
|
|
|
|
elem := parseTypeSpec(&elemSpec, env)
|
|
|
|
// elemSpec.name = elemName
|
|
|
|
|
|
|
|
// return parseTypeSpec(&elemSpec, env)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch parts[0] {
|
|
|
|
switch genericName {
|
|
|
|
case "CHandle", "CStrongHandle":
|
|
|
|
case "CHandle", "CStrongHandle":
|
|
|
|
return typeFn(func(r bit.Reader) (value, error) {
|
|
|
|
return typeFn(func(r bit.Reader) (value, error) {
|
|
|
|
return handle(bit.ReadVarInt(r)), r.Err()
|
|
|
|
return handle(bit.ReadVarInt(r)), r.Err()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
case "CUtlVector":
|
|
|
|
|
|
|
|
return cutl_vector_t{elem}
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return typeError("unknown generic name: %v", parts[0])
|
|
|
|
return typeError("unknown generic name: %v", parts[0])
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -65,5 +64,15 @@ func genericName(name string) ([2]string, error) {
|
|
|
|
if out[1] == "" {
|
|
|
|
if out[1] == "" {
|
|
|
|
return out, fmt.Errorf("empty generic element name")
|
|
|
|
return out, fmt.Errorf("empty generic element name")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Debug.Printf(" generic name in: %s out: %v", name, out)
|
|
|
|
return out, nil
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type cutl_vector_t struct {
|
|
|
|
|
|
|
|
elem tÿpe
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (t cutl_vector_t) read(r bit.Reader) (value, error) {
|
|
|
|
|
|
|
|
count := bit.ReadVarInt32(r)
|
|
|
|
|
|
|
|
return make(array, count), r.Err()
|
|
|
|
|
|
|
|
}
|
|
|
|