summaryrefslogtreecommitdiff
path: root/test-beta/???.md
blob: 46a4b58a47ec155bac0f9c869e8f5ed65c0fbbaa (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
# 如何搜索引用

```lua
local x = 1
print(x) -- 通过语法搜索到 local x
```

```lua
local function f()
end

local x = f
print(x) -- 通过 x 的赋值搜索到函数
```

```lua
X.Y.Z = 1
print(X.Y.Z) -- 通过 field 的赋值行为搜索
```

```lua
local function f()
    return f
end

local x = f()
print(x) -- 引用不穿透函数调用?
```

```lua
local t = {
    x = 1
}

print(t.x) -- 引用穿透表
```

```lua
local function f()
    return {
        x = 1
    }
end

local t = f()
print(t.x) -- 是否穿透函数返回的表?
```

在栈帧上标记值?

```lua
X.Y.Z = 1
local t = X.Y
print(t.Z)
```

字符串匹配?
1. t -> Z
2. X.Y -> Z
3. X.Y.Z = 1

语义匹配?
1. t -> Z
2. X.Y -> Z
3. X -> Y -> Z
4. X.Y.Z = 1

建立标记?
```lua
{
    type = 'set',
    key = {
        's|X',
        's|Y',
        's|Z',
    }
    v = 1,
},
{
    type = 'local',
    key = 't',
    v = {
        's|X',
        's|Y',
    },
},
{
    type = 'get',
    key = {
        'l|t',
        's|Z',
    }
}
```