diff options
Diffstat (limited to '')
| -rw-r--r-- | spec/inputs/cond.yue | 8 | ||||
| -rw-r--r-- | spec/outputs/cond.lua | 14 | ||||
| -rwxr-xr-x | src/yuescript/yue_compiler.cpp | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/spec/inputs/cond.yue b/spec/inputs/cond.yue index d33eec4..42b22a7 100644 --- a/spec/inputs/cond.yue +++ b/spec/inputs/cond.yue | |||
| @@ -200,6 +200,14 @@ do | |||
| 200 | elseif c | 200 | elseif c |
| 201 | d: e = tb | 201 | d: e = tb |
| 202 | 202 | ||
| 203 | if :pi = math | ||
| 204 | print pi | ||
| 205 | |||
| 206 | do | ||
| 207 | local math | ||
| 208 | if :pi = math | ||
| 209 | print pi | ||
| 210 | |||
| 203 | nil | 211 | nil |
| 204 | 212 | ||
| 205 | 213 | ||
diff --git a/spec/outputs/cond.lua b/spec/outputs/cond.lua index 8f69e97..4dc5aa5 100644 --- a/spec/outputs/cond.lua +++ b/spec/outputs/cond.lua | |||
| @@ -299,4 +299,18 @@ do | |||
| 299 | local e = tb.d | 299 | local e = tb.d |
| 300 | end | 300 | end |
| 301 | end | 301 | end |
| 302 | do | ||
| 303 | local _des_0 = math | ||
| 304 | if _des_0 then | ||
| 305 | local pi = _des_0.pi | ||
| 306 | print(pi) | ||
| 307 | end | ||
| 308 | end | ||
| 309 | do | ||
| 310 | local math | ||
| 311 | if math then | ||
| 312 | local pi = math.pi | ||
| 313 | print(pi) | ||
| 314 | end | ||
| 315 | end | ||
| 302 | return nil | 316 | return nil |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 6c8e167..fbb3fb5 100755 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
| @@ -2259,7 +2259,7 @@ private: | |||
| 2259 | auto desVar = getUnusedName("_des_"sv); | 2259 | auto desVar = getUnusedName("_des_"sv); |
| 2260 | if (assign->values.objects().size() == 1) { | 2260 | if (assign->values.objects().size() == 1) { |
| 2261 | auto var = singleVariableFrom(assign->values.objects().front()); | 2261 | auto var = singleVariableFrom(assign->values.objects().front()); |
| 2262 | if (!var.empty()) { | 2262 | if (!var.empty() && isLocal(var)) { |
| 2263 | desVar = var; | 2263 | desVar = var; |
| 2264 | storingValue = false; | 2264 | storingValue = false; |
| 2265 | } | 2265 | } |
