blueloveTH 2 năm trước cách đây
mục cha
commit
e464c638ad
2 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 8 0
      src/expr.h
  2. 1 0
      src/pocketpy.h

+ 8 - 0
src/expr.h

@@ -745,6 +745,14 @@ struct GroupedExpr: Expr{
     void emit(CodeEmitContext* ctx) override{
         a->emit(ctx);
     }
+
+    bool emit_del(CodeEmitContext* ctx) override {
+        return a->emit_del(ctx);
+    }
+
+    bool emit_store(CodeEmitContext* ctx) override {
+        return a->emit_store(ctx);
+    }
 };
 
 struct BinaryExpr: Expr{

+ 1 - 0
src/pocketpy.h

@@ -325,6 +325,7 @@ inline void init_builtins(VM* _vm) {
 
     /************ int ************/
     _vm->bind_constructor<-1>("int", [](VM* vm, ArgsView args) {
+        if(args.size() == 1+0) return VAR(0);
         if(args.size() == 1+1){
             if (is_type(args[1], vm->tp_float)) return VAR((i64)CAST(f64, args[1]));
             if (is_type(args[1], vm->tp_int)) return args[1];