Bug 785094: Fix negative colspans showing up in the wrong places. r=jorendorff
authorAlex Crichton <acrichton@mozilla.com>
Thu, 23 Aug 2012 10:13:52 -0700
changeset 105244 43b106855cbb1941bd5ec5aa1ed0826412251601
parent 105243 946c68705ac909f50b93408a3259e5d96225eef6
child 105245 042463c88673b17f7459900cbaee5972987ce41c
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersjorendorff
bugs785094
milestone17.0a1
Bug 785094: Fix negative colspans showing up in the wrong places. r=jorendorff
js/src/frontend/BytecodeEmitter.cpp
js/src/jit-test/tests/basic/bug785094.js
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -4799,16 +4799,17 @@ EmitNormalFor(JSContext *cx, BytecodeEmi
             return false;
 
         /* Restore the absolute line number for source note readers. */
         ptrdiff_t lineno = pn->pn_pos.end.lineno;
         if (bce->currentLine() != (unsigned) lineno) {
             if (NewSrcNote2(cx, bce, SRC_SETLINE, lineno) < 0)
                 return false;
             bce->current->currentLine = (unsigned) lineno;
+            bce->current->lastColumn = 0;
         }
     }
 
     ptrdiff_t tmp3 = bce->offset();
 
     if (forHead->pn_kid2) {
         /* Fix up the goto from top to target the loop condition. */
         JS_ASSERT(jmp >= 0);
@@ -5257,16 +5258,17 @@ EmitStatement(JSContext *cx, BytecodeEmi
             if (!EmitTree(cx, bce, pn2))
                 return false;
             if (Emit1(cx, bce, op) < 0)
                 return false;
         }
     } else if (!pn->isDirectivePrologueMember()) {
         /* Don't complain about directive prologue members; just don't emit their code. */
         bce->current->currentLine = pn2->pn_pos.begin.lineno;
+        bce->current->lastColumn = 0;
         if (!bce->reportStrictWarning(pn2, JSMSG_USELESS_EXPR))
             return false;
     }
 
     return true;
 }
 
 static bool
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug785094.js
@@ -0,0 +1,2 @@
+// |jit-test| dump-bytecode
+Function("for(let b; true; x) \nfalse");