Source code

Revision control

Other Tools

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
#ifndef ds_IdValuePair_h
8
#define ds_IdValuePair_h
9
10
#include "jsapi.h"
11
12
#include "NamespaceImports.h"
13
#include "gc/Tracer.h"
14
#include "js/GCVector.h"
15
#include "js/Id.h"
16
17
namespace js {
18
19
struct IdValuePair {
20
Value value;
21
jsid id;
22
23
IdValuePair() : value(UndefinedValue()), id(JSID_EMPTY) {}
24
explicit IdValuePair(jsid idArg) : value(UndefinedValue()), id(idArg) {}
25
IdValuePair(jsid idArg, const Value& valueArg) : value(valueArg), id(idArg) {}
26
27
void trace(JSTracer* trc) {
28
TraceRoot(trc, &value, "IdValuePair::value");
29
TraceRoot(trc, &id, "IdValuePair::id");
30
}
31
};
32
33
using IdValueVector = JS::GCVector<IdValuePair, 8>;
34
35
} /* namespace js */
36
37
#endif /* ds_IdValuePair_h */