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 #include "frontend/BinToken.h"
8 
9 #include <sys/types.h>
10 
11 namespace js {
12 namespace frontend {
13 
14 const char* BINKIND_DESCRIPTIONS[] = {
15 #define WITH_KIND(_, SPEC_NAME) #SPEC_NAME,
16     FOR_EACH_BIN_KIND(WITH_KIND)
17 #undef WITH_KIND
18 };
19 
20 const char* BINFIELD_DESCRIPTIONS[] = {
21 #define WITH_FIELD(_, SPEC_NAME) #SPEC_NAME,
22     FOR_EACH_BIN_FIELD(WITH_FIELD)
23 #undef WITH_FIELD
24 };
25 
describeBinKind(const BinKind & kind)26 const char* describeBinKind(const BinKind& kind) {
27   return BINKIND_DESCRIPTIONS[static_cast<size_t>(kind)];
28 }
29 
describeBinField(const BinField & field)30 const char* describeBinField(const BinField& field) {
31   return BINFIELD_DESCRIPTIONS[static_cast<size_t>(field)];
32 }
33 
34 }  // namespace frontend
35 }  // namespace js
36