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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69687 - (show annotations)
Wed Jul 25 18:55:08 2007 UTC (12 years, 4 months ago) by martins
File size: 4084 byte(s)
* monomorph for formals
* covaraince for generics (syntax only)
1 indexing
2 description:
3 "Abstract description for formal generic type. %
4 %Version for Bench."
5 legal: "See notice at end of class."
6 status: "See notice at end of class."
7 date: "$Date$"
8 revision: "$Revision$"
9
10 class FORMAL_AS
11
12 inherit
13 TYPE_AS
14 redefine
15 first_token, last_token
16 end
17
18 create
19 initialize
20
21 feature {NONE} -- Initialization
22
23 initialize (n: ID_AS; is_ref, is_exp, a_is_monomorph: BOOLEAN; r_as: like reference_expanded_keyword) is
24 -- Create a new FORMAL AST node.
25 require
26 n_not_void: n /= Void
27 do
28 name := n
29 is_reference := is_ref
30 is_expanded := is_exp
31 is_monomorph := a_is_monomorph
32 reference_expanded_keyword := r_as
33 ensure
34 name_set: name = n
35 is_reference_set: is_reference = is_ref
36 is_expanded_set: is_expanded = is_exp
37 reference_expanded_keyword_set: reference_expanded_keyword = r_as
38 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 feature -- Roundtrip
49
50 reference_expanded_keyword: KEYWORD_AS
51 -- Keyword "reference" or "expanded" associated with this structure
52
53 monomorph_keyword: KEYWORD_AS
54 -- Keyword which marks type as monomorph
55 do
56 Result := reference_expanded_keyword
57 end
58
59 feature -- Properties
60
61 name: ID_AS
62 -- Formal generic parameter name
63
64 position: INTEGER
65 -- Position of the formal parameter in the declaration
66 -- array
67
68 is_reference: BOOLEAN
69 -- Is Current formal to be always instantiated as a reference type?
70
71 is_expanded: BOOLEAN
72 -- Is Current formal to be always instantiated as an expanded type?
73
74 is_monomorph: BOOLEAN
75 -- Is Current formal marked as monomorph formal?
76
77 feature -- Roundtrip/Token
78
79 first_token (a_list: LEAF_AS_LIST): LEAF_AS is
80 do
81 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 end
90 end
91
92 last_token (a_list: LEAF_AS_LIST): LEAF_AS is
93 do
94 Result := Precursor (a_list)
95 if Result = Void then
96 Result := name.last_token (a_list)
97 end
98 end
99
100 feature -- Comparison
101
102 is_equivalent (other: like Current): BOOLEAN is
103 -- Is `other' equivalent to the current object ?
104 do
105 Result := position = other.position and then is_reference = other.is_reference
106 and then is_expanded = other.is_expanded
107 end
108
109 feature -- Output
110
111 dump: STRING is
112 do
113 create Result.make (3)
114 Result.append ("G#")
115 Result.append_integer (position)
116 end
117
118 feature {COMPILER_EXPORTER} -- Settings
119
120 set_position (i: INTEGER) is
121 -- Assign `i' to `position'.
122 do
123 position := i
124 end
125
126 indexing
127 copyright: "Copyright (c) 1984-2006, Eiffel Software"
128 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
129 licensing_options: "http://www.eiffel.com/licensing"
130 copying: "[
131 This file is part of Eiffel Software's Eiffel Development Environment.
132
133 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
139 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
145 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 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