Bug 1535206 - Part 1: Remove BinASTTokenReaderMultipart::readMaybePropertyKey. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Thu, 14 Mar 2019 07:50:00 +0000
changeset 521856 f3946ac22581
parent 521855 da11c85f5bb2
child 521857 814b2ae9ef66
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1535206
milestone67.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 1535206 - Part 1: Remove BinASTTokenReaderMultipart::readMaybePropertyKey. r=Yoric Depends on D23440 Differential Revision: https://phabricator.services.mozilla.com/D23441
js/src/frontend/BinASTTokenReaderMultipart.cpp
js/src/frontend/BinASTTokenReaderMultipart.h
js/src/frontend/binast/src/main.rs
--- a/js/src/frontend/BinASTTokenReaderMultipart.cpp
+++ b/js/src/frontend/BinASTTokenReaderMultipart.cpp
@@ -295,20 +295,16 @@ JS::Result<JSAtom*> BinASTTokenReaderMul
 JS::Result<JSAtom*> BinASTTokenReaderMultipart::readIdentifierName() {
   BINJS_MOZ_TRY_DECL(result, readAtom());
   if (!IsIdentifier(result)) {
     return raiseError("Invalid identifier");
   }
   return result;
 }
 
-JS::Result<JSAtom*> BinASTTokenReaderMultipart::readMaybePropertyKey() {
-  return readMaybeAtom();
-}
-
 JS::Result<JSAtom*> BinASTTokenReaderMultipart::readPropertyKey() {
   return readAtom();
 }
 
 JS::Result<Ok> BinASTTokenReaderMultipart::readChars(Chars& out) {
   updateLatestKnownGood();
   BINJS_MOZ_TRY_DECL(index, readInternalUint32());
 
--- a/js/src/frontend/BinASTTokenReaderMultipart.h
+++ b/js/src/frontend/BinASTTokenReaderMultipart.h
@@ -102,17 +102,16 @@ class MOZ_STACK_CLASS BinASTTokenReaderM
    * Read a single IdentifierName value.
    */
   MOZ_MUST_USE JS::Result<JSAtom*> readMaybeIdentifierName();
   MOZ_MUST_USE JS::Result<JSAtom*> readIdentifierName();
 
   /**
    * Read a single PropertyKey value.
    */
-  MOZ_MUST_USE JS::Result<JSAtom*> readMaybePropertyKey();
   MOZ_MUST_USE JS::Result<JSAtom*> readPropertyKey();
 
   /**
    * Read a single `string | null` value.
    *
    * MAY check if that string is not valid UTF-8.
    */
   MOZ_MUST_USE JS::Result<Ok> readChars(Chars&);
--- a/js/src/frontend/binast/src/main.rs
+++ b/js/src/frontend/binast/src/main.rs
@@ -1623,29 +1623,17 @@ impl CPPExporter {
 {{
     return raiseError(\"FIXME: Not implemented yet in this preview release ({kind})\");
 }}
 
 ",
                                 first_line = first_line,
                                 kind = parser.name.to_str()));
                         } else {
-                            buffer.push_str(&format!("{first_line}
-{{
-    BINJS_MOZ_TRY_DECL(result, tokenizer_->readMaybePropertyKey());
-
-{build}
-
-    return result;
-}}
-
-",
-                                first_line = first_line,
-                                build = build_result,
-                            ));
+                            panic!("PropertyKey shouldn't be optional");
                         }
                     }
                     _else => unimplemented!("{:?}", _else)
                 }
             }
             NamedType::StringEnum(_) => {
                 unimplemented!()
             }
@@ -1783,18 +1771,17 @@ impl CPPExporter {
                     (Some(format!("RootedAtom {var_name}(cx_);", var_name = var_name)),
                         Some(format!("MOZ_TRY_VAR({var_name}, tokenizer_->readMaybeAtom());", var_name = var_name)))
                 }
                 Some(IsNullable { is_nullable: true, content: Primitive::IdentifierName }) => {
                     (Some(format!("RootedAtom {var_name}(cx_);", var_name = var_name)),
                         Some(format!("MOZ_TRY_VAR({var_name}, tokenizer_->readMaybeIdentifierName());", var_name = var_name)))
                 }
                 Some(IsNullable { is_nullable: true, content: Primitive::PropertyKey }) => {
-                    (Some(format!("RootedAtom {var_name}(cx_);", var_name = var_name)),
-                        Some(format!("MOZ_TRY_VAR({var_name}, tokenizer_->readMaybePropertyKey());", var_name = var_name)))
+                    panic!("PropertyKey shouldn't be optional");
                 }
                 _else => {
                     let typename = TypeName::type_(field.type_());
                     let name = self.syntax.get_node_name(typename.to_str())
                         .expect("NodeName for the field type should exist.");
                     let field_extra_args = rules_for_this_field.extra_args;
 
                     let (decl_var, call_kind) = if needs_block {