LCOV - code coverage report
Current view: top level - js/src/vm - BooleanObject.h (source / functions) Hit Total Coverage
Test: output.info Lines: 5 5 100.0 %
Date: 2017-07-14 16:53:18 Functions: 2 2 100.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 vm_BooleanObject_h
       8             : #define vm_BooleanObject_h
       9             : 
      10             : #include "jsbool.h"
      11             : 
      12             : #include "vm/NativeObject.h"
      13             : 
      14             : namespace js {
      15             : 
      16             : class BooleanObject : public NativeObject
      17             : {
      18             :     /* Stores this Boolean object's [[PrimitiveValue]]. */
      19             :     static const unsigned PRIMITIVE_VALUE_SLOT = 0;
      20             : 
      21             :   public:
      22             :     static const unsigned RESERVED_SLOTS = 1;
      23             : 
      24             :     static const Class class_;
      25             : 
      26             :     /*
      27             :      * Creates a new Boolean object boxing the given primitive bool.
      28             :      * If proto is nullptr, the [[Prototype]] will default to Boolean.prototype.
      29             :      */
      30             :     static inline BooleanObject* create(JSContext* cx, bool b,
      31             :                                         HandleObject proto = nullptr);
      32             : 
      33           1 :     bool unbox() const {
      34           1 :         return getFixedSlot(PRIMITIVE_VALUE_SLOT).toBoolean();
      35             :     }
      36             : 
      37             :   private:
      38           1 :     inline void setPrimitiveValue(bool b) {
      39           1 :         setFixedSlot(PRIMITIVE_VALUE_SLOT, BooleanValue(b));
      40           1 :     }
      41             : 
      42             :     /* For access to init, as Boolean.prototype is special. */
      43             :     friend JSObject*
      44             :     js::InitBooleanClass(JSContext* cx, js::HandleObject global);
      45             : };
      46             : 
      47             : } // namespace js
      48             : 
      49             : #endif /* vm_BooleanObject_h */

Generated by: LCOV version 1.13