mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
Transition all relevant testcases to it. In the process, port
docstrings/comments from test.py files to expected_concrete_syntax.lkt
(now test.lkt) sources and fix stylechecks issues there.
(cherry picked from commit e1c4fe5804)
27 lines
488 B
Plaintext
27 lines
488 B
Plaintext
# Check that passing structs as property argument and returning structs works
|
|
# as expected.
|
|
|
|
import lexer_example
|
|
|
|
@with_lexer(foo_lexer)
|
|
grammar foo_grammar {
|
|
@main_rule main_rule <- Example(@Example)
|
|
}
|
|
|
|
@abstract
|
|
class FooNode implements Node[FooNode] {
|
|
}
|
|
|
|
class Example: FooNode implements TokenNode {
|
|
@exported
|
|
fun sum(s: MyStruct): Int = s.a + s.b
|
|
|
|
@exported
|
|
fun create(a: Int, b: Int): MyStruct = MyStruct(a=a, b=b)
|
|
}
|
|
|
|
struct MyStruct {
|
|
a: Int
|
|
b: Int
|
|
}
|