diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-03-17 18:53:10 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-03-17 18:53:10 +0800 |
commit | 3b13f002fa99ebf1eb50734019c3efcb56bf31a2 (patch) | |
tree | 6f86d9ed67389f02e66f9834180fa944f0b23275 /test-beta | |
parent | 5cb11fec575ef35576ad467910d79d1cb035532d (diff) | |
download | lua-language-server-3b13f002fa99ebf1eb50734019c3efcb56bf31a2.zip |
随便写写
Diffstat (limited to 'test-beta')
-rw-r--r-- | test-beta/???.md | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/test-beta/???.md b/test-beta/???.md new file mode 100644 index 00000000..46a4b58a --- /dev/null +++ b/test-beta/???.md @@ -0,0 +1,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', + } +} +``` |