Bug 1296814 - Specify an explicit offset when reporting an error for a for-of loop whose target is an expression that begins with 'let'. r=arai
authorJeff Walden <jwalden@mit.edu>
Sun, 13 Nov 2016 20:51:23 -0800
changeset 322460 5f6b4c2d10f50bf346783998ddfe6e3e34897503
parent 322459 0ff9398b03d6dc35ad991a004de184ba5b1afe4c
child 322461 039eb9887533e5a33d33f4a655ff988c2f38e348
push id83879
push userjwalden@mit.edu
push dateMon, 14 Nov 2016 23:46:46 +0000
treeherdermozilla-inbound@5f6b4c2d10f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1296814
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1296814 - Specify an explicit offset when reporting an error for a for-of loop whose target is an expression that begins with 'let'. r=arai
js/src/frontend/Parser.cpp
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -5469,17 +5469,17 @@ Parser<ParseHandler>::forHeadStart(Yield
     // here.
     //
     //   var let = {};
     //   for (let.prop of [1]) // BAD
     //     break;
     //
     // See ES6 13.7.
     if (isForOf && letIsIdentifier) {
-        reportWithNode(ParseError, false, *forInitialPart, JSMSG_LET_STARTING_FOROF_LHS);
+        errorAt(exprOffset, JSMSG_LET_STARTING_FOROF_LHS);
         return false;
     }
 
     *forHeadKind = isForIn ? PNK_FORIN : PNK_FOROF;
 
     // Verify the left-hand side expression doesn't have a forbidden form.
     if (handler.isUnparenthesizedDestructuringPattern(*forInitialPart)) {
         if (!checkDestructuringPattern(*forInitialPart, Nothing(), &possibleError))