blob: c4ca8fd64a34954ae5045ba0e4e79d587e01cefa [file] [log] [blame]
The Android Open Source Project8e35f3c2009-03-03 19:30:52 -08001/*
2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29
30#include "config.h"
31#include "JSNotAnObject.h"
32
33#include <wtf/UnusedParam.h>
34
35namespace JSC {
36
37ASSERT_CLASS_FITS_IN_CELL(JSNotAnObject);
38
39// JSValue methods
40JSValue* JSNotAnObject::toPrimitive(ExecState* exec, PreferredPrimitiveType) const
41{
42 UNUSED_PARAM(exec);
43 ASSERT(exec->hadException() && exec->exception() == m_exception);
44 return m_exception;
45}
46
47bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue*&)
48{
49 UNUSED_PARAM(exec);
50 ASSERT(exec->hadException() && exec->exception() == m_exception);
51 return false;
52}
53
54bool JSNotAnObject::toBoolean(ExecState* exec) const
55{
56 UNUSED_PARAM(exec);
57 ASSERT(exec->hadException() && exec->exception() == m_exception);
58 return false;
59}
60
61double JSNotAnObject::toNumber(ExecState* exec) const
62{
63 UNUSED_PARAM(exec);
64 ASSERT(exec->hadException() && exec->exception() == m_exception);
65 return NaN;
66}
67
68UString JSNotAnObject::toString(ExecState* exec) const
69{
70 UNUSED_PARAM(exec);
71 ASSERT(exec->hadException() && exec->exception() == m_exception);
72 return "";
73}
74
75JSObject* JSNotAnObject::toObject(ExecState* exec) const
76{
77 UNUSED_PARAM(exec);
78 ASSERT(exec->hadException() && exec->exception() == m_exception);
79 return m_exception;
80}
81
82// Marking
83void JSNotAnObject::mark()
84{
85 JSCell::mark();
86 if (!m_exception->marked())
87 m_exception->mark();
88}
89
90// JSObject methods
91bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&)
92{
93 UNUSED_PARAM(exec);
94 ASSERT(exec->hadException() && exec->exception() == m_exception);
95 return false;
96}
97
98bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&)
99{
100 UNUSED_PARAM(exec);
101 ASSERT(exec->hadException() && exec->exception() == m_exception);
102 return false;
103}
104
105void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue*, PutPropertySlot&)
106{
107 UNUSED_PARAM(exec);
108 ASSERT(exec->hadException() && exec->exception() == m_exception);
109}
110
111void JSNotAnObject::put(ExecState* exec, unsigned, JSValue*)
112{
113 UNUSED_PARAM(exec);
114 ASSERT(exec->hadException() && exec->exception() == m_exception);
115}
116
117bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier&)
118{
119 UNUSED_PARAM(exec);
120 ASSERT(exec->hadException() && exec->exception() == m_exception);
121 return false;
122}
123
124bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned)
125{
126 UNUSED_PARAM(exec);
127 ASSERT(exec->hadException() && exec->exception() == m_exception);
128 return false;
129}
130
131void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&)
132{
133 UNUSED_PARAM(exec);
134 ASSERT(exec->hadException() && exec->exception() == m_exception);
135}
136
137} // namespace JSC