File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change
1
+ pub struct Node<T> {
2
+ value T
3
+ points_to []&Node<T>
4
+ }
5
+
6
+ fn main() {
7
+ mid := &Node<string>{
8
+ value: 'Middle'
9
+ }
10
+ finish := &Node<string>{
11
+ value: 'Finish'
12
+ }
13
+
14
+ graph := &Node<string>{
15
+ value: 'Start'
16
+ points_to: [
17
+ &Node<string>{
18
+ value: 'TopLeft'
19
+ points_to: [
20
+ finish,
21
+ mid,
22
+ ]
23
+ },
24
+ ]
25
+ }
26
+
27
+ println(graph.points_to[0].value) // 'TopLeft'
28
+ }
Original file line number Diff line number Diff line change @@ -523,11 +523,6 @@ pub fn (mut p Parser) parse_generic_struct_inst_type(name string) ast.Type {
523
523
}
524
524
})
525
525
return ast.new_type (idx)
526
- } else {
527
- idx := p.table.find_type_idx (name)
528
- if idx != 0 {
529
- return ast.new_type (idx).set_flag (.generic)
530
- }
531
526
}
532
- return p.parse_enum_or_struct_type (name, .v)
527
+ return p.parse_enum_or_struct_type (name, .v). set_flag (.generic)
533
528
}
You can’t perform that action at this time.
0 commit comments