mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
some fix
This commit is contained in:
parent
36b73e1ce7
commit
707a880c2e
@ -363,7 +363,7 @@ struct BinaryExpr: Expr{
|
||||
Expr_ lhs;
|
||||
Expr_ rhs;
|
||||
bool is_compare() const override;
|
||||
void _emit_compare(CodeEmitContext* ctx, pod_vector<int>& jmps);
|
||||
void _emit_compare(CodeEmitContext*, small_vector_2<int, 6>&);
|
||||
void emit_(CodeEmitContext* ctx) override;
|
||||
};
|
||||
|
||||
|
@ -659,7 +659,7 @@ namespace pkpy{
|
||||
}
|
||||
}
|
||||
|
||||
void BinaryExpr::_emit_compare(CodeEmitContext* ctx, pod_vector<int>& jmps){
|
||||
void BinaryExpr::_emit_compare(CodeEmitContext* ctx, small_vector_2<int, 6>& jmps){
|
||||
if(lhs->is_compare()){
|
||||
static_cast<BinaryExpr*>(lhs.get())->_emit_compare(ctx, jmps);
|
||||
}else{
|
||||
@ -683,7 +683,7 @@ namespace pkpy{
|
||||
}
|
||||
|
||||
void BinaryExpr::emit_(CodeEmitContext* ctx) {
|
||||
pod_vector<int> jmps;
|
||||
small_vector_2<int, 6> jmps;
|
||||
if(is_compare() && lhs->is_compare()){
|
||||
// (a < b) < c
|
||||
static_cast<BinaryExpr*>(lhs.get())->_emit_compare(ctx, jmps);
|
||||
|
@ -715,7 +715,7 @@ Str VM::disassemble(CodeObject_ co){
|
||||
return s + std::string(n - s.length(), ' ');
|
||||
};
|
||||
|
||||
pod_vector<int> jumpTargets;
|
||||
std::vector<int> jumpTargets;
|
||||
for(auto byte : co->codes){
|
||||
if(byte.op == OP_JUMP_ABSOLUTE || byte.op == OP_POP_JUMP_IF_FALSE || byte.op == OP_SHORTCUT_IF_FALSE_OR_POP || byte.op == OP_LOOP_CONTINUE){
|
||||
jumpTargets.push_back(byte.arg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user