aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdoc/docs/doc/README.md6
-rw-r--r--spec/inputs/destructure.yue3
-rw-r--r--spec/outputs/destructure.lua7
-rwxr-xr-xsrc/yuescript/yue_compiler.cpp3
4 files changed, 15 insertions, 4 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md
index 5c43917..adff569 100755
--- a/doc/docs/doc/README.md
+++ b/doc/docs/doc/README.md
@@ -657,7 +657,7 @@ do
657 657
658The export statement offers a concise way to define modules. 658The export statement offers a concise way to define modules.
659 659
660* **Named Export** 660* **Named Export**
661Named export will define a local variable as well as adding a field in the exported table. 661Named export will define a local variable as well as adding a field in the exported table.
662 662
663```moonscript 663```moonscript
@@ -693,7 +693,7 @@ export class Something
693</pre> 693</pre>
694</YueDisplay> 694</YueDisplay>
695 695
696* **Unnamed Export** 696* **Unnamed Export**
697Unnamed export will add the target item into the array part of the exported table. 697Unnamed export will add the target item into the array part of the exported table.
698 698
699```moonscript 699```moonscript
@@ -723,7 +723,7 @@ export with tmp
723</pre> 723</pre>
724</YueDisplay> 724</YueDisplay>
725 725
726* **Default Export** 726* **Default Export**
727Using the **default** keyword in export statement to replace the exported table with any thing. 727Using the **default** keyword in export statement to replace the exported table with any thing.
728 728
729```moonscript 729```moonscript
diff --git a/spec/inputs/destructure.yue b/spec/inputs/destructure.yue
index e1c6b27..a235abd 100644
--- a/spec/inputs/destructure.yue
+++ b/spec/inputs/destructure.yue
@@ -178,3 +178,6 @@ do
178 for {left = "null", right = false} in *tuples 178 for {left = "null", right = false} in *tuples
179 print left, right 179 print left, right
180 180
181do
182 {_, a, _, b} = tb -- list placeholder
183
diff --git a/spec/outputs/destructure.lua b/spec/outputs/destructure.lua
index 1862b85..9b16181 100644
--- a/spec/outputs/destructure.lua
+++ b/spec/outputs/destructure.lua
@@ -358,3 +358,10 @@ do
358 print(left, right) 358 print(left, right)
359 end 359 end
360end 360end
361do
362 local a, b
363 do
364 local _obj_0 = tb
365 a, b = _obj_0[2], _obj_0[4]
366 end
367end
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index e7da2dd..17fbaf6 100755
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -60,7 +60,7 @@ using namespace parserlib;
60 60
61typedef std::list<std::string> str_list; 61typedef std::list<std::string> str_list;
62 62
63const std::string_view version = "0.10.11"sv; 63const std::string_view version = "0.10.12"sv;
64const std::string_view extension = "yue"sv; 64const std::string_view extension = "yue"sv;
65 65
66class YueCompilerImpl { 66class YueCompilerImpl {
@@ -1597,6 +1597,7 @@ private:
1597 _config.lintGlobalVariable = false; 1597 _config.lintGlobalVariable = false;
1598 auto exp = static_cast<Exp_t*>(pair); 1598 auto exp = static_cast<Exp_t*>(pair);
1599 auto varName = singleVariableFrom(exp); 1599 auto varName = singleVariableFrom(exp);
1600 if (varName == "_"sv) break;
1600 bool isVariable = !varName.empty(); 1601 bool isVariable = !varName.empty();
1601 if (!isVariable) { 1602 if (!isVariable) {
1602 str_list temp; 1603 str_list temp;