Browse Source

Update compiler.h

blueloveTH 3 years ago
parent
commit
532f915860
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/compiler.h

+ 6 - 6
src/compiler.h

@@ -436,13 +436,13 @@ public:
         if (l_value && matchAssignment()) {
         if (l_value && matchAssignment()) {
             _TokenType assignment = parser->previous.type;
             _TokenType assignment = parser->previous.type;
             matchNewLines();
             matchNewLines();
-            if (assignment != TK("=")) { // name += / -= / *= ... = (expr);
+            if (assignment == TK("=")) {
+                compileExpressionTuple();
+            } else { // name += / -= / *= ... = (expr);
                 emitCode(OP_DUP_TOP);
                 emitCode(OP_DUP_TOP);
                 emitCode(OP_LOAD_ATTR, index);
                 emitCode(OP_LOAD_ATTR, index);
                 compileExpression();
                 compileExpression();
                 emitAssignOp(assignment);
                 emitAssignOp(assignment);
-            } else {
-                compileExpressionTuple();
             }
             }
             emitCode(OP_STORE_ATTR, index);
             emitCode(OP_STORE_ATTR, index);
         } else {
         } else {
@@ -485,10 +485,10 @@ public:
             _TokenType assignment = parser->previous.type;
             _TokenType assignment = parser->previous.type;
             matchNewLines();
             matchNewLines();
 
 
-            if (assignment != TK("=")) {
-                UNREACHABLE();
-            } else {
+            if (assignment == TK("=")) {
                 compileExpressionTuple();
                 compileExpressionTuple();
+            } else {
+                UNREACHABLE();
             }
             }
             emitCode(OP_STORE_SUBSCR);
             emitCode(OP_STORE_SUBSCR);
         } else {
         } else {