-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lkt lowering: fix lowering order for list node derivation
Depending on the order picked by Langkit for node type lowering, processing the definition of a derived list node could crash. The problem was that lowering code just assumed so far that the root node was lowered before list nodes, and that list element nodes were lowered before the corresponding list nodes as well, whereas this has never been guaranteed. To fix this, we now force the lowering of the element node when lowering a list node, and stop assuming that the root node is lowered first. For #622
- Loading branch information
Showing
4 changed files
with
74 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Check that compiling a list node derivation that occurs in the Lkt source | ||
# before the root node declaration works correctly (it used to crash). | ||
|
||
import lexer_example | ||
|
||
@with_lexer(foo_lexer) | ||
grammar foo_grammar { | ||
@main_rule main_rule <- AExampleList*(BExample("example")) | ||
} | ||
|
||
class AExampleList : ASTList[CFooNode, BExample] { | ||
} | ||
|
||
@has_abstract_list class BExample : CFooNode implements TokenNode { | ||
} | ||
|
||
@abstract class CFooNode implements Node[CFooNode] { | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
== test.lkt == | ||
Code generation was successful | ||
|
||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
driver: lkt_compile |