--- a/js/src/frontend/BinSource.cpp
+++ b/js/src/frontend/BinSource.cpp
@@ -75,28 +75,29 @@ const std::string BINJS_VAR_NAME = "BINJ
const std::string BINJS_LET_NAME = "BINJS:LetDeclaredNames";
const std::string BINJS_CONST_NAME = "BINJS:ConstDeclaredNames";
const std::string BINJS_CAPTURED_NAME = "BINJS:CapturedNames";
const std::string BINJS_DIRECT_EVAL = "BINJS:HasDirectEval";
class ASTReader: private JS::AutoGCRooter
{
public:
- ASTReader(JSContext* cx_, LifoAlloc& alloc_)
+ ASTReader(JSContext* cx_, LifoAlloc& alloc_, const ReadOnlyCompileOptions& options)
: AutoGCRooter(cx_, BINPARSER)
, traceListHead(nullptr)
, allocator(cx_, alloc_)
, cx(cx_)
, alloc(alloc_)
+ , options_(options)
{ }
static bool test() {
// FIXME: Just a small hack to force the build system to
// display undefined symbols.
- ASTReader foo(nullptr, *static_cast<LifoAlloc*>(nullptr));
+ ASTReader foo(nullptr, *static_cast<LifoAlloc*>(nullptr), *static_cast<ReadOnlyCompileOptions*>(nullptr));
UniquePtr<ParseNode> out;
return foo.parse(nullptr, nullptr, nullptr, out);
}
bool parse(char* start, char* stop, GlobalSharedContext* sc, UniquePtr<ParseNode>& out);
private:
bool raiseError();
@@ -148,17 +149,19 @@ private:
bool readString(SimpleTokenReader* reader, MutableHandleString);
bool readString(SimpleTokenReader* reader, MutableHandleAtom);
bool readString(SimpleTokenReader* reader, MutableHandle<PropertyName*>);
bool readBool(SimpleTokenReader* reader, Maybe<bool>&);
bool readNumber(SimpleTokenReader* reader, Maybe<double>&);
const Directives& currentDirectives() const;
ThisBinding thisBinding() const;
- const ReadOnlyCompileOptions& options() const;
+ const ReadOnlyCompileOptions& options() const {
+ return this->options_;
+ }
// Names
// --- GC.
/* List of objects allocated during parsing, for GC tracing. */
@@ -207,16 +210,17 @@ private:
return nullptr;
mozilla::PodAssign(node, &other);
return node;
}
JS_DECLARE_NEW_METHODS(new_, allocParseNode, inline)
private:
+ const ReadOnlyCompileOptions& options_;
JSContext* cx;
LifoAlloc& alloc;
// Needs access to AutoGCRooter.
friend void TraceBinParser(JSTracer* trc, AutoGCRooter* parser);
};
class BinParseContext: public ParseContext {