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 #include "vm/ThrowMsgKind.h" 8 9 #include "mozilla/Assertions.h" // MOZ_CRASH 10 11 #include "js/friend/ErrorMessages.h" // JSErrNum, JSMSG_* 12 ThrowMsgKindToErrNum(ThrowMsgKind kind)13JSErrNum js::ThrowMsgKindToErrNum(ThrowMsgKind kind) { 14 switch (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::MissingPrivateOnGet: 24 return JSMSG_GET_MISSING_PRIVATE; 25 case ThrowMsgKind::MissingPrivateOnSet: 26 return JSMSG_SET_MISSING_PRIVATE; 27 case ThrowMsgKind::AssignToPrivateMethod: 28 return JSMSG_ASSIGN_TO_PRIVATE_METHOD; 29 } 30 31 MOZ_CRASH("Unexpected message kind"); 32 } 33