Bug 1185106 - Part 5.4: Support await expression in Reflect.parse. r=efaust,till
authorMariusz Kierski <mkierski@mozilla.com>
Sun, 28 Aug 2016 23:57:33 +0900
changeset 320228 7dd9e2d62584ccfa708d322c55980015cea6df76
parent 320227 2465f743fb4f2b36e0a92a44a02f93472a1ad63e
child 320229 a467817a09def09b9b9ed5fd88f905122af0d2ff
push id20754
push usercbook@mozilla.com
push dateMon, 31 Oct 2016 15:58:35 +0000
treeherderfx-team@b1b66b1780c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersefaust, till
bugs1185106
milestone52.0a1
Bug 1185106 - Part 5.4: Support await expression in Reflect.parse. r=efaust,till MozReview-Commit-ID: 7J8CeaYhP1X
js/src/builtin/ReflectParse.cpp
--- a/js/src/builtin/ReflectParse.cpp
+++ b/js/src/builtin/ReflectParse.cpp
@@ -88,16 +88,17 @@ enum UnaryOperator {
 
     UNOP_DELETE = 0,
     UNOP_NEG,
     UNOP_POS,
     UNOP_NOT,
     UNOP_BITNOT,
     UNOP_TYPEOF,
     UNOP_VOID,
+    UNOP_AWAIT,
 
     UNOP_LIMIT
 };
 
 enum VarDeclKind {
     VARDECL_ERR = -1,
     VARDECL_VAR = 0,
     VARDECL_CONST,
@@ -157,17 +158,18 @@ static const char* const binopNames[] = 
 
 static const char* const unopNames[] = {
     "delete",  /* UNOP_DELETE */
     "-",       /* UNOP_NEG */
     "+",       /* UNOP_POS */
     "!",       /* UNOP_NOT */
     "~",       /* UNOP_BITNOT */
     "typeof",  /* UNOP_TYPEOF */
-    "void"     /* UNOP_VOID */
+    "void",    /* UNOP_VOID */
+    "await"    /* UNOP_AWAIT */
 };
 
 static const char* const nodeTypeNames[] = {
 #define ASTDEF(ast, str, method) str,
 #include "jsast.tbl"
 #undef ASTDEF
     nullptr
 };
@@ -1878,16 +1880,19 @@ UnaryOperator
 ASTSerializer::unop(ParseNodeKind kind, JSOp op)
 {
     if (IsDeleteKind(kind))
         return UNOP_DELETE;
 
     if (IsTypeofKind(kind))
         return UNOP_TYPEOF;
 
+    if (kind == PNK_AWAIT)
+        return UNOP_AWAIT;
+
     switch (op) {
       case JSOP_NEG:
         return UNOP_NEG;
       case JSOP_POS:
         return UNOP_POS;
       case JSOP_NOT:
         return UNOP_NOT;
       case JSOP_BITNOT:
@@ -2905,28 +2910,29 @@ ASTSerializer::expression(ParseNode* pn,
       case PNK_BITOR:
       case PNK_BITXOR:
       case PNK_BITAND:
       case PNK_IN:
       case PNK_INSTANCEOF:
         return leftAssociate(pn, dst);
 
       case PNK_POW:
-	return rightAssociate(pn, dst);
+        return rightAssociate(pn, dst);
 
       case PNK_DELETENAME:
       case PNK_DELETEPROP:
       case PNK_DELETEELEM:
       case PNK_DELETEEXPR:
       case PNK_TYPEOFNAME:
       case PNK_TYPEOFEXPR:
       case PNK_VOID:
       case PNK_NOT:
       case PNK_BITNOT:
       case PNK_POS:
+      case PNK_AWAIT:
       case PNK_NEG: {
         MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos));
 
         UnaryOperator op = unop(pn->getKind(), pn->getOp());
         LOCAL_ASSERT(op > UNOP_ERR && op < UNOP_LIMIT);
 
         RootedValue expr(cx);
         return expression(pn->pn_kid, &expr) &&