diff options
author | Li Jin <dragon-fly@qq.com> | 2022-08-16 10:40:36 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-08-16 10:40:36 +0800 |
commit | 82b86397797ecd4d1782ee75abf7933e5d973e3c (patch) | |
tree | 528cbf8a128c94679b63223e6fd16fa8659dbe36 /src | |
parent | be7fabeef0b6de9b15c2ff34e95794d87042c3bd (diff) | |
download | yuescript-82b86397797ecd4d1782ee75abf7933e5d973e3c.tar.gz yuescript-82b86397797ecd4d1782ee75abf7933e5d973e3c.tar.bz2 yuescript-82b86397797ecd4d1782ee75abf7933e5d973e3c.zip |
fix a missing argument number check.
Diffstat (limited to 'src')
-rwxr-xr-x | src/yuescript/yue_compiler.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 868bf90..b730a9f 100755 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -54,7 +54,7 @@ namespace yue { | |||
54 | 54 | ||
55 | typedef std::list<std::string> str_list; | 55 | typedef std::list<std::string> str_list; |
56 | 56 | ||
57 | const std::string_view version = "0.14.4"sv; | 57 | const std::string_view version = "0.14.5"sv; |
58 | const std::string_view extension = "yue"sv; | 58 | const std::string_view extension = "yue"sv; |
59 | 59 | ||
60 | class YueCompilerImpl { | 60 | class YueCompilerImpl { |
@@ -1366,7 +1366,10 @@ private: | |||
1366 | } | 1366 | } |
1367 | BREAK_IF(checkValuesLater); | 1367 | BREAK_IF(checkValuesLater); |
1368 | auto value = singleValueFrom(values.back()); | 1368 | auto value = singleValueFrom(values.back()); |
1369 | BREAK_IF(!value); | 1369 | if (!value) { |
1370 | _buf << exprs.size() << " right values expected, got "sv << values.size(); | ||
1371 | throw std::logic_error(_info.errorMessage(clearBuf(), values.front())); | ||
1372 | } | ||
1370 | if (auto val = value->item.as<SimpleValue_t>()) { | 1373 | if (auto val = value->item.as<SimpleValue_t>()) { |
1371 | switch (val->value->getId()) { | 1374 | switch (val->value->getId()) { |
1372 | case id<If_t>(): | 1375 | case id<If_t>(): |
@@ -6974,7 +6977,7 @@ private: | |||
6974 | for (auto name : import->names.objects()) { | 6977 | for (auto name : import->names.objects()) { |
6975 | switch (name->getId()) { | 6978 | switch (name->getId()) { |
6976 | case id<Variable_t>(): { | 6979 | case id<Variable_t>(): { |
6977 | auto var = ast_to<Variable_t>(name); | 6980 | auto var = static_cast<Variable_t*>(name); |
6978 | { | 6981 | { |
6979 | auto callable = toAst<Callable_t>(objVar, x); | 6982 | auto callable = toAst<Callable_t>(objVar, x); |
6980 | auto dotChainItem = x->new_ptr<DotChainItem_t>(); | 6983 | auto dotChainItem = x->new_ptr<DotChainItem_t>(); |