/[eiffelstudio]/trunk/Src/bench/Eiffel/API/evaluated_type/like_argument.e
ViewVC logotype

Contents of /trunk/Src/bench/Eiffel/API/evaluated_type/like_argument.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13227 - (show annotations)
Fri Feb 5 02:28:58 1999 UTC (21 years ago) by manus
File size: 3518 byte(s)
Updated version of the reverse engineer to match the new common S_CLASS_TYPE_INFO
routine creation especially made for EiffelBench, i.e. changed `make' into
`make_for_bench'.

1 indexing
2
3 description:
4 "Representation of an type anchored on a routine argument."
5 date: "$Date$"
6 revision: "$Revision $"
7
8 class LIKE_ARGUMENT
9
10 inherit
11 LIKE_TYPE_A
12 redefine
13 is_basic, conformance_type, is_like_argument
14 end
15
16 SHARED_ARG_TYPES
17
18 feature -- Properties
19
20 is_like_argument: BOOLEAN is True
21 -- Is Current a like argument? (True)
22
23 is_basic: BOOLEAN is
24 -- Is the current actual type a basic one ?
25 do
26 Result := actual_type.is_basic
27 end
28
29 feature -- Comparison
30
31 is_equivalent (other: like Current): BOOLEAN is
32 -- Is `other' equivalent to the current object ?
33 do
34 Result := position = other.position and then
35 equivalent (actual_type, other.actual_type)
36 end
37
38 feature -- Access
39
40 same_as (other: TYPE_A): BOOLEAN is
41 -- Is the current type the same as `other' ?
42 local
43 other_like_arg: LIKE_ARGUMENT
44 do
45 other_like_arg ?= other
46 Result := other_like_arg /= Void
47 and then other_like_arg.position = position
48 end
49
50 position: INTEGER
51 -- Position in the argument list
52
53 feature -- Setting
54
55 set_position (p: like position) is
56 -- Assign `p' to `position'.
57 do
58 position := p
59 end
60
61 feature -- Output
62
63 dump: STRING is
64 -- Dumped trace
65 local
66 actual_dump: STRING
67 do
68 actual_dump := actual_type.dump
69 !!Result.make (16 + actual_dump.count)
70 Result.append ("(like arg #")
71 Result.append_integer (position)
72 Result.append (")")
73 Result.append (actual_dump)
74 end
75
76 append_to (st: STRUCTURED_TEXT) is
77 do
78 st.add_string ("(like arg #")
79 st.add_int (position)
80 st.add_char (')')
81 actual_type.append_to (st)
82 end
83
84 feature {COMPILER_EXPORTER} -- Primitives
85
86 solved_type (feat_table: FEATURE_TABLE; f: FEATURE_I): LIKE_ARGUMENT is
87 -- Check if the anchor type is still a non like type and
88 -- update `actual_type'.
89 local
90 argument_type: TYPE
91 do
92 if Like_control.is_on then
93 Like_control.raise_error
94 else
95 argument_type := f.arguments.i_th (position)
96 Result := clone (Current)
97 -- Recalculation of the anchor
98 Result.set_actual_type
99 (argument_type.solved_type (feat_table, f).actual_type)
100 check
101 Result_actual_type_exists: Result.actual_type /= Void
102 end
103 end
104 end
105
106 instantiation_in (type: TYPE_A; written_id: CLASS_ID): LIKE_ARGUMENT is
107 -- Instantiation of Current in the context of `class_type',
108 -- assuming that Current is written in class of id `written_id'.
109 do
110 Result := clone (Current)
111 Result.set_actual_type (actual_type.instantiation_in (type, written_id))
112 end
113
114 conformance_type: TYPE_A is
115 -- Type for conformance.
116 -- `actual_type' is the declared type and is the wrong one for
117 -- conformance validation.
118 do
119 Result := Argument_types.i_th (position).actual_type
120 end
121
122 create_info: CREATE_ARG is
123 -- Byte code information for entity type creation
124 do
125 !! Result
126 Result.set_position (position)
127 end
128
129 feature {COMPILER_EXPORTER} -- Storage information for EiffelCase
130
131 storage_info (classc: CLASS_C): S_CLASS_TYPE_INFO is
132 -- Storage info for Current type in class `classc'
133 do
134 !! Result.make_for_bench (Void, associated_class.id)
135 end
136
137 storage_info_with_name (classc: CLASS_C): S_CLASS_TYPE_INFO is
138 -- Storage info for Current type in class `classc'
139 -- and store the name of the class for Current
140 local
141 ass_classc: CLASS_C
142 class_name: STRING
143 do
144 ass_classc := associated_class
145 class_name := clone (ass_classc.name)
146 !! Result.make_for_bench (class_name, ass_classc.id)
147 end
148
149 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