1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  * vim: set ts=8 sts=2 et sw=2 tw=80:
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_ErrorObject_inl_h
8 #define vm_ErrorObject_inl_h
9 
10 #include "vm/ErrorObject.h"
11 
12 #include "vm/JSContext.h"
13 
fileName(JSContext * cx)14 inline JSString* js::ErrorObject::fileName(JSContext* cx) const {
15   const HeapSlot& slot = getReservedSlotRef(FILENAME_SLOT);
16   return slot.isString() ? slot.toString() : cx->names().empty;
17 }
18 
sourceId()19 inline uint32_t js::ErrorObject::sourceId() const {
20   const HeapSlot& slot = getReservedSlotRef(SOURCEID_SLOT);
21   return slot.isInt32() ? slot.toInt32() : 0;
22 }
23 
lineNumber()24 inline uint32_t js::ErrorObject::lineNumber() const {
25   const HeapSlot& slot = getReservedSlotRef(LINENUMBER_SLOT);
26   return slot.isInt32() ? slot.toInt32() : 0;
27 }
28 
columnNumber()29 inline uint32_t js::ErrorObject::columnNumber() const {
30   const HeapSlot& slot = getReservedSlotRef(COLUMNNUMBER_SLOT);
31   return slot.isInt32() ? slot.toInt32() : 0;
32 }
33 
stack()34 inline JSObject* js::ErrorObject::stack() const {
35   return getReservedSlotRef(STACK_SLOT).toObjectOrNull();
36 }
37 
38 #endif /* vm_ErrorObject_inl_h */
39