Skip to content

Commit

Permalink
Merge branch 'topic/1359' into 'master'
Browse files Browse the repository at this point in the history
Fix is_static_expr for ConcatOp

Closes #1359

See merge request eng/libadalang/libadalang!1641
  • Loading branch information
thvnx committed May 16, 2024
2 parents f05b295 + 6fb4158 commit 90de7bd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ada/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -13872,6 +13872,17 @@ def is_static_expr():
default_val=True
),

lambda co=ConcatOperand:
co.operand.is_static_expr
& co.operator.referenced_decl.then(
lambda decl: decl.is_static_decl,
default_val=True
),

lambda co=ConcatOp:
co.first_operand.is_static_expr
& co.other_operands.all(lambda o: o.is_static_expr),

lambda uo=UnOp:
uo.expr.is_static_expr
& uo.op.referenced_decl.then(
Expand Down
9 changes: 9 additions & 0 deletions testsuite/tests/properties/is_static_expr_3/test.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
procedure Test is
begin
null;
end;
pragma Annotate (Xcov, Exempt_On,
"Invalid" & " argument"
--% concat_op=node.parent.parent.parent
--% concat_op.p_is_static_expr()
);
8 changes: 8 additions & 0 deletions testsuite/tests/properties/is_static_expr_3/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Working on node <Str "" argument"" test.adb:6:30-6:41>
======================================================

Set 'concat_op' to 'node.parent.parent.parent'
Result: <ConcatOp test.adb:6:18-6:41>

Eval 'concat_op.p_is_static_expr()'
Result: True
2 changes: 2 additions & 0 deletions testsuite/tests/properties/is_static_expr_3/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver: inline-playground
input_sources: [test.adb]

0 comments on commit 90de7bd

Please sign in to comment.