[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kjs
From: Maks Orlovich <maksim () kde ! org>
Date: 2009-04-25 17:49:48
Message-ID: 1240681788.774016.28382.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 959208 by orlovich:
automatically merged revision 959204:
Don't walk object literals for declarations; they can't possibly
be there, and we may run out of stack space doing this.
I think I'll probably switch over how we do declarations at some point, though
--- since we now track the active function context in the grammar, we should
be able to keep track of declarations at the time, avoiding extra AST walks.
CCBUG:190609
M +4 -3 nodes.cpp
M +5 -3 nodes.h
--- trunk/KDE/kdelibs/kjs/nodes.cpp #959207:959208
@@ -206,8 +206,9 @@
virtual Node* visit(Node* node) {
node->processVarDecl(m_exec);
- //Do not recurse inside function bodies...
- if (node->introducesNewStaticScope())
+ //Do not recurse inside function bodies, or things that
+ // syntactically can't contain declarations
+ if (!node->scanForDeclarations())
return 0;
return NodeVisitor::visit(node);
@@ -224,7 +225,7 @@
virtual Node* visit(Node* node) {
node->processFuncDecl(m_exec);
- if (node->introducesNewStaticScope())
+ if (!node->scanForDeclarations())
return 0;
return NodeVisitor::visit(node);
--- trunk/KDE/kdelibs/kjs/nodes.h #959207:959208
@@ -111,7 +111,7 @@
bool isGroupNode() const { return type() == GroupNodeType; }
bool isTryNode() const { return type() == TryNodeType; }
bool isLabelNode() const { return type() == LabelNodeType; }
- virtual bool introducesNewStaticScope () const { return false; }
+ virtual bool scanForDeclarations () const { return true; }
virtual bool isIterationStatement() const { return false; }
virtual void breakCycle() { }
@@ -355,6 +355,7 @@
virtual OpValue generateEvalCode(CompileState* comp);
virtual void streamTo(SourceStream&) const;
virtual void recurseVisit(NodeVisitor *visitor);
+ virtual bool scanForDeclarations() const { return false; }
private:
RefPtr<ElementNode> element;
int elision;
@@ -409,6 +410,7 @@
virtual OpValue generateEvalCode(CompileState* comp);
virtual void streamTo(SourceStream&) const;
virtual void recurseVisit(NodeVisitor *visitor);
+ virtual bool scanForDeclarations() const { return false; }
private:
RefPtr<PropertyListNode> list;
};
@@ -1114,7 +1116,7 @@
virtual OpValue generateEvalCode(CompileState* comp);
virtual void streamTo(SourceStream&) const;
virtual void recurseVisit(NodeVisitor *visitor);
- virtual bool introducesNewStaticScope() const { return true; }
+ virtual bool scanForDeclarations() const { return false; }
private:
void addParams();
// Used for streamTo
@@ -1134,7 +1136,7 @@
virtual void generateExecCode(CompileState*);
virtual void streamTo(SourceStream&) const;
virtual void recurseVisit(NodeVisitor *visitor);
- virtual bool introducesNewStaticScope() const { return true; }
+ virtual bool scanForDeclarations() const { return false; }
virtual void processFuncDecl(ExecState*);
FunctionImp* makeFunctionObject(ExecState*);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic