executeClassMethod method
Executes a class method.
namespace
Namespace/package of the target class.className
Name of the target class.methodName
Name of the target method.positionalParameters
Positional parameters to pass to the method.namedParameters
Named parameters to pass to the method.
Implementation
FutureOr<ASTValue> executeClassMethod(
String namespace, String className, String methodName,
{List? positionalParameters,
Map? namedParameters,
VMObject? classInstanceObject,
Map<String, ASTValue>? classInstanceFields}) async {
var codeNamespace = _languageNamespaces.get(namespace);
var codeUnit = codeNamespace.getCodeUnitWithClass(className);
if (codeUnit == null) {
throw StateError("Can't find class to execute: $className->$methodName");
}
var clazz = codeUnit.root!.getClass(className);
if (clazz == null) {
throw StateError(
"Can't find class method to execute: $className->$methodName");
}
var result = await clazz.execute(
methodName, positionalParameters, namedParameters,
classInstanceObject: classInstanceObject,
classInstanceFields: classInstanceFields,
externalFunctionMapper: externalFunctionMapper,
typeResolver: this);
return result;
}