/[eiffelstudio]/branches/CAT_mono/Src/Eiffel/eiffel/genericity/cl_type_i.e
ViewVC logotype

Annotation of /branches/CAT_mono/Src/Eiffel/eiffel/genericity/cl_type_i.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69650 - (hide annotations)
Tue Jul 24 17:18:14 2007 UTC (12 years, 7 months ago) by juliant
File size: 21816 byte(s)
Added monomorph mark for class types, either "frozen" or "invariant".
First (simple) conformance check for monomorphic types.
1 manus 26913 indexing
2     description: "Type class."
3 manus 56535 legal: "See notice at end of class."
4     status: "See notice at end of class."
5 manus 26913 date: "$Date$"
6     revision: "$Revision$"
7 grator 18
8     class CL_TYPE_I
9    
10     inherit
11     TYPE_I
12     redefine
13 alexk 56564 anchor_instantiation_in,
14 grator 18 c_type,
15 manus 10818 conforms_to_array,
16 alexk 56356 created_in,
17 alexk 64465 external_id,
18 alexk 62805 full_type_byte_code_type_id,
19 manus 11298 generate_cid,
20 manus 14013 generate_cid_array,
21 manus 30169 generate_cid_init,
22 manus 35665 generate_gen_type_il,
23 manus 41824 generate_expanded_creation,
24 manus 43364 generate_expanded_initialization,
25 alexk 56356 generated_id,
26 manus 66895 internal_generic_derivation,
27 alexk 55897 instantiated_description,
28 manus 41824 instantiation_in,
29 alexk 56356 is_expanded,
30     is_explicit,
31     is_external,
32 alexk 56735 is_frozen,
33 alexk 56356 is_generated_as_single_type,
34     is_reference,
35     is_separate,
36 manus 63371 is_consistent,
37 alexk 56356 make_gen_type_byte_code,
38 manus 63370 same_as,
39     static_type_id
40 grator 18 end
41    
42 manus 33952 SHARED_IL_CASING
43     export
44     {NONE} all
45     end
46    
47 manus 35665 SHARED_GENERATION
48     export
49     {NONE} all
50     end
51    
52     SHARED_DECLARATIONS
53     export
54     {NONE} all
55     end
56    
57 manus 30224 create
58     make
59 alexk 55707
60 manus 30224 feature {NONE} -- Initialization
61    
62     make (id: INTEGER) is
63 manus 30293 -- Create new instance of `Current' with `class_id'
64 manus 30224 -- assigned with `id'.
65     require
66     valid_id: id > 0
67     do
68 manus 30293 class_id := id
69 manus 30224 ensure
70 manus 30293 class_id_set: class_id = id
71 manus 30224 end
72 alexk 55707
73 manus 26913 feature -- Access
74 grator 18
75 manus 30293 class_id: INTEGER
76 grator 18 -- Base class id of the type class
77    
78     meta_generic: META_GENERIC is
79     -- Meta generic array describing the type class
80     do
81     -- No meta generic in non-generic type
82 manus 9655 end
83 grator 18
84 manus 10890 cr_info : CREATE_INFO
85     -- Additional information for the creation
86     -- of generic types with anchored parameters
87    
88 manus 10818 true_generics : ARRAY [TYPE_I] is
89     -- Array of generics: no mapping reference -> REFERENCE_I
90     do
91     -- Non generic types don't have them
92     end
93    
94 grator 18 base_class: CLASS_C is
95     -- Base class associated to the class type
96     do
97 manus 30293 Result := System.class_of_id (class_id)
98 manus 9655 end
99 grator 18
100 manus 66895 internal_generic_derivation (a_level: INTEGER): CL_TYPE_I is
101 manus 41824 -- Precise generic derivation of current type.
102     -- That is to say given a type, it gives the associated TYPE_I
103     -- which can be used to search its associated CLASS_TYPE.
104 alexk 64465 local
105     c: like cr_info
106 manus 41824 do
107 alexk 64465 c := cr_info
108     if c = Void then
109     Result := Current
110     else
111     -- Remove creation information.
112     cr_info := Void
113     Result := twin
114     cr_info := c
115     end
116 manus 41824 end
117 alexk 55707
118 manus 26913 type_a: CL_TYPE_A is
119 grator 236 do
120 manus 30293 create Result.make (class_id)
121 alexk 56011 Result.set_mark (declaration_mark)
122 manus 9655 end
123 grator 236
124 manus 41824 name: STRING is
125     -- String that should be displayed in debugger to represent `Current'.
126     do
127 manus 43828 Result := base_name
128 manus 41824 end
129 alexk 55707
130 alexk 56011 duplicate: like Current is
131     -- Duplication
132     do
133     Result := twin
134     end
135    
136 alexk 61575 reference_type: CL_TYPE_I is
137     -- Corresponding reference type
138     require
139     is_expanded: is_expanded
140     do
141     Result := duplicate
142     Result.set_reference_mark
143     ensure
144     result_is_reference: Result.is_reference
145     end
146    
147 manus 43828 instantiation_in (other: CLASS_TYPE): CL_TYPE_I is
148 manus 41824 -- Instantation of Current in `other'
149     do
150     Result := Current
151     end
152 alexk 55707
153 alexk 56564 anchor_instantiation_in (other: CLASS_TYPE): CL_TYPE_I is
154     -- Instantation of `like Current' parts of Current in `other'
155     do
156     Result := Current
157     end
158    
159 alexk 56356 created_in (other: CLASS_TYPE): TYPE_I is
160     -- Resulting type of Current as if it was used to create object in `other'.
161     do
162     Result := Current
163     if cr_info /= Void then
164     Result := cr_info.created_in (other)
165     end
166     end
167    
168 manus 33952 il_type_name (a_prefix: STRING): STRING is
169 manus 26913 -- Class name of current type.
170 manus 29681 local
171     l_class_c: like base_class
172 manus 34253 l_cl_type: like associated_class_type
173 manus 64191 l_alias_name: STRING
174     l_dot_pos: INTEGER
175 grator 18 do
176 manus 29681 l_class_c := base_class
177 manus 41824 if is_external then
178 manus 40771 Result := l_class_c.external_class_name.twin
179 manus 29681 else
180 alexk 64465 if l_class_c.is_precompiled then
181 manus 64191 -- Reuse the name that was computed at precompilation time.
182 manus 34253 l_cl_type := associated_class_type
183 alexk 64465 if l_cl_type.is_precompiled then
184 manus 49345 Result := l_cl_type.il_type_name (a_prefix)
185 manus 34253 end
186     end
187 alexk 64465 if Result = Void then
188     if not has_no_mark or else is_basic or else l_class_c.external_class_name.is_equal (l_class_c.name) then
189 raphaels 48802 Result := internal_il_type_name (l_class_c.name.twin, a_prefix)
190     else
191 manus 64191 -- Special case when an external name has been specified.
192 raphaels 48802 Result := l_class_c.external_class_name.twin
193 manus 64191 Result.left_adjust
194     Result.right_adjust
195     -- Remove leading `.' since it is not a valid .NET name.
196     from
197     until
198     Result.is_empty or else Result.item (1) /= '.'
199     loop
200     Result.remove_head (1)
201     end
202     -- Remove trailing `.' since it is not a valid .NET name.
203     from
204     until
205     Result.is_empty or else Result.item (Result.count) /= '.'
206     loop
207     Result.remove_tail (1)
208     end
209     if Result.is_empty then
210     -- External name is invalid since empty, we use the normal
211     -- way of generating the .Net name
212     Result := internal_il_type_name (l_class_c.name.twin, a_prefix)
213     else
214     if a_prefix /= Void then
215     l_dot_pos := Result.last_index_of ('.', Result.count)
216     if l_dot_pos = 0 then
217     Result.prepend_character ('.')
218     Result.prepend (a_prefix)
219     else
220     check
221     -- Because there are no more leading or trailing `.'.
222     valid_l_dot_pos: l_dot_pos > 1 and l_dot_pos < Result.count
223     end
224     l_alias_name := Result.substring (l_dot_pos + 1, Result.count)
225     check
226     l_alias_name_not_empty: not l_alias_name.is_empty
227     end
228     Result.keep_head (l_dot_pos)
229     l_alias_name := internal_il_base_type_name (l_alias_name)
230     Result.append (a_prefix)
231     Result.append_character ('.')
232     Result.append (l_alias_name)
233     end
234 raphaels 48802 end
235     end
236     end
237 manus 34253 end
238 manus 29681 end
239 manus 11218 end
240    
241 alexk 55897 description, instantiated_description: ATTR_DESC is
242 grator 18 -- Type description for skeletons
243     local
244 michaels 7681 exp: EXPANDED_DESC
245     ref: REFERENCE_DESC
246 grator 485 do
247 manus 41824 if is_expanded then
248 julieng 37663 create exp
249 manus 42413 exp.set_cl_type_i (Current)
250 manus 13232 exp.set_type_i (Current)
251 manus 9655 Result := exp
252 grator 18 else
253 manus 9655 Result := c_type.description
254 manus 42413 ref ?= Result
255     if ref /= Void then
256     ref.set_type_i (Current)
257     end
258 manus 9655 end
259     end
260 grator 18
261     c_type: TYPE_C is
262     -- Associated C type
263     do
264 manus 9655 Result := Reference_c_type
265     end
266 manus 42413
267 grator 18 associated_class_type: CLASS_TYPE is
268     -- Associated class type
269 michaels 7681 require
270 manus 42865 has: has_associated_class_type
271 grator 485 do
272 manus 41824 Result := base_class.types.search_item (Current)
273 alexk 48670 ensure
274     result_not_void: Result /= Void
275 manus 9655 end
276 grator 18
277     type_id: INTEGER is
278     -- Type id of the correponding class type
279     do
280 manus 9655 Result := associated_class_type.type_id
281     end
282 grator 18
283 manus 63370 static_type_id: INTEGER is
284     -- Type id of the correponding class type
285     require else
286     ok: True
287     do
288     Result := associated_class_type.static_type_id
289     end
290    
291 alexk 64465 external_id: INTEGER is
292     -- External type id of `Current' (or `static_type_id' for pure Eiffel type).
293     do
294     Result := associated_class_type.external_id
295     end
296    
297 manus 26913 sk_value: INTEGER is
298     -- Generate SK value associated to the current type.
299 grator 18 do
300 manus 41824 if is_expanded then
301     Result := Sk_exp | (type_id - 1)
302     else
303 manus 31263 Result := Sk_ref | (type_id - 1)
304 manus 9655 end
305     end
306 grator 18
307     hash_code: INTEGER is
308     -- Hash code for current type
309     do
310 manus 30293 Result := Other_code + class_id
311 manus 9655 end
312 grator 18
313 alexk 67199 feature -- Type evaluation
314    
315     implemented_type (implemented_in: INTEGER): CL_TYPE_I is
316     -- Parent type that corresponds to the current one.
317     require
318     valid_implemented_in: implemented_in > 0
319     local
320     written_class: CLASS_C
321     do
322     -- If it is defined in current class, that's easy and we
323     -- return `current_type'. Otherwise we have to find the
324     -- correct CLASS_TYPE object where it is implemented.
325     if class_id = implemented_in then
326     Result := Current
327     else
328     written_class := System.class_of_id (implemented_in)
329     -- We go through the hierarchy only when `written_class'
330     -- is generic, otherwise for the most general case where
331     -- `written_class' is not generic it will take a long
332     -- time to go through the inheritance hierarchy.
333     if written_class.types.count > 1 then
334     Result := type_a.find_class_type (written_class).type_i
335     else
336     Result := written_class.types.first.type
337     end
338     end
339     end
340    
341 manus 26913 feature -- Status
342    
343 manus 31541 element_type: INTEGER_8 is
344     -- Void element type
345     do
346 manus 41824 if is_expanded then
347 alexk 55707 Result := {MD_SIGNATURE_CONSTANTS}.Element_type_valuetype
348 manus 31541 else
349 manus 37130 if class_id = System.system_string_class.compiled_class.class_id then
350 manus 49446 Result := {MD_SIGNATURE_CONSTANTS}.Element_type_string
351 manus 44032 elseif class_id = System.system_object_id or class_id = system.any_id then
352     -- For ANY or SYSTEM_OBJECT, we always generate a System.Object
353     -- signature since we can now assign SYSTEM_OBJECTs into ANYs.
354 manus 49446 Result := {MD_SIGNATURE_CONSTANTS}.Element_type_object
355 manus 31541 else
356 manus 49446 Result := {MD_SIGNATURE_CONSTANTS}.Element_type_class
357 manus 31541 end
358     end
359     end
360    
361 manus 41824 tuple_code: INTEGER_8 is
362     -- Tuple code for class type
363     do
364 manus 49446 Result := {SHARED_GEN_CONF_LEVEL}.reference_tuple_code
365 manus 41824 end
366 alexk 55707
367 alexk 56011 has_no_mark: BOOLEAN is
368     -- Has class type no explicit mark?
369     do
370     Result := declaration_mark = {CL_TYPE_A}.no_mark
371     ensure
372     definition: Result = (declaration_mark = {CL_TYPE_A}.no_mark)
373     end
374    
375     has_expanded_mark: BOOLEAN is
376     -- Is class type explicitly marked as expanded?
377     do
378     Result := declaration_mark = {CL_TYPE_A}.expanded_mark
379     ensure
380     definition: Result = (declaration_mark = {CL_TYPE_A}.expanded_mark)
381     end
382    
383     has_reference_mark: BOOLEAN is
384     -- Is class type explicitly marked as reference?
385     do
386     Result := declaration_mark = {CL_TYPE_A}.reference_mark
387     ensure
388     definition: Result = (declaration_mark = {CL_TYPE_A}.reference_mark)
389     end
390    
391     has_separate_mark: BOOLEAN is
392     -- Is class type explicitly marked as reference?
393     do
394     Result := declaration_mark = {CL_TYPE_A}.separate_mark
395     ensure
396     definition: Result = (declaration_mark = {CL_TYPE_A}.separate_mark)
397     end
398    
399 juliant 69650 has_monomorph_mark: BOOLEAN is
400     -- Is class type explicitly marked as monomorph?
401     do
402     Result := declaration_mark = {CL_TYPE_A}.monomorph_mark
403     ensure
404     definition: Result = (declaration_mark = {CL_TYPE_A}.monomorph_mark)
405     end
406    
407 alexk 56011 is_expanded: BOOLEAN is
408 manus 26913 -- Is the type expanded?
409 alexk 56011 do
410 manus 60994 -- Do not check for `has_separate_mark' because a separate class cannot be expanded.
411     Result := has_expanded_mark or else (has_no_mark and then base_class.is_expanded)
412 alexk 56011 end
413 manus 26913
414 martins 67227 is_reference: BOOLEAN is
415 alexk 56011 -- Is the type a reference type?
416     do
417 manus 60994 Result := has_reference_mark or else
418     ((has_no_mark or has_separate_mark) and then not base_class.is_expanded)
419 alexk 56011 end
420    
421     is_separate: BOOLEAN is
422 manus 26913 -- Is the type separate?
423 alexk 56011 do
424     Result := has_separate_mark
425     end
426 manus 26913
427     is_enum: BOOLEAN is
428     -- Is current type an IL enum type?
429     -- Useful to find out if some call optimization can be done
430     -- in FEATURE_B.
431     require
432     il_generation: System.il_generation
433 grator 18 do
434 manus 41824 Result := is_expanded and then base_class.is_enum
435 manus 26913 end
436    
437 manus 28380 is_external: BOOLEAN is
438 manus 41824 -- Is current type based on an external class?
439     local
440     l_base_class: like base_class
441 manus 28380 do
442 manus 41824 -- All Eiffel basic types are externals, and only basic types used
443     -- as reference are not external.
444     l_base_class := base_class
445 alexk 64465 Result := l_base_class.is_external and then not l_base_class.is_basic
446 manus 28380 end
447 alexk 55707
448 alexk 56735 is_frozen: BOOLEAN is
449     -- Is current type based on a frozen class?
450     do
451     Result := base_class.is_frozen
452     end
453    
454 manus 41824 is_generated_as_single_type: BOOLEAN is
455 alexk 55707 -- Is associated type generated as a single type or as an interface type and
456 manus 41824 -- an implementation type.
457     do
458 manus 44032 -- External classes have only one type.
459     Result := is_external
460 manus 41824 if not Result then
461 manus 44058 -- Classes that inherits from external classes
462 alexk 55396 -- have only one generated type as well as expanded types.
463     Result := base_class.is_single or else is_expanded
464 manus 41824 end
465     end
466 manus 28380
467 manus 63371 is_consistent: BOOLEAN is
468 manus 35544 -- Is the base class still in the system and matches its specification?
469 manus 41824 local
470     l_base_class: like base_class
471 manus 26913 do
472 manus 41824 l_base_class := base_class
473     Result := l_base_class /= Void and then (l_base_class.generics = Void)
474 manus 26913 end
475    
476     is_explicit: BOOLEAN is
477 manus 39713 -- Is Current type fixed at compile time?
478 manus 26913 do
479 manus 39713 if cr_info /= Void then
480     Result := cr_info.is_explicit
481     else
482     Result := True
483     end
484 manus 26913 end
485    
486     has_associated_class_type: BOOLEAN is
487     -- Has `Current' an associated class type?
488     do
489 alexk 48670 Result := base_class.types.has_type (Current)
490 manus 9655 end
491 grator 18
492 manus 26913 same_as (other: TYPE_I): BOOLEAN is
493     -- Is `other' equal to Current ?
494     local
495     other_cl_type: CL_TYPE_I
496 grator 508 do
497 manus 26913 other_cl_type ?= other
498     Result := other_cl_type /= Void -- FIXME
499 manus 30293 and then other_cl_type.class_id = class_id
500 manus 41824 and then other_cl_type.is_expanded = is_expanded
501 manus 26913 and then other_cl_type.is_separate = is_separate
502     and then other_cl_type.meta_generic = Void
503     and then other_cl_type.true_generics = Void
504     end
505    
506 alexk 56564 has_actual (type: CL_TYPE_I): BOOLEAN is
507     -- Is `type' an (possibly nested) actual parameter of this type?
508     require
509     non_void_type: type /= Void
510     do
511     -- False here.
512     end
513    
514 manus 26913 feature -- Setting
515    
516 alexk 56011 set_expanded_mark is
517     -- Set class type declaration as expanded.
518 manus 26913 do
519 alexk 56011 declaration_mark := {CL_TYPE_A}.expanded_mark
520 manus 35178 ensure
521 alexk 56011 has_expanded_mark: has_expanded_mark
522 manus 26913 end
523    
524 alexk 56011 set_reference_mark is
525     -- Set class type declaration as reference.
526 manus 26913 do
527 alexk 56011 declaration_mark := {CL_TYPE_A}.reference_mark
528 manus 35178 ensure
529 alexk 56011 has_reference_mark: has_reference_mark
530 manus 26913 end
531    
532 alexk 56011 set_separate_mark is
533     -- Set class type declaration as separate.
534     do
535     declaration_mark := {CL_TYPE_A}.separate_mark
536     ensure
537     has_separate_mark: has_separate_mark
538     end
539    
540 juliant 69650 set_monomorph_mark is
541     -- Set class type declaration as monomorph.
542     do
543     declaration_mark := {CL_TYPE_A}.monomorph_mark
544     ensure
545     has_monomorph_mark: has_monomorph_mark
546     end
547    
548 manus 26913 set_cr_info (cinfo : CREATE_INFO) is
549     -- Set `cr_info' to `cinfo'.
550 manus 30224 require
551     create_info_not_void: cinfo /= Void
552 alexk 64611 not_expanded: not is_expanded or else cinfo.is_equal (create {CREATE_CURRENT})
553 manus 26913 do
554     cr_info := cinfo
555     ensure
556     cr_info_set : cr_info = cinfo
557     end
558    
559     feature -- C generation
560    
561 manus 43364 generate_expanded_creation (buffer: GENERATION_BUFFER; target_name: STRING) is
562 manus 35665 -- Generate creation of expanded object associated to Current.
563     do
564 manus 60999 associated_class_type.generate_expanded_creation (buffer, target_name, Current)
565 manus 43364 end
566 manus 35665
567 manus 43364 generate_expanded_initialization (buffer: GENERATION_BUFFER; target_name: STRING) is
568     -- Generate creation of expanded object associated to Current.
569     do
570     associated_class_type.generate_expanded_initialization (buffer, target_name, target_name, True)
571 manus 35665 end
572    
573 manus 26913 generate_cecil_value (buffer: GENERATION_BUFFER) is
574     -- Generate cecil value
575     do
576 manus 41824 if not is_expanded then
577 manus 43084 buffer.put_string ("SK_REF + (uint32) ")
578 grator 508 else
579 manus 43084 buffer.put_string ("SK_EXP + (uint32) ")
580 manus 9655 end
581 manus 43084 buffer.put_type_id (associated_class_type.type_id)
582 manus 9655 end
583 grator 508
584 grator 930 feature -- Array optimization
585    
586     conforms_to_array: BOOLEAN is
587     do
588     Result := base_class.conform_to (array_class_c)
589 manus 9655 end
590 grator 930
591     feature {NONE} -- Array optimization
592    
593     array_class_c: CLASS_C is
594     once
595     Result := System.array_class.compiled_class
596 manus 9655 end
597 grator 930
598 alexk 62805 feature {NONE} -- Generic conformance
599    
600     full_type_byte_code_type_id: INTEGER is
601     -- Associated type ID used in type information byte code.
602     do
603     Result := type_id - 1
604     ensure then
605     definition: Result = type_id - 1
606     end
607    
608 manus 10818 feature -- Generic conformance
609    
610     generated_id (final_mode : BOOLEAN) : INTEGER is
611 manus 11298
612 manus 10818 do
613 manus 11298 if final_mode then
614     Result := type_id - 1
615 manus 10818 else
616 manus 41824 Result := associated_class_type.static_type_id - 1
617 manus 10818 end
618     end
619    
620 manus 11599 generate_cid (buffer : GENERATION_BUFFER; final_mode, use_info : BOOLEAN) is
621 manus 11298
622 manus 10818 do
623 manus 11209 if
624     use_info and then (cr_info /= Void)
625 manus 26913 and then not is_expanded
626 manus 11209 then
627 alexk 55707 -- It's an anchored type
628 manus 11599 cr_info.generate_cid (buffer, final_mode)
629 manus 39412 else
630 manus 43084 buffer.put_integer (generated_id (final_mode))
631 manus 43156 buffer.put_character (',')
632 manus 10890 end
633 manus 10818 end
634    
635 manus 10890 make_gen_type_byte_code (ba : BYTE_ARRAY; use_info : BOOLEAN) is
636 manus 10818 do
637 manus 11209 if
638     use_info and then (cr_info /= Void)
639 manus 26913 and then not is_expanded
640 manus 11209 then
641 alexk 55707 -- It's an anchored type
642 manus 10890 cr_info.make_gen_type_byte_code (ba)
643 manus 39412 else
644     ba.append_short_integer (generated_id (False))
645 manus 10890 end
646 manus 10818 end
647    
648 alexk 55707 generate_cid_array (buffer : GENERATION_BUFFER;
649 manus 14013 final_mode, use_info : BOOLEAN; idx_cnt : COUNTER) is
650     local
651     dummy : INTEGER
652     do
653     if
654     use_info and then (cr_info /= Void)
655 manus 26913 and then not is_expanded
656 manus 14013 then
657 alexk 55707 -- It's an anchored type
658 manus 14013 cr_info.generate_cid_array (buffer, final_mode, idx_cnt)
659 manus 39412 else
660 manus 43084 buffer.put_integer (generated_id (final_mode))
661 manus 43156 buffer.put_character (',')
662 manus 39412
663     -- Increment counter
664     dummy := idx_cnt.next
665 manus 14013 end
666     end
667    
668 alexk 55707 generate_cid_init (buffer : GENERATION_BUFFER;
669 manus 14013 final_mode, use_info : BOOLEAN; idx_cnt : COUNTER) is
670     local
671     dummy : INTEGER
672     do
673     if
674     use_info and then (cr_info /= Void)
675 manus 26913 and then not is_expanded
676 manus 14013 then
677 alexk 55707 -- It's an anchored type
678 manus 14013 cr_info.generate_cid_init (buffer, final_mode, idx_cnt)
679 manus 39412 else
680     dummy := idx_cnt.next
681 manus 14013 end
682     end
683 manus 30169
684     feature -- Generic conformance for IL
685    
686     generate_gen_type_il (il_generator: IL_CODE_GENERATOR; use_info : BOOLEAN) is
687 alexk 55707 -- `use_info' is true iff we generate code for a
688 manus 30169 -- creation instruction.
689     do
690     if use_info and then cr_info /= Void then
691 manus 30582 -- It's an anchored type, we call feature
692 alexk 55707 -- that will tell us the real type of the
693 manus 30582 -- anchor in the context of Current.
694     cr_info.generate_il_type
695     else
696     il_generator.generate_class_type_instance (Current)
697 alexk 55707 end
698 manus 30169 end
699    
700 manus 33952 feature {NONE} -- Implementation
701    
702 manus 43828 base_name: STRING is
703     -- String that should be displayed in debugger to represent `Current'.
704     local
705     l_base_class: like base_class
706     do
707     create Result.make (32)
708     l_base_class := base_class
709     if is_expanded and not l_base_class.is_expanded then
710     Result.append ("expanded ")
711 alexk 56011 elseif is_reference and l_base_class.is_expanded then
712     Result.append ("reference ")
713 manus 43828 elseif is_separate then
714     Result.append ("separate ")
715     end
716     Result.append (l_base_class.name)
717     end
718    
719 manus 41824 frozen internal_il_type_name (a_base_name, a_prefix: STRING): STRING is
720 manus 33952 -- Full type name of `a_base_name' using `a_prefix' in IL code generation
721     -- with namespace specification
722     require
723     a_base_name_not_void: a_base_name /= Void
724 manus 64191 a_base_name_not_empty: not a_base_name.is_empty
725     do
726     Result := internal_il_base_type_name (a_base_name)
727     -- Result needs to be in lower case because that's
728     -- what our casing conversion routines require to perform
729     -- a good job.
730     Result.to_lower
731     Result := il_casing.type_name (base_class.original_class.actual_namespace, a_prefix, Result, System.dotnet_naming_convention)
732     ensure
733     internal_il_type_name_not_void: Result /= Void
734     internal_il_type_name_not_empty: not Result.is_empty
735     end
736    
737     frozen internal_il_base_type_name (a_base_name: STRING): STRING is
738     -- Given `a_base_name' provides its updated name depending on its usage.
739     require
740     a_base_name_not_void: a_base_name /= Void
741     a_base_name_not_empty: not a_base_name.is_empty
742 manus 33952 local
743 manus 41824 l_base_class: like base_class
744 manus 33952 do
745 manus 41824 l_base_class := base_class
746 alexk 46609 if is_expanded and then not l_base_class.is_expanded then
747     create Result.make (6 + a_base_name.count)
748     Result.append ("value_")
749     elseif not is_expanded and then l_base_class.is_expanded then
750     create Result.make (10 + a_base_name.count)
751     Result.append ("reference_")
752 manus 41824 else
753 alexk 46609 create Result.make (a_base_name.count)
754 manus 41824 end
755 alexk 46609 Result.append (a_base_name)
756 manus 33952 ensure
757 manus 64191 internal_il_base_type_name_not_void: Result /= Void
758     internal_il_base_type_name_not_empty: not Result.is_empty
759 manus 33952 end
760    
761 alexk 67392 feature {CL_TYPE_A, TUPLE_CLASS_B, CIL_CODE_GENERATOR} -- Implementation: class type declaration marks
762 alexk 56011
763     declaration_mark: NATURAL_8
764     -- Declaration mark associated with a class type (if any)
765    
766 alexk 67392 feature {CL_TYPE_A, TUPLE_CLASS_B} -- Implementation: class type declaration marks
767    
768 alexk 56011 set_mark (mark: like declaration_mark) is
769     -- Set `declaration_mark' to the given value `mark'.
770     require
771     valid_declaration_mark:
772     mark = {CL_TYPE_A}.no_mark or mark = {CL_TYPE_A}.expanded_mark or
773 juliant 69650 mark = {CL_TYPE_A}.reference_mark or mark = {CL_TYPE_A}.separate_mark or
774     mark = {CL_TYPE_A}.monomorph_mark
775 alexk 56011 do
776     declaration_mark := mark
777     ensure
778     declaration_mark_set: declaration_mark = mark
779     end
780    
781 manus 41824 invariant
782     class_id_positive: class_id > 0
783 alexk 56011 valid_declaration_mark:
784     declaration_mark = {CL_TYPE_A}.no_mark or
785     declaration_mark = {CL_TYPE_A}.expanded_mark or
786     declaration_mark = {CL_TYPE_A}.reference_mark or
787 juliant 69650 declaration_mark = {CL_TYPE_A}.separate_mark or
788     declaration_mark = {CL_TYPE_A}.monomorph_mark
789 manus 41824
790 manus 56535 indexing
791     copyright: "Copyright (c) 1984-2006, Eiffel Software"
792 manus 58027 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
793 manus 56535 licensing_options: "http://www.eiffel.com/licensing"
794     copying: "[
795     This file is part of Eiffel Software's Eiffel Development Environment.
796 manus 58027
797 manus 56535 Eiffel Software's Eiffel Development Environment is free
798     software; you can redistribute it and/or modify it under
799     the terms of the GNU General Public License as published
800     by the Free Software Foundation, version 2 of the License
801     (available at the URL listed under "license" above).
802 manus 58027
803 manus 56535 Eiffel Software's Eiffel Development Environment is
804     distributed in the hope that it will be useful, but
805     WITHOUT ANY WARRANTY; without even the implied warranty
806     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
807     See the GNU General Public License for more details.
808 manus 58027
809 manus 56535 You should have received a copy of the GNU General Public
810     License along with Eiffel Software's Eiffel Development
811     Environment; if not, write to the Free Software Foundation,
812     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
813     ]"
814     source: "[
815     Eiffel Software
816     356 Storke Road, Goleta, CA 93117 USA
817     Telephone 805-685-1006, Fax 805-685-6869
818     Website http://www.eiffel.com
819     Customer support http://support.eiffel.com
820     ]"
821    
822 grator 18 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23