--- a/js/src/frontend/BinSource.cpp
+++ b/js/src/frontend/BinSource.cpp
@@ -79,18 +79,18 @@ const std::string BINJS_DIRECT_EVAL = "B
class ASTReader: private JS::AutoGCRooter
{
public:
ASTReader(JSContext* cx_, LifoAlloc& alloc_, const ReadOnlyCompileOptions& options)
: AutoGCRooter(cx_, BINPARSER)
, traceListHead(nullptr)
, allocator(cx_, alloc_)
+ , options_(options)
, cx(cx_)
- , options_(options)
, alloc(alloc_)
{ }
static bool test() {
// FIXME: Just a small hack to force the build system to
// display undefined symbols.
ASTReader foo(nullptr, *static_cast<LifoAlloc*>(nullptr), *static_cast<ReadOnlyCompileOptions*>(nullptr));
UniquePtr<ParseNode> out;
@@ -1980,16 +1980,44 @@ ASTReader::parseExpression(SimpleTokenRe
default:
return this->raiseError();
}
return false;
}
bool
+ASTReader::parseExpressionStatementAux(SimpleTokenReader* reader, const BinKind kind, const SimpleTokenReader::BinFields& fields, UniquePtr<ParseNode>& out) {
+ MOZ_ASSERT(kind == BinKind::expression_statement);
+ if (out) {
+ return this->raiseError();
+ }
+
+ UniquePtr<ParseNode> result;
+ for (auto field: fields) {
+ switch (field) {
+ case BinField::expression:
+ if (!this->parseExpression(reader, result)) {
+ return false;
+ }
+ break;
+ default:
+ return this->raiseError();
+ }
+ }
+
+ if (!result) {
+ return this->raiseError();
+ }
+
+ out = Move(result);
+ return false;
+}
+
+bool
ASTReader::readNumber(SimpleTokenReader* reader, Maybe<double>& out) {
if (out) {
return this->raiseError();
}
return reader->readMaybeF64(&out);
}