types
Jordan Orelli 8 years ago
parent fd45738324
commit c372f14e33

@ -1,6 +1,31 @@
package ent package ent
import (
"fmt"
"github.com/jordanorelli/hyperstone/bit"
)
type class struct { type class struct {
name string
version int
}
func (c *class) read(r bit.Reader) (value, error) {
return nil, fmt.Errorf("fart")
} }
type classHistory map[int]*class type classHistory map[int]*class
func classType(spec *typeSpec, env *Env) tÿpe {
if spec.serializer != "" {
h := env.classes[spec.serializer]
if h != nil {
class := h[spec.serializerV]
if class != nil {
return class
}
return typeError("class %s exists for spec serializer but can't find version %d", spec.serializer, spec.serializerV)
}
}
return nil
}

@ -59,7 +59,7 @@ func (e *Env) stubClasses(flat *dota.CSVCMsg_FlattenedSerializer) {
if e.classes[name] == nil { if e.classes[name] == nil {
e.classes[name] = make(classHistory, 4) e.classes[name] = make(classHistory, 4)
} }
e.classes[name][v] = new(class) e.classes[name][v] = &class{name: name, version: v}
} }
} }

@ -32,7 +32,7 @@ func parseTypeSpec(spec *typeSpec, env *Env) tÿpe {
} }
return nil return nil
} }
return coalesce(arrayType, atomType, floatType, handleType, qAngleType, hSeqType, genericType) return coalesce(arrayType, atomType, floatType, handleType, qAngleType, hSeqType, genericType, classType)
} }
// a type error is both an error and a type. It represents a type that we were // a type error is both an error and a type. It represents a type that we were

Loading…
Cancel
Save