aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/yuescript/yue_compiler.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 5b8b112..7dc4558 100644
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -5366,9 +5366,10 @@ private:
5366 5366
5367 void transformUnaryValue(UnaryValue_t* unary_value, str_list& out) { 5367 void transformUnaryValue(UnaryValue_t* unary_value, str_list& out) {
5368 str_list temp; 5368 str_list temp;
5369 int target = getLuaTarget(unary_value);
5369 for (auto _op : unary_value->ops.objects()) { 5370 for (auto _op : unary_value->ops.objects()) {
5370 std::string op = _parser.toString(_op); 5371 std::string op = _parser.toString(_op);
5371 if (op == "~"sv && getLuaTarget(_op) < 503) { 5372 if (op == "~"sv && target < 503) {
5372 throw CompileError("bitwise operator is not available when not targeting Lua version 5.3 or higher"sv, _op); 5373 throw CompileError("bitwise operator is not available when not targeting Lua version 5.3 or higher"sv, _op);
5373 } 5374 }
5374 temp.push_back(op == "not"sv ? op + ' ' : op); 5375 temp.push_back(op == "not"sv ? op + ' ' : op);
@@ -5630,9 +5631,10 @@ private:
5630 return; 5631 return;
5631 } 5632 }
5632 std::string unary_op; 5633 std::string unary_op;
5634 int target = getLuaTarget(unary_exp);
5633 for (auto _op : unary_exp->ops.objects()) { 5635 for (auto _op : unary_exp->ops.objects()) {
5634 std::string op = _parser.toString(_op); 5636 std::string op = _parser.toString(_op);
5635 if (op == "~"sv && getLuaTarget(_op) < 503) { 5637 if (op == "~"sv && target < 503) {
5636 throw CompileError("bitwise operator is not available when not targeting Lua version 5.3 or higher"sv, _op); 5638 throw CompileError("bitwise operator is not available when not targeting Lua version 5.3 or higher"sv, _op);
5637 } 5639 }
5638 unary_op.append(op == "not"sv ? op + ' ' : op); 5640 unary_op.append(op == "not"sv ? op + ' ' : op);