|
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_ErrorObject_inl_h |
|
8 #define vm_ErrorObject_inl_h |
|
9 |
|
10 #include "vm/ErrorObject.h" |
|
11 |
|
12 #include "jscntxt.h" |
|
13 |
|
14 inline JSString * |
|
15 js::ErrorObject::fileName(JSContext *cx) const |
|
16 { |
|
17 const HeapSlot &slot = getReservedSlotRef(FILENAME_SLOT); |
|
18 return slot.isString() ? slot.toString() : cx->names().empty; |
|
19 } |
|
20 |
|
21 inline uint32_t |
|
22 js::ErrorObject::lineNumber() const |
|
23 { |
|
24 const HeapSlot &slot = getReservedSlotRef(LINENUMBER_SLOT); |
|
25 return slot.isInt32() ? slot.toInt32() : 0; |
|
26 } |
|
27 |
|
28 inline uint32_t |
|
29 js::ErrorObject::columnNumber() const |
|
30 { |
|
31 const HeapSlot &slot = getReservedSlotRef(COLUMNNUMBER_SLOT); |
|
32 return slot.isInt32() ? slot.toInt32() : 0; |
|
33 } |
|
34 |
|
35 inline JSString * |
|
36 js::ErrorObject::stack(JSContext *cx) const |
|
37 { |
|
38 const HeapSlot &slot = getReservedSlotRef(STACK_SLOT); |
|
39 if (slot.isString()) |
|
40 return slot.toString(); |
|
41 return cx->names().empty; |
|
42 } |
|
43 |
|
44 #endif /* vm_ErrorObject_inl_h */ |