-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathJumpStmt.cpp
More file actions
40 lines (34 loc) · 933 Bytes
/
JumpStmt.cpp
File metadata and controls
40 lines (34 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The Initial Developer of this code is David Baum.
* Portions created by David Baum are Copyright (C) 1999 David Baum.
* All Rights Reserved.
*
* Portions created by John Hansen are Copyright (C) 2005 John Hansen.
* All Rights Reserved.
*
*/
#include "JumpStmt.h"
#include "Bytecode.h"
#include "Error.h"
JumpStmt::JumpStmt(int type, const LexLocation &loc)
{
fType = type;
fLocation = loc;
}
void JumpStmt::EmitActual(Bytecode &b)
{
if (!b.AddFlowJump(static_cast<Bytecode::FlowCode>(fType)))
{
Error(
(fType==Bytecode::kContinueFlow) ? kErr_NoContinueContext : kErr_NoBreakContext
).Raise(&fLocation);
}
}
Stmt* JumpStmt::CloneActual(Mapping *) const
{
return new JumpStmt(fType, fLocation);
}