Bug 1418237 - Delete unused SyntaxParseHandler::singleBindingFromDeclaration(). r=arai
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 17 Nov 2017 06:59:32 -0800
changeset 436901 12d7e455b355cc68131aaf9f28f88bfd6226b828
parent 436900 ba0c1379889544cb0d33794a3eb892ef21df7d43
child 436902 1faa238d9faf94d3b763730351171b86c2e5bc9f
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersarai
bugs1418237
milestone59.0a1
Bug 1418237 - Delete unused SyntaxParseHandler::singleBindingFromDeclaration(). r=arai
js/src/frontend/SyntaxParseHandler.h
--- a/js/src/frontend/SyntaxParseHandler.h
+++ b/js/src/frontend/SyntaxParseHandler.h
@@ -374,35 +374,18 @@ class SyntaxParseHandler
         MOZ_ASSERT(kind == PNK_LET || kind == PNK_CONST);
         return NodeLexicalDeclaration;
     }
 
     bool isDeclarationList(Node node) {
         return node == NodeVarDeclaration || node == NodeLexicalDeclaration;
     }
 
-    Node singleBindingFromDeclaration(Node decl) {
-        MOZ_ASSERT(isDeclarationList(decl));
-
-        // This is, unfortunately, very dodgy.  Obviously NodeVarDeclaration
-        // and NodeLexicalDeclaration can store no info on the arbitrary
-        // number of bindings it could contain.
-        //
-        // But this method is called only for cloning for-in/of declarations
-        // as initialization targets.  That context simplifies matters.  If the
-        // binding is a single name, it'll always syntax-parse (or it would
-        // already have been rejected as assigning/binding a forbidden name).
-        // Otherwise the binding is a destructuring pattern.  But syntax
-        // parsing would *already* have aborted when it saw a destructuring
-        // pattern.  So we can just say any old thing here, because the only
-        // time we'll be wrong is a case that syntax parsing has already
-        // rejected.  Use NodeName so the SyntaxParseHandler
-        // Parser::cloneLeftHandSide can assert it sees only this.
-        return NodeName;
-    }
+    // This method should only be called from parsers using FullParseHandler.
+    Node singleBindingFromDeclaration(Node decl) = delete;
 
     Node newCatchList(const TokenPos& pos) {
         return NodeGeneric;
     }
 
     Node newCommaExpressionList(Node kid) {
         return NodeGeneric;
     }