From f4147d5fea31438cfee3dc3781806a1a0b6c40c9 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 14 Jul 2022 14:35:58 +0800 Subject: fix a case when doing optional destructuring for metatable. --- spec/inputs/switch.yue | 5 +++++ src/yuescript/yue_compiler.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/inputs/switch.yue b/spec/inputs/switch.yue index 04bb02e..9e7ecfd 100644 --- a/spec/inputs/switch.yue +++ b/spec/inputs/switch.yue @@ -144,5 +144,10 @@ do else "should not reach here unless it is not a table" +do + switch y + when {x: #:mt} + print mt + nil diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 2565878..21764fe 100755 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -56,7 +56,7 @@ using namespace parserlib; typedef std::list str_list; -const std::string_view version = "0.13.4"sv; +const std::string_view version = "0.13.5"sv; const std::string_view extension = "yue"sv; class YueCompilerImpl { @@ -2012,7 +2012,7 @@ private: pairs.push_back({ p.target, p.targetVar, - ".#"s + sep + p.structure, + ".#"s + (p.structure.empty() ? Empty : sep + p.structure), p.defVal }); } -- cgit v1.2.3-55-g6feb