callCommon method
Common filter and test caller.
Implementation
@internal
Object? callCommon(
Function function,
List<Object?> positional,
Map<Symbol, Object?> named,
Context? context,
) {
var pass = PassArgument.types[function];
if (pass == PassArgument.context) {
if (context == null) {
throw TemplateRuntimeError(
'Attempted to invoke context function without context.');
}
positional = <Object?>[context, ...positional];
} else if (pass == PassArgument.environment) {
positional = <Object?>[this, ...positional];
}
return Function.apply(function, positional, named);
}