upd: add float* str
This commit is contained in:
@ -216,13 +216,21 @@ std::any Mul(std::any a, std::any b) {
|
||||
(ptr_b_string != nullptr ? 1 : 0) ==
|
||||
1) {
|
||||
if (ptr_a_string == nullptr) {
|
||||
std::swap(ptr_a_string, ptr_b_string);
|
||||
std::swap(ptr_a_bool, ptr_b_bool);
|
||||
std::swap(ptr_a_int2048, ptr_b_int2048);
|
||||
std::swap(ptr_a_float, ptr_b_float);
|
||||
std::swap(a, b);
|
||||
ptr_a_bool = std::any_cast<bool>(&a);
|
||||
ptr_b_bool = std::any_cast<bool>(&b);
|
||||
ptr_a_int2048 = std::any_cast<ZYM::int2048>(&a);
|
||||
ptr_b_int2048 = std::any_cast<ZYM::int2048>(&b);
|
||||
ptr_a_float = std::any_cast<double>(&a);
|
||||
ptr_b_float = std::any_cast<double>(&b);
|
||||
ptr_a_string = std::any_cast<std::string>(&a);
|
||||
ptr_b_string = std::any_cast<std::string>(&b);
|
||||
}
|
||||
if (ptr_b_float != nullptr) {
|
||||
b = Any2Int(*ptr_b_float);
|
||||
ptr_b_int2048 = std::any_cast<ZYM::int2048>(&b);
|
||||
goto st;
|
||||
}
|
||||
if (ptr_b_float != nullptr)
|
||||
throw InterpretException("Mul: string*float not allowed", 41);
|
||||
if (ptr_b_bool != nullptr) {
|
||||
if (*ptr_b_bool) {
|
||||
return *ptr_a_string;
|
||||
@ -234,6 +242,7 @@ std::any Mul(std::any a, std::any b) {
|
||||
std::any_cast<NoneType>(&b) != nullptr)
|
||||
return std::string("");
|
||||
if (ptr_b_int2048 != nullptr) {
|
||||
st:;
|
||||
std::string res;
|
||||
for (int i = 0; i < (*ptr_b_int2048); i++) res += *ptr_a_string;
|
||||
return res;
|
||||
|
Reference in New Issue
Block a user