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

Contents of /branches/eth/eve/Src/Eiffel/API/evaluated_type/renamed_type_a.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: 3602 byte(s)
<<Merged from trunk#92682.>>
1 note
2 description: "[
3 Encapsulates a renaming of features together with a type.
4
5 It is called renamed type because it carries extensions with it.
6 The most prominent case where we use an instance of this class is the following:
7 G -> {A rename f as f_of_a end, B rename f as f_of_b end}
8 `A' together with its rename clause corresponds to one instance of this class.
9 ]"
10 legal: "See notice at end of class."
11 status: "See notice at end of class."
12 date: "$Date$"
13 revision: "$Revision$"
14
15 class
16 RENAMED_TYPE_A
17
18 inherit
19 COMPILER_EXPORTER
20
21 create
22 make
23
24 feature -- Initialization
25
26 make (a_type: like type; a_renaming: like renaming)
27 -- Initialize
28 require
29 a_type_not_void: a_type /= Void
30 do
31 type := a_type
32 renaming := a_renaming
33 ensure
34 type_set: a_type = type
35 renaming_set: renaming = a_renaming
36 end
37
38 feature -- Access
39
40 type: TYPE_A
41 -- Type to which the renaming `renaming' is applied.
42
43 renaming: RENAMING_A
44 -- Renaming of features of type `type'.
45
46 feature -- Access
47
48 base_class: CLASS_C
49 -- Class associated to the current type.
50 do
51 Result := type.base_class
52 end
53
54 feature -- Setters
55
56 set_type (a_type: like type)
57 -- Set `type' to `a_type'
58 require
59 a_type_not_void: a_type /= Void
60 do
61 type := a_type
62 ensure
63 type_set: type = a_type
64 end
65
66 feature -- Status
67
68 has_associated_class: BOOLEAN
69 -- Does current type have an associated class?
70 do
71 Result := type.has_associated_class
72 end
73
74 has_renaming: BOOLEAN
75 -- Does current type have renamed features?
76 -- This can occur in code like: "G -> A rename a as b end"
77 do
78 Result := renaming /= Void and then not renaming.is_empty
79 end
80
81 feature -- Output
82
83 ext_append_to (a_text_formatter: TEXT_FORMATTER; c: CLASS_C)
84 -- Append `Current' to `text'.
85 -- `f' is used to retreive the generic type or argument name as string.
86 -- This replaces the old "G#2" or "arg#1" texts in feature signature views.
87 -- Actually used in FORMAL_A and LIKE_ARGUMENT.
88 do
89 type.ext_append_to (a_text_formatter, c)
90 if has_renaming then
91 if has_associated_class then
92 renaming.append_to_with_pebbles (a_text_formatter, base_class)
93 else
94 renaming.append_to (a_text_formatter)
95 end
96 end
97 end
98
99 invariant
100 type_not_void: type /= Void
101
102 note
103 copyright: "Copyright (c) 1984-2012, Eiffel Software"
104 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
105 licensing_options: "http://www.eiffel.com/licensing"
106 copying: "[
107 This file is part of Eiffel Software's Eiffel Development Environment.
108
109 Eiffel Software's Eiffel Development Environment is free
110 software; you can redistribute it and/or modify it under
111 the terms of the GNU General Public License as published
112 by the Free Software Foundation, version 2 of the License
113 (available at the URL listed under "license" above).
114
115 Eiffel Software's Eiffel Development Environment is
116 distributed in the hope that it will be useful, but
117 WITHOUT ANY WARRANTY; without even the implied warranty
118 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
119 See the GNU General Public License for more details.
120
121 You should have received a copy of the GNU General Public
122 License along with Eiffel Software's Eiffel Development
123 Environment; if not, write to the Free Software Foundation,
124 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
125 ]"
126 source: "[
127 Eiffel Software
128 5949 Hollister Ave., Goleta, CA 93117 USA
129 Telephone 805-685-1006, Fax 805-685-6869
130 Website http://www.eiffel.com
131 Customer support http://support.eiffel.com
132 ]"
133
134 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23