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 "frontend/LabelEmitter.h"
9 #include "mozilla/Assertions.h" // MOZ_ASSERT
11 #include "frontend/BytecodeEmitter.h" // BytecodeEmitter
14 using namespace js::frontend
;
16 void LabelEmitter::emitLabel(TaggedParserAtomIndex name
) {
17 MOZ_ASSERT(state_
== State::Start
);
19 controlInfo_
.emplace(bce_
, name
, bce_
->bytecodeSection().offset());
22 state_
= State::Label
;
26 bool LabelEmitter::emitEnd() {
27 MOZ_ASSERT(state_
== State::Label
);
29 // Patch the break/continue to this label.
30 if (!controlInfo_
->patchBreaks(bce_
)) {