summaryrefslogtreecommitdiff
path: root/test/basic/linker.txt
blob: 86930dd10fe2fd7b830a3faa13939a2a262db73e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
ast -> linkers = {
    ['g|"X"|"Y"|"Z"'] = {src1, src2, src3},
    ['g|"X"|"Y"']     = {src4, src5, src6},
    ['g|"X"']         = {src7, src8, src9},
    ['l|7']           = {src10},
    ['l|7|"x"']       = {src11},
    ['l|11|"k"']      = {src12},
}

```lua
x.y.<?z?> = <!f!>

<?g?> = x.y.z

t.<!z!> = 1
x.y = t

x = {
    y = {
        <!z!> = 1
    }
}
```

expect:   'l|x|y|z'
forward:  'l|x|y|z' -> f
backward: 'l|x|y|z' -> g
last:     'l|x|y' + 'z'

expect:   'l|x|y' + '|z'
forward:  'l|t' + '|z' -> 'l|t|z' -> t.z
backward: nil
last:     'l|x' + '|y|z'

expect:   'l|x' + '|y|z'
forward:  'l|0' + '|y|z' -> 'l|0|y|z'
backward: nil
last:     nil

expect:   'l|0|y|z'
forward:  nil
backward: nil
last:     'l|0|y' + '|z'

expect:   'l|0|y' + '|z'
forward:  'l|1'+ '|z' -> 'l|1|z' -> field z
backward: nil
last:     'l|0' + '|y|z'


```lua
a = {
    b = {
        <?c?> = 1,
    }
}

print(a.b.<!c!>)
```

expect:   't|3|c'
forward:  nil
backward: nil
last:     't|3' + '|c'

expect:   't|3' + '|c'
forward:  nil
backward: 't|2|b' + '|c'
last:     nil

expect:   't|2|b|c'
forward:  nil
backward: 't|2|b' + '|c'
last:     nil

```lua
---@return <?A?>
local function f()
end

local <!x!> = f()
```

'd|A'
'f|1|#1'
'f|1' + '|#1'
'l|1' + '|#1'
's|1' + '|#1'

```lua
---@generic T
---@param a T
---@return T
local function f(a) end

local <?c?>

local <!v!> = f(c)
```

'l1'
'l2|@1'
'f|1|@1'
'f|1|#1'