kotlinx / ast

Generic AST parsing library for kotlin multiplatform
Apache License 2.0
326 stars 23 forks source link

Property delegate not available in summary #69

Open henrikbarium opened 2 years ago

henrikbarium commented 2 years ago

If I run:

KotlinGrammarAntlrKotlinParser.parseKotlinFile(AstSource.String("source", "val answer by lazy { 42 }"))

The raw AST contains kotlinFile/topLevelObject/declaration/propertyDeclaration/propertyDelegate which describes the by lazy { 42 } part.

However, in the summary AST that I get back from rawAst.summary(false).get() I cannot find any reference to the property delegation. The KlassDeclararation for val answer is there, but it has no children (no expressions or anything else).

drieks commented 2 years ago

Hi @henrikbarium, thank you for reporting, I will fix it.

drieks commented 2 years ago

Hi @henrikbarium, code blocks are currently not supported. I can try to add a "by" marker to KlassDeclaration, but the function invocation lazy { 42 } can not be expressed because there are many ast node types missing. See https://github.com/kotlinx/ast/issues/21 for more details. Please let me know if you have any questions.