/[eiffelstudio]/branches/eth/eve/Src/Eiffel/API/evaluated_type/like_argument.e
ViewVC logotype

Contents of /branches/eth/eve/Src/Eiffel/API/evaluated_type/like_argument.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 94581 - (show annotations)
Fri Mar 7 11:57:58 2014 UTC (5 years, 9 months ago) by jasonw
File size: 5357 byte(s)
<<Merged from trunk#94580.>>
1 note
2
3 description:
4 "Representation of an type anchored on a routine argument."
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 LIKE_ARGUMENT
11
12 inherit
13 LIKE_TYPE_A
14 redefine
15 actual_argument_type, is_like_argument, has_like_argument, evaluated_type_in_descendant,
16 initialize_info
17 end
18
19 feature -- Visitor
20
21 process (v: TYPE_A_VISITOR)
22 -- Process current element.
23 do
24 v.process_like_argument (Current)
25 end
26
27 feature -- Properties
28
29 is_like_argument: BOOLEAN = True
30 -- Is Current a like argument? (True)
31
32 has_like_argument: BOOLEAN = True
33 -- Has the type like argument in its definition? (True)
34
35 feature -- Comparison
36
37 is_equivalent (other: like Current): BOOLEAN
38 -- Is `other' equivalent to the current object ?
39 do
40 Result := position = other.position and then
41 equivalent (actual_type, other.actual_type) and then
42 has_same_marks (other)
43 end
44
45 feature -- Access
46
47 same_as (other: TYPE_A): BOOLEAN
48 -- Is the current type the same as `other' ?
49 local
50 other_like_arg: LIKE_ARGUMENT
51 do
52 other_like_arg ?= other
53 if other_like_arg /= Void then
54 Result := other_like_arg.position = position and then
55 has_same_marks (other_like_arg)
56 end
57 end
58
59 position: INTEGER
60 -- Position in the argument list
61
62 feature -- Setting
63
64 set_position (p: like position)
65 -- Assign `p' to `position'.
66 do
67 position := p
68 end
69
70 feature -- Generic conformance
71
72 initialize_info (an_info: like shared_create_info)
73 do
74 an_info.set_position (position)
75 end
76
77 create_info: CREATE_ARG
78 do
79 create Result
80 Result.set_position (position)
81 end
82
83 shared_create_info: CREATE_ARG
84 once
85 create Result
86 end
87
88 feature -- Output
89
90 dump: STRING
91 -- Dumped trace
92 local
93 actual_dump: STRING
94 do
95 actual_dump := actual_type.dump
96 create Result.make (16 + actual_dump.count)
97 Result.append_character ('[')
98 dump_marks (Result)
99 Result.append ("like arg#")
100 Result.append_integer (position)
101 Result.append ("] ")
102 Result.append (actual_dump)
103 end
104
105 ext_append_to (a_text_formatter: TEXT_FORMATTER; a_context_class: CLASS_C)
106 -- <Precursor>
107 do
108 a_text_formatter.process_symbol_text ({SHARED_TEXT_ITEMS}.ti_L_bracket)
109 ext_append_marks (a_text_formatter)
110 a_text_formatter.process_keyword_text ({SHARED_TEXT_ITEMS}.ti_Like_keyword, Void)
111 a_text_formatter.add_space
112 --Martins 2/6/2007: this code here does not work anymore because of switch from E_FAETURE to CLASS_C
113 -- As it has to be removed anyway we do not spent any effort to enable it again.
114 -- if a_context_class /= Void then
115 --a_text_formatter.process_local_text (a_context_class.arguments.argument_names.i_th (position))
116 --else
117 a_text_formatter.add ({SHARED_TEXT_ITEMS}.ti_Argument_index)
118 a_text_formatter.add_int (position)
119
120 a_text_formatter.process_symbol_text ({SHARED_TEXT_ITEMS}.ti_R_bracket)
121 a_text_formatter.add_space
122 if is_valid then
123 actual_type.ext_append_to (a_text_formatter, a_context_class)
124 end
125 end
126
127 feature {COMPILER_EXPORTER} -- Primitives
128
129 evaluated_type_in_descendant (a_ancestor, a_descendant: CLASS_C; a_feature: FEATURE_I): like Current
130 local
131 l_new_type: TYPE_A
132 do
133 if a_ancestor /= a_descendant then
134 l_new_type := a_feature.arguments.i_th (position).evaluated_type_in_descendant (a_ancestor, a_descendant, a_feature)
135 if l_new_type /= actual_type then
136 Result := twin
137 Result.set_actual_type (l_new_type)
138 else
139 Result := Current
140 end
141 else
142 Result := Current
143 end
144 end
145
146 actual_argument_type (a_arg_types: ARRAYED_LIST [TYPE_A]): TYPE_A
147 -- Type for conformance.
148 -- `actual_type' is the declared type and is the wrong one for
149 -- conformance validation.
150 do
151 check
152 valid_position: a_arg_types.valid_index (position)
153 end
154 -- Preserve attachment status of the current type.
155 Result := a_arg_types.i_th (position).to_other_attachment (Current).to_other_variant (Current)
156 end
157
158 note
159 copyright: "Copyright (c) 1984-2014, Eiffel Software"
160 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
161 licensing_options: "http://www.eiffel.com/licensing"
162 copying: "[
163 This file is part of Eiffel Software's Eiffel Development Environment.
164
165 Eiffel Software's Eiffel Development Environment is free
166 software; you can redistribute it and/or modify it under
167 the terms of the GNU General Public License as published
168 by the Free Software Foundation, version 2 of the License
169 (available at the URL listed under "license" above).
170
171 Eiffel Software's Eiffel Development Environment is
172 distributed in the hope that it will be useful, but
173 WITHOUT ANY WARRANTY; without even the implied warranty
174 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
175 See the GNU General Public License for more details.
176
177 You should have received a copy of the GNU General Public
178 License along with Eiffel Software's Eiffel Development
179 Environment; if not, write to the Free Software Foundation,
180 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
181 ]"
182 source: "[
183 Eiffel Software
184 5949 Hollister Ave., Goleta, CA 93117 USA
185 Telephone 805-685-1006, Fax 805-685-6869
186 Website http://www.eiffel.com
187 Customer support http://support.eiffel.com
188 ]"
189
190 end -- class LIKE_ARGUMENT

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23