This commit is contained in:
blueloveTH 2023-04-04 22:01:56 +08:00
parent 1e73f7e1bf
commit 3d40a3d51f
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ struct SourceData {
this->filename = filename; this->filename = filename;
this->source = ss.str(); this->source = ss.str();
line_starts.push_back(source); line_starts.push_back(this->source.c_str());
this->mode = mode; this->mode = mode;
} }

View File

@ -280,10 +280,10 @@ struct NegatedExpr: Expr{
LiteralExpr* lit = static_cast<LiteralExpr*>(child.get()); LiteralExpr* lit = static_cast<LiteralExpr*>(child.get());
PyObject* obj = nullptr; PyObject* obj = nullptr;
if(std::holds_alternative<i64>(lit->value)){ if(std::holds_alternative<i64>(lit->value)){
obj = VAR(std::get<i64>(lit->value)); obj = VAR(-std::get<i64>(lit->value));
} }
if(std::holds_alternative<f64>(lit->value)){ if(std::holds_alternative<f64>(lit->value)){
obj = VAR(std::get<f64>(lit->value)); obj = VAR(-std::get<f64>(lit->value));
} }
if(obj != nullptr){ if(obj != nullptr){
ctx->emit(OP_LOAD_CONST, ctx->add_const(obj), line); ctx->emit(OP_LOAD_CONST, ctx->add_const(obj), line);