Bug 1310045 - When a non-property-name token is observed instead of a property name in an object/class literal or destructuring pattern, indicate the unexpected token the way most unexpected tokens are indicated using JSMSG_UNEXPECTED_TOKEN. r=jwalden
authorKausam <kausam2015@gmail.com>
Sun, 06 Nov 2016 15:52:46 +0530
changeset 322538 2b7949845f17006984f522d86d882ac773b959b8
parent 322537 862b57ae9f3839a253bec11bab867415ccd9b5a0
child 322539 560587c09cb384c1da8ce6d64b9b8f1fc54ef901
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersjwalden
bugs1310045
milestone52.0a1
Bug 1310045 - When a non-property-name token is observed instead of a property name in an object/class literal or destructuring pattern, indicate the unexpected token the way most unexpected tokens are indicated using JSMSG_UNEXPECTED_TOKEN. r=jwalden
js/src/frontend/Parser.cpp
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -9047,17 +9047,18 @@ Parser<ParseHandler>::propertyName(Yield
         }
         propName = stringLiteral();
         if (!propName)
             return null();
         break;
       }
 
       default:
-        report(ParseError, false, null(), JSMSG_BAD_PROP_ID);
+        report(ParseError, false, null(), JSMSG_UNEXPECTED_TOKEN,
+               "property name", TokenKindToDesc(ltok));
         return null();
     }
 
     TokenKind tt;
     if (!tokenStream.getToken(&tt))
         return null();
 
     if (tt == TOK_COLON) {