--- a/js/src/frontend/BinSource.cpp
+++ b/js/src/frontend/BinSource.cpp
@@ -2390,16 +2390,58 @@ ASTReader::parsePatternList(SimpleTokenR
result->append(pattern.release());
}
out = Move(result);
return true;
}
bool
+ASTReader::parsePatternAux(SimpleTokenReader* reader, const BinKind kind, const SimpleTokenReader::BinFields& fields, UniquePtr<ParseNode>& out) {
+ if (out) {
+ return this->raiseError();
+ }
+
+ switch (kind) {
+ case BinKind::identifier: {
+ RootedAtom id(cx);
+ for (auto field: fields) {
+ switch (field) {
+ case BinField::name:
+ if (!this->readString(reader, &id)) {
+ return false;
+ }
+ break;
+ default:
+ return this->raiseError();
+ }
+ }
+
+ if (!id) {
+ return this->raiseError();
+ }
+
+ UniquePtr<ParseNode> result(new_<NameNode>(PNK_NAME, JSOP_GETNAME, id, TokenPos()));
+ if (!result) {
+ return false;
+ }
+
+ out = Move(result);
+ return true;
+ break;
+ }
+ default:
+ // For the moment, we only support identifiers.
+ return this->raiseError();
+ }
+
+ return true;
+}
+
+bool
ASTReader::readString(SimpleTokenReader* reader, MutableHandle<PropertyName*> out) {
if (out) {
return this->raiseError();
}
RootedAtom atom(cx);
if (!this->readString(reader, &atom)) {