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/. */
7
#ifndef frontend_ParseNode_inl_h
8
#define frontend_ParseNode_inl_h
10
#include "frontend/ParseNode.h"
11
#include "frontend/SharedContext.h"
17
UpvarCookie::set(JSContext *cx, unsigned newLevel, uint16_t newSlot)
19
// This is an unsigned-to-uint16_t conversion, test for too-high values.
20
// In practice, recursion in Parser and/or BytecodeEmitter will blow the
21
// stack if we nest functions more than a few hundred deep, so this will
22
// never trigger. Oh well.
23
if (newLevel >= FREE_LEVEL) {
24
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_TOO_DEEP, js_function_str);
33
ParseNode::name() const
35
JS_ASSERT(isKind(PNK_FUNCTION) || isKind(PNK_NAME));
36
JSAtom *atom = isKind(PNK_FUNCTION) ? pn_funbox->function()->atom() : pn_atom;
37
return atom->asPropertyName();
41
ParseNode::atom() const
43
JS_ASSERT(isKind(PNK_MODULE) || isKind(PNK_STRING));
44
return isKind(PNK_MODULE) ? pn_modulebox->module()->atom() : pn_atom;
47
} /* namespace frontend */
50
#endif /* frontend_ParseNode_inl_h */