Ticket #741: try.pir

File try.pir, 7.2 KB (added by Austin_Hastings, 13 years ago)

Source code demonstrating incorrect line numbers error.

Line 
1
2.namespace []
3.sub "anon"  :subid("post23")
4.end
5
6
7.HLL "close"
8
9.namespace []
10.sub "_init_namespace_close" :anon :init :load :subid("10_1244223846")
11.annotate "line", 4
12    get_hll_global $P12, "_Crt_started"
13    unless_null $P12, vivify_24
14    new $P12, "Integer"
15    assign $P12, 0
16    set_hll_global "_Crt_started", $P12
17  vivify_24:
18.annotate "line", 0
19    .return ($P12)
20.end
21
22
23.HLL "close"
24
25.namespace []
26.sub "_crt_start"  :subid("11_1244223846")
27.annotate "line", 10
28    get_hll_global $P16, "_Crt_started"
29    unless $P16, unless_15
30    set $P14, $P16
31    goto unless_15_end
32  unless_15:
33.annotate "line", 11
34    new $P17, "Integer"
35    assign $P17, 1
36    set_hll_global "_Crt_started", $P17
37.annotate "line", 13
38    $P18 = "crt_init"()
39.annotate "line", 10
40    set $P14, $P18
41  unless_15_end:
42.annotate "line", 8
43    .return ($P14)
44.end
45
46
47.HLL "close"
48
49.namespace []
50.sub "_crt_start_init"  :init :subid("12_1244223846")
51.annotate "line", 17
52    $P20 = "_crt_start"()
53    .return ($P20)
54.end
55
56
57.HLL "close"
58
59.namespace []
60.sub "_crt_start_load"  :load :subid("13_1244223846")
61.annotate "line", 18
62    $P22 = "_crt_start"()
63    .return ($P22)
64.end
65
66
67.HLL "close"
68
69.namespace []
70.sub "load"  :subid("14_1244223846")
71    .param pmc param_24
72.annotate "line", 20
73    .lex "filename", param_24
74.annotate "line", 22
75    .local pmc fname
76    find_lex $P25, "filename"
77    set fname, $P25
78.annotate "line", 23
79
80                push_eh failed
81                $S0 = fname
82                load_bytecode $S0
83                pop_eh
84                .return()
85        failed:
86                pop_eh
87                die "image not found"
88       
89.annotate "line", 20
90    .return ()
91.end
92
93
94.HLL "close"
95
96.namespace []
97.sub "crt_init"  :subid("15_1244223846")
98.annotate "line", 39
99 print "Loading close library\n"
100.annotate "line", 40
101    $P27 = "load"("close_lib.pir")
102.annotate "line", 37
103    .return ($P27)
104.end
105
106
107.HLL "close"
108
109.namespace ["close";"TypeInfo"]
110.sub "_init_namespace_TypeInfo" :anon :init :load :subid("16_1244223846")
111.annotate "line", 55
112    get_hll_global $P30, ["close";"TypeInfo"], "type_info"
113    unless_null $P30, vivify_25
114    new $P29, "String"
115    assign $P29, "Hash"
116    $P30 = new $P29
117    set_hll_global ["close";"TypeInfo"], "type_info", $P30
118  vivify_25:
119.annotate "line", 56
120    get_hll_global $P31, ["close"], "TypeInfo"
121.annotate "line", 37
122    .return ($P31)
123.end
124
125
126.HLL "close"
127
128.namespace ["close";"TypeInfo"]
129.sub "_init_class_TypeInfo"  :init :load :anon :subid("17_1244223846")
130.annotate "line", 66
131    .local pmc clas
132
133                $P33 = newclass [ 'close' ; 'TypeInfo' ]
134       
135    set clas, $P33
136.annotate "line", 70
137    set_hll_global ["close"], "TypeInfo", clas
138.annotate "line", 72
139    .local pmc is_class
140    new $P34, "Integer"
141    assign $P34, 0
142    set is_class, $P34
143.annotate "line", 74
144
145                $I0 = isa clas, 'Class'
146                $P35 = box $I0
147       
148    set is_class, $P35
149.annotate "line", 79
150    clas."add_attribute"("name")
151.annotate "line", 80
152    clas."add_attribute"("rtype")
153.annotate "line", 81
154    get_hll_global $P36, ["close";"TypeInfo"], "new"
155    $P37 = clas."add_method"("new", $P36)
156.annotate "line", 60
157    .return ($P37)
158.end
159
160
161.HLL "close"
162
163.namespace ["close";"TypeInfo"]
164.sub "new"  :method :subid("18_1244223846")
165    .param pmc param_39
166.annotate "line", 84
167    .lex "self", self
168.annotate "line", 85
169    .lex "name", param_39
170.annotate "line", 88
171    .local pmc it
172    get_hll_global $P40, ["close"], "TypeInfo"
173    $P41 = new $P40
174    set it, $P41
175.annotate "line", 89
176    find_lex $P42, "name"
177    setattribute it, "name", $P42
178.annotate "line", 91
179    .return (it)
180.annotate "line", 84
181    .return ()
182.end
183
184
185.HLL "close"
186
187.namespace ["close";"TypeInfo"]
188.sub "get_array_composite"  :method :subid("19_1244223846")
189    .param pmc param_44
190.annotate "line", 94
191    .lex "self", self
192.annotate "line", 95
193    .lex "dimension", param_44
194.annotate "line", 98
195    .local pmc key
196    new $P45, "String"
197    assign $P45, "array["
198    set key, $P45
199.annotate "line", 100
200    find_lex $P47, "dimension"
201    unless $P47, if_46_end
202.annotate "line", 101
203    find_lex $P48, "dimension"
204    $P49 = concat key, $P48
205    set key, $P49
206  if_46_end:
207.annotate "line", 104
208    new $P50, "String"
209    assign $P50, "]"
210    $P51 = concat key, $P50
211    .return ($P51)
212.annotate "line", 94
213    .return ()
214.end
215
216
217.HLL "close"
218
219.namespace ["close";"TypeInfo"]
220.sub "get_function_composite"  :method :subid("20_1244223846")
221    .param pmc param_53 :slurpy
222.annotate "line", 108
223    .lex "self", self
224.annotate "line", 109
225    .lex "params", param_53
226.annotate "line", 112
227    .local pmc key
228    new $P54, "String"
229    assign $P54, "func("
230    set key, $P54
231.annotate "line", 114
232    .local pmc comma
233    new $P55, "String"
234    assign $P55, ""
235    set comma, $P55
236.annotate "line", 116
237    .local pmc param
238.annotate "line", 117
239    .local pmc iter
240    new $P56, "String"
241    assign $P56, "Iterator"
242    find_lex $P57, "params"
243    $P58 = new $P56, $P57
244    set iter, $P58
245.annotate "line", 118
246    new $P64, 'ExceptionHandler'
247    set_addr $P64, loop63_handler
248    $P64."handle_types"(65, 67, 66)
249    push_eh $P64
250  loop63_test:
251    unless iter, loop63_done
252  loop63_redo:
253.annotate "line", 119
254    $P59 = shift iter
255    set param, $P59
256.annotate "line", 120
257    getattribute $P60, $P60, "name"
258    $P61 = concat key, comma
259    set key, $P61
260.annotate "line", 121
261    new $P62, "String"
262    assign $P62, ", "
263    set comma, $P62
264  loop63_next:
265.annotate "line", 118
266    goto loop63_test
267  loop63_handler:
268    .local pmc exception
269    .get_results (exception)
270    getattribute $P65, exception, 'type'
271    eq $P65, 65, loop63_next
272    eq $P65, 67, loop63_redo
273  loop63_done:
274    pop_eh
275.annotate "line", 124
276    new $P66, "String"
277    assign $P66, ")"
278    $P67 = concat key, $P66
279    .return ($P67)
280.annotate "line", 108
281    .return ()
282.end
283
284
285.HLL "close"
286
287.namespace ["close";"TypeInfo"]
288.sub "main"  :main :subid("21_1244223846")
289.annotate "line", 130
290    "say"("*** MAIN ***")
291.annotate "line", 131
292    .local pmc clas
293    get_hll_global $P69, ["close"], "TypeInfo"
294    set clas, $P69
295.annotate "line", 133
296    "say"("Class name: ", clas)
297.annotate "line", 135
298    .local pmc is_class
299
300                $I0 = isa clas, 'Class'
301                $P70 = box $I0
302       
303    set is_class, $P70
304.annotate "line", 140
305    "say"("Is a class?: ", is_class)
306.annotate "line", 142
307    .local pmc type
308    $P71 = typeof clas
309    set type, $P71
310.annotate "line", 143
311    "say"("Type name: ", type)
312.annotate "line", 145
313    .local pmc meth
314    $P72 = clas."find_method"("new")
315    set meth, $P72
316.annotate "line", 147
317    "say"("New method is: ", meth)
318.annotate "line", 149
319    .local pmc is_same
320    get_hll_global $P73, ["close";"TypeInfo"], "new"
321
322                $I0 = issame meth, $P73
323                $P74 = box $I0
324       
325    set is_same, $P74
326.annotate "line", 153
327    "say"("New method is what I want?: ", is_same)
328.annotate "line", 155
329    "say"("Calling ctor")
330.annotate "line", 156
331    .local pmc x1
332
333                $P75 = meth('object ref', 'first object')
334       
335    set x1, $P75
336.annotate "line", 160
337    .local pmc x
338    get_hll_global $P76, ["close"], "TypeInfo"
339    $P77 = $P76."new"("name-x")
340    set x, $P77
341.annotate "line", 161
342    "say"("Back from ctor")
343.annotate "line", 163
344    $P78 = "print"(x)
345.annotate "line", 127
346    .return ($P78)
347.end
348
349
350.HLL "close"
351
352.namespace ["close";"TypeInfo"]
353.sub "init"  :init :load :subid("22_1244223846")
354.annotate "line", 168
355    $P80 = "main"()
356.annotate "line", 166
357    .return ($P80)
358.end
359