getFunctionCodeUnit method
Implementation
FutureOr<({CodeUnit? codeUnit, String? className})> getFunctionCodeUnit(
String namespace, String functionName,
{bool allowClassMethod = false}) {
var codeNamespace = _languageNamespaces.get(namespace);
var codeUnit = codeNamespace.getCodeUnitWithFunction(functionName);
if (codeUnit == null && allowClassMethod) {
var codeUnitWithMethod =
codeNamespace.getCodeUnitWithClassMethod(functionName);
if (codeUnitWithMethod != null) {
var classWithMethod =
codeUnitWithMethod.root?.getClassWithMethod(functionName);
if (classWithMethod != null) {
return (
codeUnit: codeUnitWithMethod,
className: classWithMethod.name,
);
}
}
}
return (codeUnit: codeUnit, className: null);
}