rufus-lua-moon 0.2.3.2 → 0.2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rufus/lua/moon/version.rb +1 -1
- data/vendor/lua/moon/all.moon +5 -7
- data/vendor/lua/moon/init.moon +6 -8
- data/vendor/lua/moonscript/base.lua +2 -0
- data/vendor/lua/moonscript/compile/statement.lua +25 -26
- data/vendor/lua/moonscript/compile/value.lua +43 -36
- data/vendor/lua/moonscript/compile.lua +69 -128
- data/vendor/lua/moonscript/data.lua +9 -21
- data/vendor/lua/moonscript/dump.lua +6 -6
- data/vendor/lua/moonscript/errors.lua +18 -12
- data/vendor/lua/moonscript/init.lua +15 -13
- data/vendor/lua/moonscript/parse.lua +5 -5
- data/vendor/lua/moonscript/transform/destructure.lua +44 -39
- data/vendor/lua/moonscript/transform/names.lua +12 -41
- data/vendor/lua/moonscript/transform.lua +298 -322
- data/vendor/lua/moonscript/types.lua +18 -11
- data/vendor/lua/moonscript/util.lua +26 -22
- data/vendor/lua/moonscript/version.lua +1 -1
- metadata +2 -1
@@ -1,50 +1,52 @@
|
|
1
1
|
local ntype, mtype, build
|
2
2
|
do
|
3
|
-
local
|
4
|
-
ntype, mtype, build =
|
3
|
+
local _obj_0 = require("moonscript.types")
|
4
|
+
ntype, mtype, build = _obj_0.ntype, _obj_0.mtype, _obj_0.build
|
5
5
|
end
|
6
6
|
local NameProxy
|
7
7
|
do
|
8
|
-
local
|
9
|
-
NameProxy =
|
8
|
+
local _obj_0 = require("moonscript.transform.names")
|
9
|
+
NameProxy = _obj_0.NameProxy
|
10
|
+
end
|
11
|
+
local insert
|
12
|
+
do
|
13
|
+
local _obj_0 = table
|
14
|
+
insert = _obj_0.insert
|
10
15
|
end
|
11
|
-
local insert = table.insert
|
12
16
|
local unpack
|
13
17
|
do
|
14
|
-
local
|
15
|
-
unpack =
|
18
|
+
local _obj_0 = require("moonscript.util")
|
19
|
+
unpack = _obj_0.unpack
|
16
20
|
end
|
17
21
|
local user_error
|
18
22
|
do
|
19
|
-
local
|
20
|
-
user_error =
|
23
|
+
local _obj_0 = require("moonscript.errors")
|
24
|
+
user_error = _obj_0.user_error
|
21
25
|
end
|
26
|
+
local util = require("moonscript.util")
|
22
27
|
local join
|
23
28
|
join = function(...)
|
24
29
|
do
|
25
|
-
local
|
26
|
-
local out = _with_0
|
30
|
+
local out = { }
|
27
31
|
local i = 1
|
28
32
|
local _list_0 = {
|
29
33
|
...
|
30
34
|
}
|
31
35
|
for _index_0 = 1, #_list_0 do
|
32
36
|
local tbl = _list_0[_index_0]
|
33
|
-
|
34
|
-
|
35
|
-
local v = _list_1[_index_1]
|
37
|
+
for _index_1 = 1, #tbl do
|
38
|
+
local v = tbl[_index_1]
|
36
39
|
out[i] = v
|
37
40
|
i = i + 1
|
38
41
|
end
|
39
42
|
end
|
40
|
-
return
|
43
|
+
return out
|
41
44
|
end
|
42
45
|
end
|
43
46
|
local has_destructure
|
44
47
|
has_destructure = function(names)
|
45
|
-
|
46
|
-
|
47
|
-
local n = _list_0[_index_0]
|
48
|
+
for _index_0 = 1, #names do
|
49
|
+
local n = names[_index_0]
|
48
50
|
if ntype(n) == "table" then
|
49
51
|
return true
|
50
52
|
end
|
@@ -78,10 +80,15 @@ extract_assign_names = function(name, accum, prefix)
|
|
78
80
|
local key = tuple[1]
|
79
81
|
local s
|
80
82
|
if ntype(key) == "key_literal" then
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
local key_name = key[2]
|
84
|
+
if ntype(key_name) == "colon_stub" then
|
85
|
+
s = key_name
|
86
|
+
else
|
87
|
+
s = {
|
88
|
+
"dot",
|
89
|
+
key_name
|
90
|
+
}
|
91
|
+
end
|
85
92
|
else
|
86
93
|
s = {
|
87
94
|
"index",
|
@@ -108,7 +115,7 @@ extract_assign_names = function(name, accum, prefix)
|
|
108
115
|
return accum
|
109
116
|
end
|
110
117
|
local build_assign
|
111
|
-
build_assign = function(destruct_literal, receiver)
|
118
|
+
build_assign = function(scope, destruct_literal, receiver)
|
112
119
|
local extracted_names = extract_assign_names(destruct_literal)
|
113
120
|
local names = { }
|
114
121
|
local values = { }
|
@@ -118,12 +125,11 @@ build_assign = function(destruct_literal, receiver)
|
|
118
125
|
values
|
119
126
|
}
|
120
127
|
local obj
|
121
|
-
if
|
128
|
+
if scope:is_local(receiver) then
|
122
129
|
obj = receiver
|
123
130
|
else
|
124
131
|
do
|
125
|
-
|
126
|
-
obj = _with_0
|
132
|
+
obj = NameProxy("obj")
|
127
133
|
inner = build["do"]({
|
128
134
|
build.assign_one(obj, receiver),
|
129
135
|
{
|
@@ -132,14 +138,13 @@ build_assign = function(destruct_literal, receiver)
|
|
132
138
|
values
|
133
139
|
}
|
134
140
|
})
|
135
|
-
obj =
|
141
|
+
obj = obj
|
136
142
|
end
|
137
143
|
end
|
138
|
-
|
139
|
-
|
140
|
-
local tuple = _list_0[_index_0]
|
144
|
+
for _index_0 = 1, #extracted_names do
|
145
|
+
local tuple = extracted_names[_index_0]
|
141
146
|
insert(names, tuple[1])
|
142
|
-
insert(values,
|
147
|
+
insert(values, NameProxy.chain(obj, unpack(tuple[2])))
|
143
148
|
end
|
144
149
|
return build.group({
|
145
150
|
{
|
@@ -150,7 +155,7 @@ build_assign = function(destruct_literal, receiver)
|
|
150
155
|
})
|
151
156
|
end
|
152
157
|
local split_assign
|
153
|
-
split_assign = function(assign)
|
158
|
+
split_assign = function(scope, assign)
|
154
159
|
local names, values = unpack(assign, 2)
|
155
160
|
local g = { }
|
156
161
|
local total_names = #names
|
@@ -182,7 +187,7 @@ split_assign = function(assign)
|
|
182
187
|
end)()
|
183
188
|
})
|
184
189
|
end
|
185
|
-
insert(g, build_assign(n, values[i]))
|
190
|
+
insert(g, build_assign(scope, n, values[i]))
|
186
191
|
start = i + 1
|
187
192
|
end
|
188
193
|
end
|
@@ -193,15 +198,15 @@ split_assign = function(assign)
|
|
193
198
|
"_"
|
194
199
|
}
|
195
200
|
else
|
196
|
-
|
201
|
+
do
|
197
202
|
local _accum_0 = { }
|
198
203
|
local _len_0 = 1
|
199
204
|
for i = start, total_names do
|
200
205
|
_accum_0[_len_0] = names[i]
|
201
206
|
_len_0 = _len_0 + 1
|
202
207
|
end
|
203
|
-
|
204
|
-
end
|
208
|
+
name_slice = _accum_0
|
209
|
+
end
|
205
210
|
end
|
206
211
|
local value_slice
|
207
212
|
if total_values < start then
|
@@ -209,15 +214,15 @@ split_assign = function(assign)
|
|
209
214
|
"nil"
|
210
215
|
}
|
211
216
|
else
|
212
|
-
|
217
|
+
do
|
213
218
|
local _accum_0 = { }
|
214
219
|
local _len_0 = 1
|
215
220
|
for i = start, total_values do
|
216
221
|
_accum_0[_len_0] = values[i]
|
217
222
|
_len_0 = _len_0 + 1
|
218
223
|
end
|
219
|
-
|
220
|
-
end
|
224
|
+
value_slice = _accum_0
|
225
|
+
end
|
221
226
|
end
|
222
227
|
insert(g, {
|
223
228
|
"assign",
|
@@ -1,42 +1,30 @@
|
|
1
1
|
local build
|
2
2
|
do
|
3
|
-
local
|
4
|
-
build =
|
3
|
+
local _obj_0 = require("moonscript.types")
|
4
|
+
build = _obj_0.build
|
5
5
|
end
|
6
6
|
local unpack
|
7
7
|
do
|
8
|
-
local
|
9
|
-
unpack =
|
8
|
+
local _obj_0 = require("moonscript.util")
|
9
|
+
unpack = _obj_0.unpack
|
10
10
|
end
|
11
11
|
local LocalName
|
12
12
|
do
|
13
|
-
local _parent_0 = nil
|
14
13
|
local _base_0 = {
|
15
14
|
get_name = function(self)
|
16
15
|
return self.name
|
17
16
|
end
|
18
17
|
}
|
19
18
|
_base_0.__index = _base_0
|
20
|
-
if _parent_0 then
|
21
|
-
setmetatable(_base_0, _parent_0.__base)
|
22
|
-
end
|
23
19
|
local _class_0 = setmetatable({
|
24
20
|
__init = function(self, name)
|
25
21
|
self.name = name
|
26
22
|
self[1] = "temp_name"
|
27
23
|
end,
|
28
24
|
__base = _base_0,
|
29
|
-
__name = "LocalName"
|
30
|
-
__parent = _parent_0
|
25
|
+
__name = "LocalName"
|
31
26
|
}, {
|
32
|
-
__index =
|
33
|
-
local val = rawget(_base_0, name)
|
34
|
-
if val == nil and _parent_0 then
|
35
|
-
return _parent_0[name]
|
36
|
-
else
|
37
|
-
return val
|
38
|
-
end
|
39
|
-
end,
|
27
|
+
__index = _base_0,
|
40
28
|
__call = function(cls, ...)
|
41
29
|
local _self_0 = setmetatable({}, _base_0)
|
42
30
|
cls.__init(_self_0, ...)
|
@@ -44,14 +32,10 @@ do
|
|
44
32
|
end
|
45
33
|
})
|
46
34
|
_base_0.__class = _class_0
|
47
|
-
if _parent_0 and _parent_0.__inherited then
|
48
|
-
_parent_0.__inherited(_parent_0, _class_0)
|
49
|
-
end
|
50
35
|
LocalName = _class_0
|
51
36
|
end
|
52
37
|
local NameProxy
|
53
38
|
do
|
54
|
-
local _parent_0 = nil
|
55
39
|
local _base_0 = {
|
56
40
|
get_name = function(self, scope, dont_put)
|
57
41
|
if dont_put == nil then
|
@@ -63,7 +47,8 @@ do
|
|
63
47
|
return self.name
|
64
48
|
end,
|
65
49
|
chain = function(self, ...)
|
66
|
-
local items
|
50
|
+
local items
|
51
|
+
do
|
67
52
|
local _accum_0 = { }
|
68
53
|
local _len_0 = 1
|
69
54
|
local _list_0 = {
|
@@ -81,8 +66,8 @@ do
|
|
81
66
|
end
|
82
67
|
_len_0 = _len_0 + 1
|
83
68
|
end
|
84
|
-
|
85
|
-
end
|
69
|
+
items = _accum_0
|
70
|
+
end
|
86
71
|
return build.chain({
|
87
72
|
base = self,
|
88
73
|
unpack(items)
|
@@ -106,26 +91,15 @@ do
|
|
106
91
|
end
|
107
92
|
}
|
108
93
|
_base_0.__index = _base_0
|
109
|
-
if _parent_0 then
|
110
|
-
setmetatable(_base_0, _parent_0.__base)
|
111
|
-
end
|
112
94
|
local _class_0 = setmetatable({
|
113
95
|
__init = function(self, prefix)
|
114
96
|
self.prefix = prefix
|
115
97
|
self[1] = "temp_name"
|
116
98
|
end,
|
117
99
|
__base = _base_0,
|
118
|
-
__name = "NameProxy"
|
119
|
-
__parent = _parent_0
|
100
|
+
__name = "NameProxy"
|
120
101
|
}, {
|
121
|
-
__index =
|
122
|
-
local val = rawget(_base_0, name)
|
123
|
-
if val == nil and _parent_0 then
|
124
|
-
return _parent_0[name]
|
125
|
-
else
|
126
|
-
return val
|
127
|
-
end
|
128
|
-
end,
|
102
|
+
__index = _base_0,
|
129
103
|
__call = function(cls, ...)
|
130
104
|
local _self_0 = setmetatable({}, _base_0)
|
131
105
|
cls.__init(_self_0, ...)
|
@@ -133,9 +107,6 @@ do
|
|
133
107
|
end
|
134
108
|
})
|
135
109
|
_base_0.__class = _class_0
|
136
|
-
if _parent_0 and _parent_0.__inherited then
|
137
|
-
_parent_0.__inherited(_parent_0, _class_0)
|
138
|
-
end
|
139
110
|
NameProxy = _class_0
|
140
111
|
end
|
141
112
|
return {
|