1 /*
2 * The contents of this file are subject to the Mozilla Public License
3 * Version 1.0 (the "License"); you may not use this file except in
4 * compliance with the License. You may obtain a copy of the License at
5 * http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS IS"
8 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
9 * License for the specific language governing rights and limitations
10 * under the License.
11 *
12 * The Initial Developer of this code is David Baum.
13 * Portions created by David Baum are Copyright (C) 1998 David Baum.
14 * All Rights Reserved.
15 *
16 * Portions created by John Hansen are Copyright (C) 2005 John Hansen.
17 * All Rights Reserved.
18 *
19 */
20
21 #include "LabelStmt.h"
22 #include "Bytecode.h"
23 #include "Error.h"
24 #include "Symbol.h"
25
26
LabelStmt(const Symbol * name,const LexLocation & loc,Stmt * s)27 LabelStmt::LabelStmt(const Symbol *name, const LexLocation &loc, Stmt *s) :
28 ChainStmt(s),
29 fName(name),
30 fLocation(loc)
31 {
32 }
33
34
~LabelStmt()35 LabelStmt::~LabelStmt()
36 {
37 }
38
39
EmitActual(Bytecode & b)40 void LabelStmt::EmitActual(Bytecode &b)
41 {
42 b.SetLabel(fLabel);
43 GetBody()->Emit(b);
44 }
45
46
CloneActual(Mapping * m) const47 Stmt* LabelStmt::CloneActual(Mapping *m) const
48 {
49 return new LabelStmt(fName, fLocation, GetBody()->Clone(m));
50 }
51