Bug 1842773 - Part 32: Allow constructing growable SharedArrayBuffers. r=sfink
[gecko.git] / js / src / vm / ErrorObject-inl.h
blob438e8c845138e503e52c55e1145857a2060a27ea
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/. */
7 #ifndef vm_ErrorObject_inl_h
8 #define vm_ErrorObject_inl_h
10 #include "vm/ErrorObject.h"
12 #include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
14 #include "vm/JSAtomState.h"
15 #include "vm/JSContext.h"
17 inline JSString* js::ErrorObject::fileName(JSContext* cx) const {
18 Value val = getReservedSlot(FILENAME_SLOT);
19 return val.isString() ? val.toString() : cx->names().empty_;
22 inline uint32_t js::ErrorObject::sourceId() const {
23 Value val = getReservedSlot(SOURCEID_SLOT);
24 return val.isInt32() ? val.toInt32() : 0;
27 inline uint32_t js::ErrorObject::lineNumber() const {
28 Value val = getReservedSlot(LINENUMBER_SLOT);
29 return val.isInt32() ? val.toInt32() : 0;
32 inline JS::ColumnNumberOneOrigin js::ErrorObject::columnNumber() const {
33 Value val = getReservedSlot(COLUMNNUMBER_SLOT);
34 // If Error object's `columnNumber` property is modified from JS code,
35 // COLUMNNUMBER_SLOT slot can contain non-int32 value.
36 // Use column number 1 as fallback value for such case.
37 return val.isInt32() ? JS::ColumnNumberOneOrigin(val.toInt32())
38 : JS::ColumnNumberOneOrigin();
41 inline JSObject* js::ErrorObject::stack() const {
42 return getReservedSlot(STACK_SLOT).toObjectOrNull();
45 #endif /* vm_ErrorObject_inl_h */