diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-01-31 23:17:45 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-01-31 23:19:02 +0800 |
| commit | d1878f2b8eb1644205c5e0b641fd092e8b222766 (patch) | |
| tree | 17f1108e35d845364f928e8f9c2178c7d2d0d902 /spec/outputs/macro.lua | |
| parent | 8124020b3827a8f86970ef8f1efb164e5e110755 (diff) | |
| download | yuescript-d1878f2b8eb1644205c5e0b641fd092e8b222766.tar.gz yuescript-d1878f2b8eb1644205c5e0b641fd092e8b222766.tar.bz2 yuescript-d1878f2b8eb1644205c5e0b641fd092e8b222766.zip | |
Aligned Lua inserter macro behavior with common Yue macro.v0.27.0
Diffstat (limited to 'spec/outputs/macro.lua')
| -rw-r--r-- | spec/outputs/macro.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/outputs/macro.lua b/spec/outputs/macro.lua index 7163077..aa74ed9 100644 --- a/spec/outputs/macro.lua +++ b/spec/outputs/macro.lua | |||
| @@ -5,7 +5,9 @@ do | |||
| 5 | end | 5 | end |
| 6 | print(456) | 6 | print(456) |
| 7 | do | 7 | do |
| 8 | do | ||
| 8 | -- TODO: "todo in a do block" | 9 | -- TODO: "todo in a do block" |
| 10 | end | ||
| 9 | end | 11 | end |
| 10 | end | 12 | end |
| 11 | do | 13 | do |
| @@ -201,13 +203,17 @@ do | |||
| 201 | print(a) | 203 | print(a) |
| 202 | end | 204 | end |
| 203 | local x = 0 | 205 | local x = 0 |
| 206 | do | ||
| 204 | local function f(a) | 207 | local function f(a) |
| 205 | return a + 1 | 208 | return a + 1 |
| 206 | end | 209 | end |
| 207 | x = x + f(3) | 210 | x = x + f(3) |
| 211 | end | ||
| 212 | do | ||
| 208 | function tb:func() | 213 | function tb:func() |
| 209 | print(123) | 214 | print(123) |
| 210 | end | 215 | end |
| 216 | end | ||
| 211 | print(x) | 217 | print(x) |
| 212 | local sel | 218 | local sel |
| 213 | sel = function(a, b, c) | 219 | sel = function(a, b, c) |
| @@ -217,6 +223,7 @@ sel = function(a, b, c) | |||
| 217 | return c | 223 | return c |
| 218 | end | 224 | end |
| 219 | end | 225 | end |
| 226 | do | ||
| 220 | local function sel(a, b, c) | 227 | local function sel(a, b, c) |
| 221 | if a then | 228 | if a then |
| 222 | return b | 229 | return b |
| @@ -224,10 +231,15 @@ local function sel(a, b, c) | |||
| 224 | return c | 231 | return c |
| 225 | end | 232 | end |
| 226 | end | 233 | end |
| 234 | end | ||
| 235 | do | ||
| 227 | local function dummy() | 236 | local function dummy() |
| 228 | 237 | ||
| 229 | end | 238 | end |
| 239 | end | ||
| 240 | do | ||
| 230 | -- a comment here | 241 | -- a comment here |
| 242 | end | ||
| 231 | local _ = require('underscore') | 243 | local _ = require('underscore') |
| 232 | local a = ((((_({ | 244 | local a = ((((_({ |
| 233 | 1, | 245 | 1, |
| @@ -279,9 +291,11 @@ do | |||
| 279 | _6:Destroy() | 291 | _6:Destroy() |
| 280 | end | 292 | end |
| 281 | end | 293 | end |
| 294 | do | ||
| 282 | origin.transform.root.gameObject:Parents():Descendants():SelectEnable():SelectVisible():TagEqual("fx"):Where(function(x) | 295 | origin.transform.root.gameObject:Parents():Descendants():SelectEnable():SelectVisible():TagEqual("fx"):Where(function(x) |
| 283 | return x.name:EndsWith("(Clone)") | 296 | return x.name:EndsWith("(Clone)") |
| 284 | end):Destroy() | 297 | end):Destroy() |
| 298 | end | ||
| 285 | print((setmetatable({ | 299 | print((setmetatable({ |
| 286 | 'abc', | 300 | 'abc', |
| 287 | a = 123, | 301 | a = 123, |
| @@ -313,7 +327,9 @@ print((setmetatable({ | |||
| 313 | })) | 327 | })) |
| 314 | print("current line: " .. tostring(323)) | 328 | print("current line: " .. tostring(323)) |
| 315 | do | 329 | do |
| 330 | do | ||
| 316 | -- TODO | 331 | -- TODO |
| 332 | end | ||
| 317 | end | 333 | end |
| 318 | do | 334 | do |
| 319 | print(1) | 335 | print(1) |
| @@ -336,7 +352,9 @@ do | |||
| 336 | end | 352 | end |
| 337 | local f1 | 353 | local f1 |
| 338 | f1 = function() | 354 | f1 = function() |
| 355 | do | ||
| 339 | tb:func(123) | 356 | tb:func(123) |
| 357 | end | ||
| 340 | return | 358 | return |
| 341 | end | 359 | end |
| 342 | end | 360 | end |
