diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-01-15 17:54:59 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-01-15 17:54:59 +0800 |
| commit | afb046316a15a2c3702b1f056456b58e9356e693 (patch) | |
| tree | c4820522be5c92948553673dad42c1734d30689f /spec/outputs/import_global.lua | |
| parent | 873aced12cf65e633c95358f89a1d5ec37b81d00 (diff) | |
| download | yuescript-afb046316a15a2c3702b1f056456b58e9356e693.tar.gz yuescript-afb046316a15a2c3702b1f056456b58e9356e693.tar.bz2 yuescript-afb046316a15a2c3702b1f056456b58e9356e693.zip | |
Added const attributes.
Diffstat (limited to 'spec/outputs/import_global.lua')
| -rw-r--r-- | spec/outputs/import_global.lua | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/spec/outputs/import_global.lua b/spec/outputs/import_global.lua index c748c78..f76b4fe 100644 --- a/spec/outputs/import_global.lua +++ b/spec/outputs/import_global.lua | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | do | 1 | do |
| 2 | local print = print | 2 | local print <const> = print |
| 3 | local math = math | 3 | local math <const> = math |
| 4 | print("hello") | 4 | print("hello") |
| 5 | math.random(10) | 5 | math.random(10) |
| 6 | end | 6 | end |
| 7 | do | 7 | do |
| 8 | local print = print | 8 | local print <const> = print |
| 9 | local value = 1 | 9 | local value = 1 |
| 10 | value = value + 2 | 10 | value = value + 2 |
| 11 | print(value) | 11 | print(value) |
| @@ -16,13 +16,13 @@ do | |||
| 16 | return msg | 16 | return msg |
| 17 | end | 17 | end |
| 18 | do | 18 | do |
| 19 | local math = math | 19 | local math <const> = math |
| 20 | print("local") | 20 | print("local") |
| 21 | math.random(1) | 21 | math.random(1) |
| 22 | end | 22 | end |
| 23 | end | 23 | end |
| 24 | do | 24 | do |
| 25 | local print = print | 25 | local print <const> = print |
| 26 | local tostring | 26 | local tostring |
| 27 | tostring = function(v) | 27 | tostring = function(v) |
| 28 | return "local" | 28 | return "local" |
| @@ -33,19 +33,19 @@ end | |||
| 33 | do | 33 | do |
| 34 | local func | 34 | local func |
| 35 | func = function(x, y) | 35 | func = function(x, y) |
| 36 | local type = type | 36 | local type <const> = type |
| 37 | local tostring = tostring | 37 | local tostring <const> = tostring |
| 38 | local print = print | 38 | local print <const> = print |
| 39 | return type(x, tostring(y, print)) | 39 | return type(x, tostring(y, print)) |
| 40 | end | 40 | end |
| 41 | func(1, 2) | 41 | func(1, 2) |
| 42 | end | 42 | end |
| 43 | do | 43 | do |
| 44 | local xpcall = xpcall | 44 | local xpcall <const> = xpcall |
| 45 | local func = func | 45 | local func <const> = func |
| 46 | local world = world | 46 | local world <const> = world |
| 47 | local tostring = tostring | 47 | local tostring <const> = tostring |
| 48 | local print = print | 48 | local print <const> = print |
| 49 | xpcall(function() | 49 | xpcall(function() |
| 50 | return func("hello " .. tostring(world)) | 50 | return func("hello " .. tostring(world)) |
| 51 | end, function(err) | 51 | end, function(err) |
| @@ -53,40 +53,40 @@ do | |||
| 53 | end) | 53 | end) |
| 54 | end | 54 | end |
| 55 | do | 55 | do |
| 56 | local print = print | 56 | local print <const> = print |
| 57 | print(FLAG) | 57 | print(FLAG) |
| 58 | FLAG = 123 | 58 | FLAG = 123 |
| 59 | end | 59 | end |
| 60 | do | 60 | do |
| 61 | local print = print | 61 | local print <const> = print |
| 62 | Foo = 10 | 62 | Foo = 10 |
| 63 | print(Foo) | 63 | print(Foo) |
| 64 | Foo = Foo + 2 | 64 | Foo = Foo + 2 |
| 65 | end | 65 | end |
| 66 | do | 66 | do |
| 67 | local print = print | 67 | local print <const> = print |
| 68 | Bar = 1 | 68 | Bar = 1 |
| 69 | Baz = 2 | 69 | Baz = 2 |
| 70 | print(Bar, Baz) | 70 | print(Bar, Baz) |
| 71 | end | 71 | end |
| 72 | do | 72 | do |
| 73 | local y = y | 73 | local y <const> = y |
| 74 | x = 3434 | 74 | x = 3434 |
| 75 | if y then | 75 | if y then |
| 76 | x = 10 | 76 | x = 10 |
| 77 | end | 77 | end |
| 78 | end | 78 | end |
| 79 | do | 79 | do |
| 80 | local lowercase = lowercase | 80 | local lowercase <const> = lowercase |
| 81 | local tostring = tostring | 81 | local tostring <const> = tostring |
| 82 | local Uppercase = Uppercase | 82 | local Uppercase <const> = Uppercase |
| 83 | local foobar = "all " .. tostring(lowercase) | 83 | local foobar = "all " .. tostring(lowercase) |
| 84 | FooBar = "pascal case" | 84 | FooBar = "pascal case" |
| 85 | FOOBAR = "all " .. tostring(Uppercase) | 85 | FOOBAR = "all " .. tostring(Uppercase) |
| 86 | end | 86 | end |
| 87 | do | 87 | do |
| 88 | local setmetatable = setmetatable | 88 | local setmetatable <const> = setmetatable |
| 89 | local print = print | 89 | local print <const> = print |
| 90 | do | 90 | do |
| 91 | local _class_0 | 91 | local _class_0 |
| 92 | local _base_0 = { } | 92 | local _base_0 = { } |
| @@ -113,7 +113,7 @@ do | |||
| 113 | print(math, table) | 113 | print(math, table) |
| 114 | end | 114 | end |
| 115 | do | 115 | do |
| 116 | local X = X | 116 | local X <const> = X |
| 117 | X:func(1, 2, 3) | 117 | X:func(1, 2, 3) |
| 118 | X.tag = "abc" | 118 | X.tag = "abc" |
| 119 | return X | 119 | return X |
