blueloveTH 2 years ago
parent
commit
ef99bf9205
4 changed files with 14 additions and 7 deletions
  1. 2 2
      src/compiler.h
  2. 1 1
      src/iter.h
  3. 7 4
      src/linalg.h
  4. 4 0
      src/vm.h

+ 2 - 2
src/compiler.h

@@ -925,8 +925,8 @@ __SUBSCR_END:
             StrName name = prev().str();
 
             // check duplicate argument name
-            for(int i: decl->args){
-                if(decl->code->varnames[i] == name) {
+            for(int j: decl->args){
+                if(decl->code->varnames[j] == name) {
                     SyntaxError("duplicate argument name");
                 }
             }

+ 1 - 1
src/iter.h

@@ -101,7 +101,7 @@ struct Generator{
         if(ret == PY_OP_YIELD){
             // backup the context
             frame = std::move(vm->callstack.top());
-            PyObject* ret = frame._s->popx();
+            ret = frame._s->popx();
             for(PyObject* obj: frame.stack_view()) s_backup.push_back(obj);
             vm->_pop_frame();
             state = 1;

+ 7 - 4
src/linalg.h

@@ -260,12 +260,12 @@ struct Mat3x3{
         );
     }
 
-    Vec2 transform_point(Vec2 v) const {
-        return Vec2(_11 * v.x + _12 * v.y + _13, _21 * v.x + _22 * v.y + _23);
+    Vec2 transform_point(Vec2 vec) const {
+        return Vec2(_11 * vec.x + _12 * vec.y + _13, _21 * vec.x + _22 * vec.y + _23);
     }
 
-    Vec2 transform_vector(Vec2 v) const {
-        return Vec2(_11 * v.x + _12 * v.y, _21 * v.x + _22 * v.y);
+    Vec2 transform_vector(Vec2 vec) const {
+        return Vec2(_11 * vec.x + _12 * vec.y, _21 * vec.x + _22 * vec.y);
     }
 };
 
@@ -617,14 +617,17 @@ struct PyMat3x3: Mat3x3{
         });
 
         vm->bind_func<0>(type, "zeros", [](VM* vm, ArgsView args){
+            PK_UNUSED(args);
             return VAR_T(PyMat3x3, Mat3x3::zeros());
         });
 
         vm->bind_func<0>(type, "ones", [](VM* vm, ArgsView args){
+            PK_UNUSED(args);
             return VAR_T(PyMat3x3, Mat3x3::ones());
         });
 
         vm->bind_func<0>(type, "identity", [](VM* vm, ArgsView args){
+            PK_UNUSED(args);
             return VAR_T(PyMat3x3, Mat3x3::identity());
         });
 

+ 4 - 0
src/vm.h

@@ -487,6 +487,7 @@ public:
     template<typename T, typename __T>
     PyObject* bind_notimplemented_constructor(__T&& type) {
         return bind_constructor<-1>(std::forward<__T>(type), [](VM* vm, ArgsView args){
+            PK_UNUSED(args);
             vm->NotImplementedError();
             return vm->None;
         });
@@ -739,6 +740,7 @@ template<> inline float py_cast<float>(VM* vm, PyObject* obj){
     return BitsCvt(bits)._float;
 }
 template<> inline float _py_cast<float>(VM* vm, PyObject* obj){
+    PK_UNUSED(vm);
     i64 bits = PK_BITS(obj) & Number::c1;
     return BitsCvt(bits)._float;
 }
@@ -748,6 +750,7 @@ template<> inline double py_cast<double>(VM* vm, PyObject* obj){
     return BitsCvt(bits)._float;
 }
 template<> inline double _py_cast<double>(VM* vm, PyObject* obj){
+    PK_UNUSED(vm);
     i64 bits = PK_BITS(obj) & Number::c1;
     return BitsCvt(bits)._float;
 }
@@ -777,6 +780,7 @@ PY_VAR_INT(unsigned long long)
 
 #define PY_VAR_FLOAT(T)                             \
     inline PyObject* py_var(VM* vm, T _val){        \
+        PK_UNUSED(vm);                              \
         BitsCvt val(static_cast<f64>(_val));        \
         i64 bits = val._int & Number::c1;           \
         i64 tail = val._int & Number::c2;           \