fix logic
[personal-kdelibs.git] / kjs / scope_chain.cpp
blobc519919d9d3c2e679bc47c49b2bcd753818dceda
1 /*
2 * This file is part of the KDE libraries
3 * Copyright (C) 2003 Apple Computer, Inc.
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.
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.
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.
22 #include "scope_chain.h"
23 #include "PropertyNameArray.h"
24 #include "object.h"
25 #include "JSVariableObject.h"
27 #include <config.h>
29 #include <stdio.h>
31 namespace KJS {
33 #ifndef NDEBUG
35 void ScopeChain::print()
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();
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());
50 fprintf(stderr, "\n");
54 #endif
56 } // namespace KJS