LCOV - code coverage report
Current view: top level - js/src/builtin - SymbolObject.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * vim: set ts=8 sts=4 et sw=4 tw=99:
       3             :  * This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef builtin_SymbolObject_h
       8             : #define builtin_SymbolObject_h
       9             : 
      10             : #include "vm/NativeObject.h"
      11             : #include "vm/Symbol.h"
      12             : 
      13             : namespace js {
      14             : 
      15             : class SymbolObject : public NativeObject
      16             : {
      17             :     /* Stores this Symbol object's [[PrimitiveValue]]. */
      18             :     static const unsigned PRIMITIVE_VALUE_SLOT = 0;
      19             : 
      20             :   public:
      21             :     static const unsigned RESERVED_SLOTS = 1;
      22             : 
      23             :     static const Class class_;
      24             : 
      25             :     static JSObject* initClass(JSContext* cx, js::HandleObject obj, bool defineMembers);
      26             : 
      27             :     /*
      28             :      * Creates a new Symbol object boxing the given primitive Symbol.  The
      29             :      * object's [[Prototype]] is determined from context.
      30             :      */
      31             :     static SymbolObject* create(JSContext* cx, JS::HandleSymbol symbol);
      32             : 
      33           0 :     JS::Symbol* unbox() const {
      34           0 :         return getFixedSlot(PRIMITIVE_VALUE_SLOT).toSymbol();
      35             :     }
      36             : 
      37             :   private:
      38           0 :     inline void setPrimitiveValue(JS::Symbol* symbol) {
      39           0 :         setFixedSlot(PRIMITIVE_VALUE_SLOT, SymbolValue(symbol));
      40           0 :     }
      41             : 
      42             :     static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
      43             : 
      44             :     // Static methods.
      45             :     static MOZ_MUST_USE bool for_(JSContext* cx, unsigned argc, Value* vp);
      46             :     static MOZ_MUST_USE bool keyFor(JSContext* cx, unsigned argc, Value* vp);
      47             : 
      48             :     // Methods defined on Symbol.prototype.
      49             :     static MOZ_MUST_USE bool toString_impl(JSContext* cx, const CallArgs& args);
      50             :     static MOZ_MUST_USE bool toString(JSContext* cx, unsigned argc, Value* vp);
      51             :     static MOZ_MUST_USE bool valueOf_impl(JSContext* cx, const CallArgs& args);
      52             :     static MOZ_MUST_USE bool valueOf(JSContext* cx, unsigned argc, Value* vp);
      53             :     static MOZ_MUST_USE bool toPrimitive(JSContext* cx, unsigned argc, Value* vp);
      54             : 
      55             :     static const JSPropertySpec properties[];
      56             :     static const JSFunctionSpec methods[];
      57             :     static const JSFunctionSpec staticMethods[];
      58             : };
      59             : 
      60             : extern JSObject*
      61             : InitSymbolClass(JSContext* cx, HandleObject obj);
      62             : 
      63             : extern JSObject*
      64             : InitBareSymbolCtor(JSContext* cx, HandleObject obj);
      65             : 
      66             : } /* namespace js */
      67             : 
      68             : #endif /* builtin_SymbolObject_h */

Generated by: LCOV version 1.13