mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
parser: various code and quality enhancements
This commit is contained in:
@ -193,6 +193,11 @@ class AstStandardCodegen(pkg: String, outputDirectory: Path, world: AstWorld) :
|
||||
"NodeCoalescer",
|
||||
inherits = mutableListOf("NodeVisitor<Unit>"),
|
||||
members = mutableListOf(
|
||||
KotlinMember(
|
||||
"followChildren",
|
||||
"Boolean",
|
||||
value = "true"
|
||||
),
|
||||
KotlinMember(
|
||||
"handler",
|
||||
"(Node) -> Unit"
|
||||
@ -227,7 +232,9 @@ class AstStandardCodegen(pkg: String, outputDirectory: Path, world: AstWorld) :
|
||||
)
|
||||
)
|
||||
handleFunction.body.add("handler(node)")
|
||||
handleFunction.body.add("node.visitChildren(this)")
|
||||
handleFunction.body.add("if (followChildren) {")
|
||||
handleFunction.body.add(" node.visitChildren(this)")
|
||||
handleFunction.body.add("}")
|
||||
coalescerClass.functions.add(handleFunction)
|
||||
|
||||
write("NodeCoalescer.kt", KotlinWriter(coalescerClass))
|
||||
|
Reference in New Issue
Block a user