diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-05-21 15:42:03 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-05-21 15:42:03 +0800 |
| commit | d4b7efe3f48b40d108754d2e8359fee1cd9dded8 (patch) | |
| tree | 2ec4133a47b947ec78d12076f981aa38d3b569c6 /spec | |
| parent | 0603800a4114ed8b4c9572a7d7852995c9b9f334 (diff) | |
| download | yuescript-d4b7efe3f48b40d108754d2e8359fee1cd9dded8.tar.gz yuescript-d4b7efe3f48b40d108754d2e8359fee1cd9dded8.tar.bz2 yuescript-d4b7efe3f48b40d108754d2e8359fee1cd9dded8.zip | |
Added global const declaration.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/inputs/global.yue | 5 | ||||
| -rw-r--r-- | spec/outputs/global.lua | 25 |
2 files changed, 30 insertions, 0 deletions
diff --git a/spec/inputs/global.yue b/spec/inputs/global.yue index ce1cc15..8316d16 100644 --- a/spec/inputs/global.yue +++ b/spec/inputs/global.yue | |||
| @@ -82,3 +82,8 @@ do | |||
| 82 | FooBar = "pascal case" | 82 | FooBar = "pascal case" |
| 83 | FOOBAR = "all uppercase" | 83 | FOOBAR = "all uppercase" |
| 84 | 84 | ||
| 85 | do | ||
| 86 | global const class A | ||
| 87 | global const Flag = 1 | ||
| 88 | global const const, x, y = "const", 1, 2 | ||
| 89 | |||
diff --git a/spec/outputs/global.lua b/spec/outputs/global.lua index 54a21a9..3918f85 100644 --- a/spec/outputs/global.lua +++ b/spec/outputs/global.lua | |||
| @@ -93,3 +93,28 @@ do | |||
| 93 | FooBar = "pascal case" | 93 | FooBar = "pascal case" |
| 94 | FOOBAR = "all uppercase" | 94 | FOOBAR = "all uppercase" |
| 95 | end | 95 | end |
| 96 | do | ||
| 97 | do | ||
| 98 | local _class_0 | ||
| 99 | local _base_0 = { } | ||
| 100 | if _base_0.__index == nil then | ||
| 101 | _base_0.__index = _base_0 | ||
| 102 | end | ||
| 103 | _class_0 = setmetatable({ | ||
| 104 | __init = function() end, | ||
| 105 | __base = _base_0, | ||
| 106 | __name = "A" | ||
| 107 | }, { | ||
| 108 | __index = _base_0, | ||
| 109 | __call = function(cls, ...) | ||
| 110 | local _self_0 = setmetatable({ }, _base_0) | ||
| 111 | cls.__init(_self_0, ...) | ||
| 112 | return _self_0 | ||
| 113 | end | ||
| 114 | }) | ||
| 115 | _base_0.__class = _class_0 | ||
| 116 | A = _class_0 | ||
| 117 | end | ||
| 118 | Flag = 1 | ||
| 119 | const, x, y = "const", 1, 2 | ||
| 120 | end | ||
