WIP: Implemented options draft
authorDavid Teller <dteller@mozilla.com>
Fri, 04 Aug 2017 16:34:02 +0200
changeset 641370 8fcc2d55b89d34735502061e596aa0c96ab053d0
parent 641369 8cf4eef69713d8e669b79130e5b5495eaf0b494f
child 641371 633a3245abdb39beed9d2b8d9959856c880c90c2
push id72504
push userdteller@mozilla.com
push dateSun, 06 Aug 2017 22:28:40 +0000
milestone57.0a1
WIP: Implemented options MozReview-Commit-ID: 7QKBhI1jxW5
js/src/frontend/BinSource.cpp
--- 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 {