aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuescript/yue_compiler.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 4917e4e..7be0c84 100644
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -58,7 +58,7 @@ inline std::string s(std::string_view sv) {
58 return std::string(sv); 58 return std::string(sv);
59} 59}
60 60
61const std::string_view version = "0.6.6"sv; 61const std::string_view version = "0.6.7"sv;
62const std::string_view extension = "yue"sv; 62const std::string_view extension = "yue"sv;
63 63
64class YueCompilerImpl { 64class YueCompilerImpl {
@@ -3460,6 +3460,20 @@ private:
3460 info.node.set(exp); 3460 info.node.set(exp);
3461 } 3461 }
3462 } 3462 }
3463 if (auto block = info.node.as<Block_t>()) {
3464 for (auto stmt_ : block->statements.objects()) {
3465 auto stmt = static_cast<Statement_t*>(stmt_);
3466 if (auto global = stmt->content.as<Global_t>()) {
3467 if (global->item.is<global_op_t>()) {
3468 throw std::logic_error(_info.errorMessage(s("can not insert global statement with wildcard operator from macro"sv), x));
3469 }
3470 } else if (auto local = stmt->content.as<Local_t>()) {
3471 if (local->item.is<local_flag_t>()) {
3472 throw std::logic_error(_info.errorMessage(s("can not insert local statement with wildcard operator from macro"sv), x));
3473 }
3474 }
3475 }
3476 }
3463 return {info.node, std::move(info.codes), Empty, std::move(localVars)}; 3477 return {info.node, std::move(info.codes), Empty, std::move(localVars)};
3464 } else { 3478 } else {
3465 if (!isBlock) throw std::logic_error(_info.errorMessage(s("failed to expanded empty macro as expr"sv), x)); 3479 if (!isBlock) throw std::logic_error(_info.errorMessage(s("failed to expanded empty macro as expr"sv), x));