// New constructs an Engine.
New constructs an Engine.
// New constructs an Engine .
func New(m TypeMap) *Engine {
	e := &Engine{typeMap: append(m[:0:0], m...)}
	for idx, td := range e.typeMap {
		if td.Elem != 0 {
			found := e.typeData(td.Elem)
			if found.TypeID == 0 {
				panic(fmt.Errorf("bad codegen: missing %d.Elem %d",
					td.TypeID, td.Elem))
			}
			e.typeMap[idx].elemData = found
		}
		for fIdx, field := range td.Fields {
			found := e.typeData(field.Target)
			if found.TypeID == 0 {
				panic(fmt.Errorf("bad codegen: missing %d.%s.Target %d",
					td.TypeID, field.Name, field.Target))
			}
			e.typeMap[idx].Fields[fIdx].targetData = found
		}
	}
	return e
}
func New ( m TypeMap ) * Engine { e := & Engine { typeMap : append ( m [ : 0 : 0 ] , m ... ) } for idx , td := range e . typeMap { if td . Elem != 0 { found := e . typeData ( td . Elem ) if found . TypeID == 0 { panic ( fmt . Errorf ( " " , td . TypeID , td . Elem ) ) } e . typeMap [ idx ] . elemData = found } for fIdx , field := range td . Fields { found := e . typeData ( field . Target ) if found . TypeID == 0 { panic ( fmt . Errorf ( " " , td . TypeID , field . Name , field . Target ) ) } e . typeMap [ idx ] . Fields [ fIdx ] . targetData = found } } return e }
New constructs an Engine.
New constructs an Engine .
// Make a copy of the TypeMap and link all of the TypeDatas together.