upd: fixing

This commit is contained in:
2023-11-10 23:01:05 +08:00
parent bcef9b17ba
commit 8ad2fde034

View File

@ -412,14 +412,14 @@ bool Greater(std::any a, std::any b) {
return (*ptr_a_string) > (*ptr_b_string); return (*ptr_a_string) > (*ptr_b_string);
else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) { else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) {
if (std::any_cast<NoneType>(&b) && *ptr_a_string != "") return true; if (std::any_cast<NoneType>(&b) && *ptr_a_string != "") return true;
if (ptr_a_bool != nullptr) { // if (ptr_a_bool != nullptr) {
b = Any2Bool(b); // b = Any2Bool(b);
return int(*ptr_a_bool) > int(std::any_cast<bool>(b)); // return int(*ptr_a_bool) > int(std::any_cast<bool>(b));
} // }
if (ptr_b_bool != nullptr) { // if (ptr_b_bool != nullptr) {
a = Any2Bool(a); // a = Any2Bool(a);
return int(std::any_cast<bool>(a)) > int(*ptr_b_bool); // return int(std::any_cast<bool>(a)) > int(*ptr_b_bool);
} // }
return false; return false;
} else } else
throw FatalError("Greater: Type Error", 54); throw FatalError("Greater: Type Error", 54);
@ -444,14 +444,14 @@ bool Less(std::any a, std::any b) {
return (*ptr_a_string) < (*ptr_b_string); return (*ptr_a_string) < (*ptr_b_string);
else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) { else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) {
if (std::any_cast<NoneType>(&a) && *ptr_b_string != "") return true; if (std::any_cast<NoneType>(&a) && *ptr_b_string != "") return true;
if (ptr_a_bool != nullptr) { // if (ptr_a_bool != nullptr) {
b = Any2Bool(b); // b = Any2Bool(b);
return int(*ptr_a_bool) < int(std::any_cast<bool>(b)); // return int(*ptr_a_bool) < int(std::any_cast<bool>(b));
} // }
if (ptr_b_bool != nullptr) { // if (ptr_b_bool != nullptr) {
a = Any2Bool(a); // a = Any2Bool(a);
return int(std::any_cast<bool>(a)) < int(*ptr_b_bool); // return int(std::any_cast<bool>(a)) < int(*ptr_b_bool);
} // }
return false; return false;
} else } else
throw FatalError("Less: Type Error", 55); throw FatalError("Less: Type Error", 55);
@ -479,14 +479,14 @@ bool Equal(std::any a, std::any b) {
else if ((ptr_a_string != nullptr) && (ptr_b_string != nullptr)) else if ((ptr_a_string != nullptr) && (ptr_b_string != nullptr))
return (*ptr_a_string) == (*ptr_b_string); return (*ptr_a_string) == (*ptr_b_string);
else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) { else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) {
if (ptr_a_bool != nullptr) { // if (ptr_a_bool != nullptr) {
b = Any2Bool(b); // b = Any2Bool(b);
return int(*ptr_a_bool) == int(std::any_cast<bool>(b)); // return int(*ptr_a_bool) == int(std::any_cast<bool>(b));
} // }
if (ptr_b_bool != nullptr) { // if (ptr_b_bool != nullptr) {
a = Any2Bool(a); // a = Any2Bool(a);
return int(std::any_cast<bool>(a)) == int(*ptr_b_bool); // return int(std::any_cast<bool>(a)) == int(*ptr_b_bool);
} // }
return false; return false;
} else } else
throw FatalError("Equal: Type Error", 56); throw FatalError("Equal: Type Error", 56);
@ -514,15 +514,15 @@ bool NotEqual(std::any a, std::any b) {
else if ((ptr_a_string != nullptr) && (ptr_b_string != nullptr)) else if ((ptr_a_string != nullptr) && (ptr_b_string != nullptr))
return (*ptr_a_string) != (*ptr_b_string); return (*ptr_a_string) != (*ptr_b_string);
else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) { else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) {
if (ptr_a_bool != nullptr) { // if (ptr_a_bool != nullptr) {
b = Any2Bool(b); // b = Any2Bool(b);
return int(*ptr_a_bool) != int(std::any_cast<bool>(b)); // return int(*ptr_a_bool) != int(std::any_cast<bool>(b));
} // }
if (ptr_b_bool != nullptr) { // if (ptr_b_bool != nullptr) {
a = Any2Bool(a); // a = Any2Bool(a);
return int(std::any_cast<bool>(a)) != int(*ptr_b_bool); // return int(std::any_cast<bool>(a)) != int(*ptr_b_bool);
} // }
return false; return true;
} else } else
throw FatalError("NotEqual: Type Error", 57); throw FatalError("NotEqual: Type Error", 57);
} }
@ -551,14 +551,14 @@ bool GreaterEqual(std::any a, std::any b) {
return (*ptr_a_string) >= (*ptr_b_string); return (*ptr_a_string) >= (*ptr_b_string);
else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) { else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) {
if (std::any_cast<NoneType>(&b)) return true; if (std::any_cast<NoneType>(&b)) return true;
if (ptr_a_bool != nullptr) { // if (ptr_a_bool != nullptr) {
b = Any2Bool(b); // b = Any2Bool(b);
return int(*ptr_a_bool) >= int(std::any_cast<bool>(b)); // return int(*ptr_a_bool) >= int(std::any_cast<bool>(b));
} // }
if (ptr_b_bool != nullptr) { // if (ptr_b_bool != nullptr) {
a = Any2Bool(a); // a = Any2Bool(a);
return int(std::any_cast<bool>(a)) >= int(*ptr_b_bool); // return int(std::any_cast<bool>(a)) >= int(*ptr_b_bool);
} // }
return false; return false;
} else } else
throw FatalError("GreaterEqual: Type Error", 58); throw FatalError("GreaterEqual: Type Error", 58);
@ -588,14 +588,14 @@ bool LessEqual(std::any a, std::any b) {
return (*ptr_a_string) <= (*ptr_b_string); return (*ptr_a_string) <= (*ptr_b_string);
else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) { else if (((ptr_a_string != nullptr) || (ptr_b_string != nullptr))) {
if (std::any_cast<NoneType>(&a)) return true; if (std::any_cast<NoneType>(&a)) return true;
if (ptr_a_bool != nullptr) { // if (ptr_a_bool != nullptr) {
b = Any2Bool(b); // b = Any2Bool(b);
return int(*ptr_a_bool) <= int(std::any_cast<bool>(b)); // return int(*ptr_a_bool) <= int(std::any_cast<bool>(b));
} // }
if (ptr_b_bool != nullptr) { // if (ptr_b_bool != nullptr) {
a = Any2Bool(a); // a = Any2Bool(a);
return int(std::any_cast<bool>(a)) <= int(*ptr_b_bool); // return int(std::any_cast<bool>(a)) <= int(*ptr_b_bool);
} // }
return false; return false;
} else } else
throw FatalError("LessEqual: Type Error", 59); throw FatalError("LessEqual: Type Error", 59);