/[eiffelstudio]/trunk/eweasel/tests/attach124/test.e
ViewVC logotype

Contents of /trunk/eweasel/tests/attach124/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 99822 - (show annotations)
Thu Feb 16 14:51:47 2017 UTC (2 years, 7 months ago) by alexk
File size: 799 byte(s)
Added an example that demonstrates access on void target when object creation fails with an exception after initializing a once function.
1 class TEST
2
3 create
4 make,
5 make_uninitialized
6
7 feature {NONE} -- Creation
8
9 make
10 -- Run test.
11 do
12 set_a
13 io.put_string (f.a.out)
14 end
15
16 make_uninitialized
17 -- Raise an exception after registering a new object in a once function
18 -- and before it is completely initialized.
19 do
20 check not attached f then end
21 a := Current
22 end
23
24 feature -- Creation
25
26 set_a
27 -- Set attribute `a` with a side effect of initializing
28 -- a once function `f` with an incompleetely initialized object.
29 local
30 is_retried: BOOLEAN
31 do
32 if is_retried then
33 a := Current
34 else
35 create a.make_uninitialized
36 end
37 rescue
38 is_retried := True
39 retry
40 end
41
42 feature -- Access
43
44 a: TEST
45 -- An attribute to be initialized at creation.
46
47 f: TEST
48 once
49 Result := Current
50 end
51
52 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23