evalSource method
dynamic
evalSource(})
Evaluate a HTSource.
If invoke is provided, will immediately
call the function after evaluation completed.
Implementation
dynamic evalSource(
HTSource source, {
String? module,
bool globallyImport = false,
String? invoke,
List<dynamic> positionalArgs = const [],
Map<String, dynamic> namedArgs = const {},
// List<HTType> typeArgs = const [],
}) {
if (source.content.trim().isEmpty) {
return null;
}
final bytes = _compileSource(source);
final savedContext = interpreter.getContext();
final result = interpreter.loadBytecode(
bytes: bytes,
module: module ?? source.fullName,
globallyImport: globallyImport,
invoke: invoke,
positionalArgs: positionalArgs,
namedArgs: namedArgs,
// typeArgs: typeArgs,
);
interpreter.setContext(savedContext);
return result;
}