/[eiffelstudio]/branches/CAT_mono/Src/framework/parser/AST/types/formal_as.e
ViewVC logotype

Annotation of /branches/CAT_mono/Src/framework/parser/AST/types/formal_as.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69687 - (hide annotations)
Wed Jul 25 18:55:08 2007 UTC (12 years, 5 months ago) by martins
File size: 4084 byte(s)
* monomorph for formals
* covaraince for generics (syntax only)
1 julieng 34923 indexing
2 manus 57283 description:
3     "Abstract description for formal generic type. %
4     %Version for Bench."
5 manus 56536 legal: "See notice at end of class."
6     status: "See notice at end of class."
7 julieng 34923 date: "$Date$"
8     revision: "$Revision$"
9    
10 manus 50134 class FORMAL_AS
11 julieng 34923
12     inherit
13 manus 43414 TYPE_AS
14 julieng 34923 redefine
15 manus 57283 first_token, last_token
16 julieng 34923 end
17    
18 manus 50134 create
19     initialize
20 julieng 34923
21 manus 50134 feature {NONE} -- Initialization
22    
23 martins 69687 initialize (n: ID_AS; is_ref, is_exp, a_is_monomorph: BOOLEAN; r_as: like reference_expanded_keyword) is
24 julieng 34923 -- Create a new FORMAL AST node.
25 manus 42633 require
26     n_not_void: n /= Void
27 julieng 34923 do
28 manus 42633 name := n
29     is_reference := is_ref
30     is_expanded := is_exp
31 martins 69687 is_monomorph := a_is_monomorph
32 jasonw 56181 reference_expanded_keyword := r_as
33 julieng 34923 ensure
34 manus 42633 name_set: name = n
35     is_reference_set: is_reference = is_ref
36     is_expanded_set: is_expanded = is_exp
37 jasonw 56181 reference_expanded_keyword_set: reference_expanded_keyword = r_as
38 julieng 34923 end
39    
40     feature -- Visitor
41    
42     process (v: AST_VISITOR) is
43     -- process current element.
44     do
45     v.process_formal_as (Current)
46     end
47    
48 jasonw 56181 feature -- Roundtrip
49    
50     reference_expanded_keyword: KEYWORD_AS
51     -- Keyword "reference" or "expanded" associated with this structure
52    
53 martins 69687 monomorph_keyword: KEYWORD_AS
54     -- Keyword which marks type as monomorph
55     do
56     Result := reference_expanded_keyword
57     end
58    
59 julieng 34923 feature -- Properties
60    
61 manus 50134 name: ID_AS
62     -- Formal generic parameter name
63    
64     position: INTEGER
65     -- Position of the formal parameter in the declaration
66     -- array
67 jasonw 56181
68 manus 42633 is_reference: BOOLEAN
69     -- Is Current formal to be always instantiated as a reference type?
70 jasonw 56181
71 manus 42633 is_expanded: BOOLEAN
72     -- Is Current formal to be always instantiated as an expanded type?
73    
74 martins 69687 is_monomorph: BOOLEAN
75     -- Is Current formal marked as monomorph formal?
76    
77 jasonw 56644 feature -- Roundtrip/Token
78 julieng 34923
79 jasonw 56644 first_token (a_list: LEAF_AS_LIST): LEAF_AS is
80 manus 50134 do
81 jasonw 56644 Result := Precursor (a_list)
82     if Result = Void then
83     if a_list /= Void and then reference_expanded_keyword /= Void then
84     -- Roundtrip mode
85     Result := reference_expanded_keyword.first_token (a_list)
86     else
87     Result := name.first_token (a_list)
88     end
89 jasonw 56473 end
90 manus 50134 end
91 jasonw 56181
92 jasonw 56644 last_token (a_list: LEAF_AS_LIST): LEAF_AS is
93 manus 50134 do
94 jasonw 56644 Result := Precursor (a_list)
95     if Result = Void then
96     Result := name.last_token (a_list)
97     end
98 manus 50134 end
99    
100 julieng 34923 feature -- Comparison
101    
102     is_equivalent (other: like Current): BOOLEAN is
103     -- Is `other' equivalent to the current object ?
104     do
105 manus 42633 Result := position = other.position and then is_reference = other.is_reference
106     and then is_expanded = other.is_expanded
107 julieng 34923 end
108    
109     feature -- Output
110    
111     dump: STRING is
112     do
113 manus 57364 create Result.make (3)
114     Result.append ("G#")
115 manus 50134 Result.append_integer (position)
116 julieng 34923 end
117    
118 manus 57283 feature {COMPILER_EXPORTER} -- Settings
119 julieng 34923
120     set_position (i: INTEGER) is
121     -- Assign `i' to `position'.
122     do
123 manus 50134 position := i
124 julieng 34923 end
125    
126 manus 56536 indexing
127     copyright: "Copyright (c) 1984-2006, Eiffel Software"
128 manus 58026 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
129 manus 56536 licensing_options: "http://www.eiffel.com/licensing"
130     copying: "[
131     This file is part of Eiffel Software's Eiffel Development Environment.
132 manus 58026
133 manus 56536 Eiffel Software's Eiffel Development Environment is free
134     software; you can redistribute it and/or modify it under
135     the terms of the GNU General Public License as published
136     by the Free Software Foundation, version 2 of the License
137     (available at the URL listed under "license" above).
138 manus 58026
139 manus 56536 Eiffel Software's Eiffel Development Environment is
140     distributed in the hope that it will be useful, but
141     WITHOUT ANY WARRANTY; without even the implied warranty
142     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
143     See the GNU General Public License for more details.
144 manus 58026
145 manus 56536 You should have received a copy of the GNU General Public
146     License along with Eiffel Software's Eiffel Development
147     Environment; if not, write to the Free Software Foundation,
148     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
149     ]"
150     source: "[
151     Eiffel Software
152     356 Storke Road, Goleta, CA 93117 USA
153     Telephone 805-685-1006, Fax 805-685-6869
154     Website http://www.eiffel.com
155     Customer support http://support.eiffel.com
156     ]"
157    
158 julieng 34923 end -- class FORMAL_AS

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23