source: webkit/trunk/JavaScriptCore/kjs/NodeInfo.h@ 31813

Last change on this file since 31813 was 31072, checked in by [email protected], 17 years ago

Add logic to track whether a function uses a locally scoped eval or requires a closure

Reviewed by Maciej

Now that we limit eval we can track those uses of eval that operate
in the local scope and functions that require a closure. We track
this information during initial parsing to avoid yet another tree
walk.

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/*
2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
20#ifndef NodeInfo_h
21#define NodeInfo_h
22
23#include "nodes.h"
24#include "Parser.h"
25
26namespace KJS {
27
28 typedef unsigned int FeatureInfo;
29
30 const FeatureInfo NoFeatures = 0;
31 const FeatureInfo EvalFeature = 1 << 0;
32 const FeatureInfo ClosureFeature = 1 << 1;
33
34 template <typename T> struct NodeFeatureInfo {
35 T m_node;
36 FeatureInfo m_featureInfo;
37 };
38
39 typedef NodeFeatureInfo<FuncExprNode*> FuncExprNodeInfo;
40 typedef NodeFeatureInfo<ExpressionNode*> ExpressionNodeInfo;
41 typedef NodeFeatureInfo<ArgumentsNode*> ArgumentsNodeInfo;
42 typedef NodeFeatureInfo<ConstDeclNode*> ConstDeclNodeInfo;
43 typedef NodeFeatureInfo<PropertyNode*> PropertyNodeInfo;
44 typedef NodeFeatureInfo<PropertyList> PropertyListInfo;
45 typedef NodeFeatureInfo<ElementList> ElementListInfo;
46 typedef NodeFeatureInfo<ArgumentList> ArgumentListInfo;
47
48 template <typename T> struct NodeDeclarationInfo {
49 T m_node;
50 ParserRefCountedData<DeclarationStacks::VarStack>* m_varDeclarations;
51 ParserRefCountedData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
52 FeatureInfo m_featureInfo;
53 };
54
55 typedef NodeDeclarationInfo<StatementNode*> StatementNodeInfo;
56 typedef NodeDeclarationInfo<CaseBlockNode*> CaseBlockNodeInfo;
57 typedef NodeDeclarationInfo<CaseClauseNode*> CaseClauseNodeInfo;
58 typedef NodeDeclarationInfo<SourceElements*> SourceElementsInfo;
59 typedef NodeDeclarationInfo<ClauseList> ClauseListInfo;
60 typedef NodeDeclarationInfo<ExpressionNode*> VarDeclListInfo;
61 typedef NodeDeclarationInfo<ConstDeclList> ConstDeclListInfo;
62
63} // namespace KJS
64
65#endif // NodeInfo_h
Note: See TracBrowser for help on using the repository browser.