Bug 1497036 - Throw error if function declaration is found without corresponding AssertedDeclaredName. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Mon, 15 Oct 2018 23:51:50 +0900
changeset 499790 cd6a56ce613caf1e103b4d51503de6bce2cdee26
parent 499789 3293a3393b4a68e942b7f8fd5f2dd77b337b8676
child 499791 b247b5dd6a8ae77da265c032bc75b413f9bc3ffc
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1497036
milestone64.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 1497036 - Throw error if function declaration is found without corresponding AssertedDeclaredName. r=Yoric
js/src/frontend/BinSource.cpp
--- a/js/src/frontend/BinSource.cpp
+++ b/js/src/frontend/BinSource.cpp
@@ -236,17 +236,20 @@ BinASTParser<Tok>::buildFunctionBox(Gene
 
     RootedAtom atom(cx_);
     if (name) {
         atom = name->name();
     }
 
     if (parseContext_ && syntax == FunctionSyntaxKind::Statement) {
         auto ptr = parseContext_->varScope().lookupDeclaredName(atom);
-        MOZ_ASSERT(ptr);
+        if (!ptr) {
+            return raiseError("FunctionDeclaration without corresponding AssertedDeclaredName.");
+        }
+
         // FIXME: Should be merged with ParseContext::tryDeclareVarHelper
         //        (bug 1499044).
         DeclarationKind declaredKind = ptr->value()->kind();
         if (DeclarationKindIsVar(declaredKind)) {
             MOZ_ASSERT(declaredKind != DeclarationKind::VarForAnnexBLexicalFunction);
             ptr->value()->alterKind(DeclarationKind::BodyLevelFunction);
         }
     }