Skip to content

Commit 9100a0b

Browse files
committed
langkit.dsl_unparse: correctly unparse external properties
TN: RA22-015
1 parent 1ebb873 commit 9100a0b

File tree

9 files changed

+17
-11
lines changed

9 files changed

+17
-11
lines changed

langkit/dsl_unparse.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,13 @@ def emit_prop(prop, walker):
12561256
if prop_for_walker.is_public:
12571257
quals += "@export "
12581258

1259-
if not prop.constructed_expr:
1259+
if prop.external:
1260+
quals += "@external "
1261+
if prop.uses_entity_info:
1262+
quals += "@uses_entity_info "
1263+
if prop.uses_envs:
1264+
quals += "@uses_envs "
1265+
elif not prop.constructed_expr:
12601266
quals += ("@not_implemented "
12611267
if prop.abstract_runtime_check
12621268
else "@abstract ")

testsuite/tests/ada_api/properties_introspection/expected_concrete_syntax.lkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Addition : Expr {
5656

5757
class Number : Expr implements TokenNode {
5858

59-
@abstract fun eval(): Int
59+
@external fun eval(): Int
6060

6161
@export fun id_dflt_bool(id: Bool = true): Bool = id
6262

testsuite/tests/lexical_envs/ple_after_reparse/expected_concrete_syntax.lkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Dep : FooNode {
2323

2424
@export @abstract fun suffix_symbol(): Symbol
2525

26-
@abstract fun referenced_unit_or_error(or_error: Bool): AnalysisUnit[FooNode]
26+
@external fun referenced_unit_or_error(or_error: Bool): AnalysisUnit[FooNode]
2727

2828
@export fun referenced_unit(): AnalysisUnit[FooNode] =
2929
node.referenced_unit_or_error(false)

testsuite/tests/misc/event_handler/expected_concrete_syntax.lkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ grammar foo_grammar {
77

88
@abstract class FooNode implements Node[FooNode] {
99

10-
@export @abstract fun get_unit(name: Symbol): AnalysisUnit[FooNode]
10+
@export @external fun get_unit(name: Symbol): AnalysisUnit[FooNode]
1111
}
1212

1313
class Example : FooNode implements TokenNode {

testsuite/tests/properties/analysis_unit/expected_concrete_syntax.lkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ grammar foo_grammar {
1919

2020
class Literal : Expression implements TokenNode {
2121

22-
@abstract fun result(): Int
22+
@external fun result(): Int
2323
}
2424

2525
class Name : Expression implements TokenNode {
2626

27-
@abstract fun designated_unit(): AnalysisUnit[FooNode]
27+
@external @uses_envs fun designated_unit(): AnalysisUnit[FooNode]
2828

2929
fun result(): Int = node.designated_unit().root.as[Expression].result()
3030
}

testsuite/tests/properties/big_integer/expected_concrete_syntax.lkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class LessThan : Expr {
5454

5555
class Literal : Expr implements TokenNode {
5656

57-
@abstract fun evaluate(): BigInt
57+
@external fun evaluate(): BigInt
5858
}
5959

6060
class Minus : Expr {

testsuite/tests/properties/external/expected_concrete_syntax.lkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ grammar foo_grammar {
1616

1717
class Literal : Expression implements TokenNode {
1818

19-
@abstract fun result(): Int
19+
@external fun result(): Int
2020
}
2121

2222
class Plus : Expression {

testsuite/tests/properties/invalidation_during_mmz/expected_concrete_syntax.lkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ grammar foo_grammar {
1010

1111
class Example : FooNode {
1212

13-
@abstract fun fetch_example_unit(): AnalysisUnit[FooNode]
13+
@external fun fetch_example_unit(): AnalysisUnit[FooNode]
1414

1515
@memoized fun internal_mmz_prop(i: Int): Int =
1616
if (i = 0) then (raise PropertyError()) else i

testsuite/tests/properties/memoized_unit_loading/expected_concrete_syntax.lkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ grammar foo_grammar {
1010

1111
class Example : FooNode {
1212

13-
@abstract fun ext_fetch_example_unit(): AnalysisUnit[FooNode]
13+
@external fun ext_fetch_example_unit(): AnalysisUnit[FooNode]
1414

15-
@abstract fun ext_unit_count(): Int
15+
@external fun ext_unit_count(): Int
1616

1717
@memoized fun fetch_example_unit(): AnalysisUnit[FooNode] =
1818
node.ext_fetch_example_unit()

0 commit comments

Comments
 (0)