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 #include "vm/ThrowMsgKind.h"
9 #include "mozilla/Assertions.h" // MOZ_CRASH
11 #include "js/friend/ErrorMessages.h" // JSErrNum, JSMSG_*
13 JSErrNum
js::ThrowMsgKindToErrNum(ThrowMsgKind kind
) {
15 case ThrowMsgKind::AssignToCall
:
16 return JSMSG_ASSIGN_TO_CALL
;
17 case ThrowMsgKind::IteratorNoThrow
:
18 return JSMSG_ITERATOR_NO_THROW
;
19 case ThrowMsgKind::CantDeleteSuper
:
20 return JSMSG_CANT_DELETE_SUPER
;
21 case ThrowMsgKind::PrivateDoubleInit
:
22 return JSMSG_PRIVATE_FIELD_DOUBLE
;
23 case ThrowMsgKind::PrivateBrandDoubleInit
:
24 return JSMSG_PRIVATE_BRAND_DOUBLE
;
25 case ThrowMsgKind::MissingPrivateOnGet
:
26 return JSMSG_GET_MISSING_PRIVATE
;
27 case ThrowMsgKind::MissingPrivateOnSet
:
28 return JSMSG_SET_MISSING_PRIVATE
;
29 case ThrowMsgKind::AssignToPrivateMethod
:
30 return JSMSG_ASSIGN_TO_PRIVATE_METHOD
;
31 case ThrowMsgKind::DecoratorInvalidReturnType
:
32 return JSMSG_DECORATOR_INVALID_RETURN_TYPE
;
35 MOZ_CRASH("Unexpected message kind");