https://kotlinlang.org logo
#compiler
Title
# compiler
a

Akram

10/09/2019, 1:54 PM
hello ! just want to know if given a functionDescriptor can we know if this is a topLevel function or a Function inside a class ?
I think i have found the solution you just need to check the
function.parents
and verfiyi it has one classDescriptor as a parent
k

kralli

10/09/2019, 2:42 PM
Via `function.containingDeclaration`: If its a top-level function, the containing declaration will be a package fragment and if its a class declaration it will be class descriptor
👍 1
3 Views