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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 92684 - (show annotations)
Fri Jun 7 15:28:53 2013 UTC (6 years, 6 months ago) by jasonw
File size: 5879 byte(s)
<<Merged from trunk#92682.>>
1 note
2 description: "[
3 This class encapsualtes functionality and data needed to produce a proper
4 info report for feature lookup on multi constraint (MC) formal generic type
5 parameters.
6 G -> {A, B, C} would be an example for our targeted construct.
7 ]"
8 legal: "See notice at end of class."
9 status: "See notice at end of class."
10 author: ""
11 date: "$Date$"
12 revision: "$Revision$"
13
14 class
15 MC_FEATURE_INFO
16
17 inherit
18
19 LINKED_LIST [TUPLE [ feature_i: FEATURE_I;
20 e_feature: E_FEATURE;
21 cl_type: RENAMED_TYPE_A;
22 formal_position: INTEGER;
23 constraint_position: INTEGER]]
24
25 SHARED_ENCODING_CONVERTER
26 undefine
27 is_equal,
28 copy
29 end
30
31 create
32 make
33
34 feature -- Access
35
36 formal_position: INTEGER
37 -- The position of the formal for which we checked the feature named `feature_name'.
38
39 context_class: CLASS_C
40 -- Context class, is inter alla used to resolve formal positions into actual objects.
41
42 my_list: LIST [like Current]
43
44 feature {INTERNAL_COMPILER_STRING_EXPORTER} -- Access
45
46 feature_name: STRING
47 -- The feature name for which this error report is.
48
49 feature {INTERNAL_COMPILER_STRING_EXPORTER} -- Setters
50
51 set_data (a_feature_name: STRING; a_formal_position: INTEGER; a_context_class: CLASS_C)
52 -- Set data
53 --
54 -- `a_feature_name' is assigned to `feature_name'
55 -- `a_formal_position' is assigned to `formal_position'
56 -- `a_context_class' is assigned to `context_class'
57 require
58 a_context_class_not_void: a_context_class /= Void
59 valid_generic_position: a_context_class.generics.valid_index (a_formal_position)
60 do
61 feature_name := a_feature_name
62 formal_position := a_formal_position
63 context_class := a_context_class
64 ensure
65 feature_name_set: a_feature_name = feature_name
66 formal_position_set: a_formal_position = formal_position
67 context_class_set: a_context_class = context_class
68 end
69
70 feature -- Status
71
72 is_erroneous: BOOLEAN
73 -- Is current really erronuous?
74 do
75 Result := count /= 1
76 end
77
78 has_feature_name: BOOLEAN
79 -- Has `feature_name'?
80 do
81 Result := feature_name /= Void
82 end
83
84 has_context_class: BOOLEAN
85 -- Has `context_class'?
86 do
87 Result := context_class /= Void
88 end
89
90 feature -- Command
91
92 append_error_report (a_text_formatter: TEXT_FORMATTER)
93 -- Appends an error report
94 --
95 -- `a_text_formatter' is used to append the error report to.
96 require
97 is_really_an_error: is_erroneous
98 feature_name_not_void: has_feature_name
99 context_class_not_void: has_context_class
100 local
101 l_output: STRING_32
102 do
103 if count > 0 then
104 -- Precondition ensures this
105 check count_not_one: count /= 1 end
106 if feature_name /= Void then
107 l_output := "The feature `"
108 l_output.append (encoding_converter.utf8_to_utf32 (feature_name))
109 l_output.append_string_general ("' occurs in the following set of constraint classes:%N")
110 else
111 -- This error report might have been computed over a routine id.
112 -- That's why feature_name is Void.
113 end
114
115 a_text_formatter.add (l_output)
116 from
117 start
118 until
119 after
120 loop
121 a_text_formatter.add_new_line
122 a_text_formatter.add_indent
123 a_text_formatter.add ("{")
124 item.cl_type.type.append_to (a_text_formatter)
125 a_text_formatter.add ("}.")
126 print_feature_name(a_text_formatter, item.e_feature, item.feature_i)
127
128 a_text_formatter.add_space
129 a_text_formatter.add ("from formal")
130 a_text_formatter.add_space
131 a_text_formatter.process_generic_text (context_class.generics.i_th (item.formal_position).name.name_32)
132 a_text_formatter.add_space
133 a_text_formatter.add ("at constraint position #" + item.constraint_position.out + ".")
134
135 forth
136 end
137 a_text_formatter.add_new_line
138 else
139 l_output := "The feature `" + feature_name + "' does not occur in any constraint of the following formal:%N"
140 a_text_formatter.add (l_output)
141 a_text_formatter.process_generic_text (context_class.generics.i_th (formal_position).name.name_32)
142 end
143 end
144
145 feature {NONE} -- Implementation
146
147 print_feature_name (a_text_formatter: TEXT_FORMATTER; a_e_feature: E_FEATURE; a_feature_i: FEATURE_I)
148 -- Prints the feature name to `a_text_formatter'.
149 require
150 a_text_formatter_not_void: a_text_formatter /= Void
151 do
152 if a_e_feature /= Void then
153 a_text_formatter.process_feature_text(a_e_feature.name_32, a_e_feature, false)
154 a_text_formatter.add_space
155 elseif a_feature_i /= Void then
156 a_text_formatter.add (a_feature_i.feature_name_32)
157 a_text_formatter.add_space
158 end
159 end
160
161 note
162 copyright: "Copyright (c) 1984-2013, Eiffel Software"
163 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
164 licensing_options: "http://www.eiffel.com/licensing"
165 copying: "[
166 This file is part of Eiffel Software's Eiffel Development Environment.
167
168 Eiffel Software's Eiffel Development Environment is free
169 software; you can redistribute it and/or modify it under
170 the terms of the GNU General Public License as published
171 by the Free Software Foundation, version 2 of the License
172 (available at the URL listed under "license" above).
173
174 Eiffel Software's Eiffel Development Environment is
175 distributed in the hope that it will be useful, but
176 WITHOUT ANY WARRANTY; without even the implied warranty
177 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
178 See the GNU General Public License for more details.
179
180 You should have received a copy of the GNU General Public
181 License along with Eiffel Software's Eiffel Development
182 Environment; if not, write to the Free Software Foundation,
183 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
184 ]"
185 source: "[
186 Eiffel Software
187 5949 Hollister Ave., Goleta, CA 93117 USA
188 Telephone 805-685-1006, Fax 805-685-6869
189 Website http://www.eiffel.com
190 Customer support http://support.eiffel.com
191 ]"
192 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23