diff options
-rwxr-xr-x | doc/docs/doc/README.md | 6 | ||||
-rw-r--r-- | spec/inputs/destructure.yue | 3 | ||||
-rw-r--r-- | spec/outputs/destructure.lua | 7 | ||||
-rwxr-xr-x | src/yuescript/yue_compiler.cpp | 3 |
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 | ||
658 | The export statement offers a concise way to define modules. | 658 | The export statement offers a concise way to define modules. |
659 | 659 | ||
660 | * **Named Export** | 660 | * **Named Export** |
661 | Named export will define a local variable as well as adding a field in the exported table. | 661 | Named 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** |
697 | Unnamed export will add the target item into the array part of the exported table. | 697 | Unnamed 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** |
727 | Using the **default** keyword in export statement to replace the exported table with any thing. | 727 | Using 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 | ||
181 | do | ||
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 |
360 | end | 360 | end |
361 | do | ||
362 | local a, b | ||
363 | do | ||
364 | local _obj_0 = tb | ||
365 | a, b = _obj_0[2], _obj_0[4] | ||
366 | end | ||
367 | end | ||
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 | ||
61 | typedef std::list<std::string> str_list; | 61 | typedef std::list<std::string> str_list; |
62 | 62 | ||
63 | const std::string_view version = "0.10.11"sv; | 63 | const std::string_view version = "0.10.12"sv; |
64 | const std::string_view extension = "yue"sv; | 64 | const std::string_view extension = "yue"sv; |
65 | 65 | ||
66 | class YueCompilerImpl { | 66 | class 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; |