also propagate updateContents() calls to parent frame
[kdelibs.git] / kjs / scope_chain.cpp
blob99a83071eba9e7374b34d8157d0dd57ba130e971
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"
26 #include <config.h>
28 #include <stdio.h>
30 namespace KJS {
32 void ScopeChain::push(const ScopeChain &c)
34 ScopeChainNode **tail = &_node;
35 for (ScopeChainNode *n = c._node; n; n = n->next) {
36 ScopeChainNode *newNode = new ScopeChainNode(*tail, n->object);
37 *tail = newNode;
38 tail = &newNode->next;
42 #ifndef NDEBUG
44 void ScopeChain::print()
46 ScopeChainIterator scopeEnd = end();
47 for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
48 JSObject* o = *scopeIter;
49 PropertyNameArray propertyNames;
50 // FIXME: should pass ExecState here!
51 o->getPropertyNames(0, propertyNames);
52 PropertyNameArrayIterator propEnd = propertyNames.end();
54 fprintf(stderr, "----- [scope %p] -----\n", o);
55 for (PropertyNameArrayIterator propIter = propertyNames.begin(); propIter != propEnd; propIter++) {
56 Identifier name = *propIter;
57 fprintf(stderr, "%s, ", name.ascii());
59 fprintf(stderr, "\n");
63 #endif
65 } // namespace KJS