call method
Object?
call(
- InterpreterVisitor visitor,
- List<
Object?> positionalArguments, [ - Map<
String, Object?> namedArguments = const {}, - List<
RuntimeType> ? typeArguments,
override
Implementation
@override
Object? call(InterpreterVisitor visitor, List<Object?> positionalArguments,
[Map<String, Object?> namedArguments = const {},
List<RuntimeType>? typeArguments]) {
// Establish `D4.activeVisitor` for the duration of every interpreted
// function call. This makes the visitor available to any native code
// path that the user function triggers — most importantly the
// `InterpretedInstance.==` / `.hashCode` overrides, which dispatch
// through the active visitor when native Dart collections
// (`Map<UserCell, …>`, `Set<UserCell>`, …) look up keys. Without this
// wrap, native container operations downstream of a `targetValue[key]`
// (visitIndexExpression) read `D4.activeVisitor == null` and silently
// fall back to identity hashing, breaking content-equality lookups.
//
// Hot path: push/pop the active visitor directly rather than via
// `withActiveVisitor`, whose `T Function()` argument allocates a closure on
// every interpreted function call. The save/set/restore semantics are
// identical (nesting included).
final previousActiveVisitor = D4.pushActiveVisitor(visitor);
try {
return _callImpl(visitor, positionalArguments, namedArguments,
typeArguments);
} finally {
D4.popActiveVisitor(previousActiveVisitor);
}
}