//go:build !tinygo

package machine

import (
	
	
)

// handlerReflect holds struct-based handler state. Not available in TinyGo.
type handlerReflect struct {
	h            any
	methods      *reflect.Value
	methodCache  map[string]reflect.Value
	missingCache map[string]struct{}
}

// handlerCallReflect holds the reflected handler method. Not available in
// TinyGo.
type handlerCallReflect struct {
	fn *reflect.Value
}

func newHandlerCallStruct(
	 *Event,  *handler,  string,  *Machine,
) *handlerCall {
	//

	// cache
	,  := .refl.missingCache[]
	if  {
		.mx.Unlock()

		return nil
	}
	,  := .refl.methodCache[]
	if ! {
		 = .refl.methods.MethodByName()

		// support field handlers
		if !.IsValid() {
			 = .refl.methods.Elem().FieldByName()
		}
		if !.IsValid() {
			.refl.missingCache[] = struct{}{}
			.mx.Unlock()

			return nil
		}
		.refl.methodCache[] = 
	}
	.mx.Unlock()

	// call the handler
	.log(LogOps, "[handler:%d] %s", .num, )
	.currentHandler.Store()

	// tracers
	.tracersMx.RLock()
	for  := range .tracers {
		.tracers[].HandlerStart(.t.Load(), .id, )
	}
	.tracersMx.RUnlock()

	 := &handlerCall{
		refl:    handlerCallReflect{fn: &},
		name:    ,
		event:   ,
		timeout: false,
	}

	// TODO not via env?
	if os.Getenv(EnvAmDetectEval) != "" {
		.debug = .id + "." + 
	}

	return 
}