+2013-07-08 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Analyze_PPC_In_Decl_Part): In ASIS mode,
+ pre-analyze only the original expression attached to the source
+ aspect, not the relocated expression of the pragma, to prevent
+ malformed trees in ASIS mode.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): Revert previous
+ patch: the expression in the aspect for pre/post must be relocated
+ to the pragma for proper analysis.
+
2013-07-05 Hristian Kirtchev <kirtchev@adacore.com>
* aspects.adb: Add an entry for SPARK_Mode in table Canonical_Aspect.
end loop;
end if;
- -- Build the precondition/postcondition pragma. We copy
- -- the expression to avoid sharing between the original
- -- aspect and the pragma node, because in ASIS_Mode both
- -- will be independently analyzed.
+ -- Build the precondition/postcondition pragma.
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Eloc,
Chars => Name_Check,
- Expression => New_Copy_Tree (Expr))),
+ Expression => Relocate_Node (Expr))),
Pragma_Name => Pname);
-- Add message unless exception messages are suppressed
-- Preanalyze the boolean expression, we treat this as a spec expression
-- (i.e. similar to a default expression).
- Preanalyze_Assert_Expression (Get_Pragma_Arg (Arg1), Standard_Boolean);
-
- -- In ASIS mode, for a pragma generated from a source aspect, also
- -- analyze the original aspect expression.
+ -- In ASIS mode, for a pragma generated from a source aspect, analyze
+ -- directly the the original aspect expression, which is shared with
+ -- the generated pragma.
if ASIS_Mode and then Present (Corresponding_Aspect (N)) then
Preanalyze_Assert_Expression
(Expression (Corresponding_Aspect (N)), Standard_Boolean);
+ else
+ Preanalyze_Assert_Expression
+ (Get_Pragma_Arg (Arg1), Standard_Boolean);
end if;
-- For a class-wide condition, a reference to a controlling formal must