diff --git a/ada/ast.py b/ada/ast.py index 4fcadbdc1..e3cf0f522 100644 --- a/ada/ast.py +++ b/ada/ast.py @@ -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( diff --git a/testsuite/tests/properties/is_static_expr_3/test.adb b/testsuite/tests/properties/is_static_expr_3/test.adb new file mode 100644 index 000000000..3e0219411 --- /dev/null +++ b/testsuite/tests/properties/is_static_expr_3/test.adb @@ -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() + ); diff --git a/testsuite/tests/properties/is_static_expr_3/test.out b/testsuite/tests/properties/is_static_expr_3/test.out new file mode 100644 index 000000000..b84c8af30 --- /dev/null +++ b/testsuite/tests/properties/is_static_expr_3/test.out @@ -0,0 +1,8 @@ +Working on node +====================================================== + +Set 'concat_op' to 'node.parent.parent.parent' +Result: + +Eval 'concat_op.p_is_static_expr()' +Result: True diff --git a/testsuite/tests/properties/is_static_expr_3/test.yaml b/testsuite/tests/properties/is_static_expr_3/test.yaml new file mode 100644 index 000000000..35ad4d5c4 --- /dev/null +++ b/testsuite/tests/properties/is_static_expr_3/test.yaml @@ -0,0 +1,2 @@ +driver: inline-playground +input_sources: [test.adb]