]> git.saurik.com Git - apple/javascriptcore.git/blame - kjs/completion.h
JavaScriptCore-466.1.3.tar.gz
[apple/javascriptcore.git] / kjs / completion.h
CommitLineData
b37bf2e1
A
1// -*- c-basic-offset: 2 -*-
2/*
3 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
4 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
5 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef KJS_COMPLETION_H
25#define KJS_COMPLETION_H
26
27namespace KJS {
28
29 class JSValue;
30
31 enum ComplType { Normal, Break, Continue, ReturnValue, Throw, Interrupted };
32
33 /**
34 * Completion objects are used to convey the return status and value
35 * from functions.
36 *
37 * See FunctionImp::execute()
38 *
39 * @see FunctionImp
40 *
41 * @short Handle for a Completion type.
42 */
43 class Completion {
44 public:
45 Completion(ComplType type = Normal, JSValue* value = 0)
46 : m_type(type), m_value(value) { }
47
48 ComplType complType() const { return m_type; }
49 JSValue* value() const { return m_value; }
50 void setValue(JSValue* v) { m_value = v; }
51 bool isValueCompletion() const { return !!m_value; }
52
53 private:
54 ComplType m_type;
55 JSValue* m_value;
56 };
57
58}
59
60#endif