1/*
2 * This file is part of the KDE libraries
3 * Copyright (C) 2003 Apple Computer, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 */
21
22#include "scope_chain.h"
23#include "PropertyNameArray.h"
24#include "object.h"
25#include "JSVariableObject.h"
26
27#include <config-kjs.h>
28
29#include <stdio.h>
30
31namespace KJS {
32
33#ifndef NDEBUG
34
35void ScopeChain::print()
36{
37 ScopeChainIterator scopeEnd = end();
38 for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
39 JSObject* o = *scopeIter;
40 PropertyNameArray propertyNames;
41 // FIXME: should pass ExecState here!
42 o->getPropertyNames(0, propertyNames);
43 PropertyNameArrayIterator propEnd = propertyNames.end();
44
45 fprintf(stderr, "----- [scope %p] -----\n", (void*)o);
46 for (PropertyNameArrayIterator propIter = propertyNames.begin(); propIter != propEnd; ++propIter) {
47 Identifier name = *propIter;
48 fprintf(stderr, "%s, ", name.ascii());
49 }
50 fprintf(stderr, "\n");
51 }
52}
53
54#endif
55
56} // namespace KJS
57