This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch implements the new Ada 2012 notion of parametrized expressions. The form is FUNCTION SPECIFICATION IS EXPRESSION. This is equivalent to the corresponding function body that returns the expression, but it can appear in a package spec. The following compiles clean with -gnat2012 and outputs 102. package ParamExpr is F : Integer := 1; function Squarep1 (A : Integer) return Integer is A * A + F; end; with ParamExpr; use ParamExpr; with Text_IO; use Text_IO; procedure ParamExprM is begin F := 2; Put_Line (Squarep1 (10)'Img); end ParamExprM; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-07 Robert Dewar <dewar@adacore.com> * exp_util.adb (Insert_Actions): Add handling of N_Parametrized_Expression. * par-ch6.adb (P_Subprogram): Add parsing of parametrized expression * sem.adb: Add entry for N_Parametrized_Expression * sem_ch6.adb (Analyze_Parametrized_Expression): New procedure * sem_ch6.ads (Analyze_Parametrized_Expression): New procedure * sinfo.ads, sinfo.adb: Add N_Parametrized_Expression * sprint.adb (Sprint_Node): Add handling for N_Parametrized_Expression
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |