Skip to content

Commit b63e46e

Browse files
committed
Add and update references
1 parent 9edbf81 commit b63e46e

6 files changed

+721
-1
lines changed

run_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def is_included(backend):
3434
pass_ = test.get("pass", None)
3535
optimization_passes = ["flip_sign", "div_to_mul", "fma", "sign_from_value",
3636
"inline_function_calls", "loop_unroll",
37-
"dead_code_removal", "loop_vectorise", "print_list_tuple"]
37+
"dead_code_removal", "loop_vectorise", "print_list_tuple",
38+
"class_constructor"]
3839

3940
if pass_ and (pass_ not in ["do_loops", "global_stmts"] and
4041
pass_ not in optimization_passes):
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-structs_16-44de89a",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/../integration_tests/structs_16.py",
5+
"infile_hash": "e87ea0ba10cb7fcd6ce2eb6d2e953a26dcd6a843f6cf4e891287dcb1",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "asr-structs_16-44de89a.stdout",
9+
"stdout_hash": "003d4550abb6fca33a8741e4d586a32ab5ce3355a40da5f911d61112",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}
Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
(TranslationUnit
2+
(SymbolTable
3+
1
4+
{
5+
_global_symbols:
6+
(Module
7+
(SymbolTable
8+
9
9+
{
10+
A:
11+
(StructType
12+
(SymbolTable
13+
2
14+
{
15+
B:
16+
(UnionType
17+
(SymbolTable
18+
3
19+
{
20+
x:
21+
(Variable
22+
3
23+
x
24+
[]
25+
Local
26+
()
27+
()
28+
Default
29+
(Integer 4)
30+
()
31+
Source
32+
Public
33+
Required
34+
.false.
35+
),
36+
y:
37+
(Variable
38+
3
39+
y
40+
[]
41+
Local
42+
()
43+
()
44+
Default
45+
(Integer 8)
46+
()
47+
Source
48+
Public
49+
Required
50+
.false.
51+
)
52+
})
53+
B
54+
[]
55+
[x
56+
y]
57+
Source
58+
Public
59+
[(())
60+
(())]
61+
()
62+
),
63+
b:
64+
(Variable
65+
2
66+
b
67+
[]
68+
Local
69+
()
70+
()
71+
Default
72+
(Union
73+
2 B
74+
)
75+
()
76+
Source
77+
Public
78+
Required
79+
.false.
80+
),
81+
c:
82+
(Variable
83+
2
84+
c
85+
[]
86+
Local
87+
()
88+
()
89+
Default
90+
(Integer 4)
91+
()
92+
Source
93+
Public
94+
Required
95+
.false.
96+
)
97+
})
98+
A
99+
[]
100+
[b
101+
c]
102+
Source
103+
Public
104+
.false.
105+
.false.
106+
[(())
107+
(())]
108+
()
109+
()
110+
),
111+
_lpython_main_program:
112+
(Function
113+
(SymbolTable
114+
8
115+
{
116+
117+
})
118+
_lpython_main_program
119+
(FunctionType
120+
[]
121+
()
122+
Source
123+
Implementation
124+
()
125+
.false.
126+
.false.
127+
.false.
128+
.false.
129+
.false.
130+
[]
131+
[]
132+
.false.
133+
)
134+
[test_ordering]
135+
[]
136+
[(SubroutineCall
137+
9 test_ordering
138+
()
139+
[]
140+
()
141+
)]
142+
()
143+
Public
144+
.false.
145+
.false.
146+
()
147+
),
148+
test_ordering:
149+
(Function
150+
(SymbolTable
151+
4
152+
{
153+
A_B:
154+
(ExternalSymbol
155+
4
156+
A_B
157+
2 B
158+
A
159+
[]
160+
B
161+
Public
162+
),
163+
ad:
164+
(Variable
165+
4
166+
ad
167+
[]
168+
Local
169+
()
170+
()
171+
Default
172+
(Struct
173+
9 A
174+
)
175+
()
176+
Source
177+
Public
178+
Required
179+
.false.
180+
),
181+
bd:
182+
(Variable
183+
4
184+
bd
185+
[]
186+
Local
187+
()
188+
()
189+
Default
190+
(Union
191+
4 A_B
192+
)
193+
()
194+
Source
195+
Public
196+
Required
197+
.false.
198+
)
199+
})
200+
test_ordering
201+
(FunctionType
202+
[]
203+
()
204+
Source
205+
Implementation
206+
()
207+
.false.
208+
.false.
209+
.false.
210+
.false.
211+
.false.
212+
[]
213+
[]
214+
.false.
215+
)
216+
[]
217+
[]
218+
[(=
219+
(Var 4 bd)
220+
(UnionTypeConstructor
221+
4 A_B
222+
[]
223+
(Union
224+
4 A_B
225+
)
226+
()
227+
)
228+
()
229+
)
230+
(=
231+
(UnionInstanceMember
232+
(Var 4 bd)
233+
3 x
234+
(Integer 4)
235+
()
236+
)
237+
(IntegerConstant 1 (Integer 4))
238+
()
239+
)
240+
(=
241+
(Var 4 ad)
242+
(StructTypeConstructor
243+
9 A
244+
[((Var 4 bd))
245+
((IntegerConstant 2 (Integer 4)))]
246+
(Struct
247+
9 A
248+
)
249+
()
250+
)
251+
()
252+
)
253+
(Assert
254+
(IntegerCompare
255+
(UnionInstanceMember
256+
(StructInstanceMember
257+
(Var 4 ad)
258+
2 b
259+
(Union
260+
2 B
261+
)
262+
()
263+
)
264+
3 x
265+
(Integer 4)
266+
()
267+
)
268+
Eq
269+
(IntegerConstant 1 (Integer 4))
270+
(Logical 4)
271+
()
272+
)
273+
()
274+
)
275+
(Assert
276+
(IntegerCompare
277+
(StructInstanceMember
278+
(Var 4 ad)
279+
2 c
280+
(Integer 4)
281+
()
282+
)
283+
Eq
284+
(IntegerConstant 2 (Integer 4))
285+
(Logical 4)
286+
()
287+
)
288+
()
289+
)]
290+
()
291+
Public
292+
.false.
293+
.false.
294+
()
295+
)
296+
})
297+
_global_symbols
298+
[]
299+
.false.
300+
.false.
301+
),
302+
main_program:
303+
(Program
304+
(SymbolTable
305+
7
306+
{
307+
_lpython_main_program:
308+
(ExternalSymbol
309+
7
310+
_lpython_main_program
311+
9 _lpython_main_program
312+
_global_symbols
313+
[]
314+
_lpython_main_program
315+
Public
316+
)
317+
})
318+
main_program
319+
[_global_symbols]
320+
[(SubroutineCall
321+
7 _lpython_main_program
322+
()
323+
[]
324+
()
325+
)]
326+
)
327+
})
328+
[]
329+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "pass_class_constructor-structs_16-5e3508f",
3+
"cmd": "lpython --cumulative --pass=class_constructor --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/../integration_tests/structs_16.py",
5+
"infile_hash": "e87ea0ba10cb7fcd6ce2eb6d2e953a26dcd6a843f6cf4e891287dcb1",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "pass_class_constructor-structs_16-5e3508f.stdout",
9+
"stdout_hash": "0be8b4bbd12e9c29e6f62c71aa7f13afd1e179bcf880fefb58ce4122",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}

0 commit comments

Comments
 (0)