close
Warning:
Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.
Ticket #869: ticket_18B.ObjectReferencesAndDecompilation.tol
File ticket_18B.ObjectReferencesAndDecompilation.tol, 1.1 KB (added by pgea@…, 15 years ago) |
|
Line | |
---|
1 | |
---|
2 | ////////////////////////////////////////////////////////////////////////////// |
---|
3 | // Compílese aparte estas líneas (con F11, en el Eval u otro archivo) |
---|
4 | /* |
---|
5 | Class @Element { |
---|
6 | Text _.info; |
---|
7 | Anything GetThis(Real void){ _this } |
---|
8 | }; |
---|
9 | |
---|
10 | NameBlock Container = [[ |
---|
11 | Set _.elements = Copy(Empty); |
---|
12 | Real CreateElement(Text info) { |
---|
13 | @Element element = [[ |
---|
14 | Text _.info = info |
---|
15 | ]]; |
---|
16 | Set Append(_.elements, [[element]]); |
---|
17 | 0}; |
---|
18 | @Element GetElement(Real index) { |
---|
19 | _.elements[index] |
---|
20 | }; |
---|
21 | Anything GetElementThis(Real index) { |
---|
22 | @Element element = _.elements[index]; |
---|
23 | element::GetThis(?) |
---|
24 | } |
---|
25 | ]]; |
---|
26 | |
---|
27 | Real Container::CreateElement("nota"); |
---|
28 | */ |
---|
29 | ////////////////////////////////////////////////////////////////////////////// |
---|
30 | // Compílese esta línea (con F9) y decompílese (con F8) |
---|
31 | |
---|
32 | @Element algo = Container::GetElement(1); |
---|
33 | |
---|
34 | ////////////////////////////////////////////////////////////////////////////// |
---|
35 | // Compílese aparte esta línea (con F11, en el Eval u otro archivo) |
---|
36 | // y se obtendrá el error |
---|
37 | |
---|
38 | // Anything ea = Container::GetElementThis(1); |
---|
39 | |
---|
40 | ////////////////////////////////////////////////////////////////////////////// |
---|
41 | |
---|
42 | |
---|
Download in other formats: