summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/parser/JSParser.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-24 11:24:40 +0100
committerBen Murdoch <benm@google.com>2011-06-02 09:53:15 +0100
commit81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch)
tree7a9e5ed86ff429fd347a25153107221543909b19 /Source/JavaScriptCore/parser/JSParser.cpp
parent94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff)
downloadexternal_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/JavaScriptCore/parser/JSParser.cpp')
-rw-r--r--Source/JavaScriptCore/parser/JSParser.cpp38
1 files changed, 34 insertions, 4 deletions
diff --git a/Source/JavaScriptCore/parser/JSParser.cpp b/Source/JavaScriptCore/parser/JSParser.cpp
index 993dd66..9245eb0 100644
--- a/Source/JavaScriptCore/parser/JSParser.cpp
+++ b/Source/JavaScriptCore/parser/JSParser.cpp
@@ -36,6 +36,7 @@ using namespace JSC;
#include "SourceProvider.h"
#include "SourceProviderCacheItem.h"
#include <wtf/HashFunctions.h>
+#include <wtf/OwnPtr.h>
#include <wtf/WTFThreadData.h>
#include <utility>
@@ -293,7 +294,31 @@ private:
, m_labels(0)
{
}
-
+
+ Scope(const Scope& rhs)
+ : m_globalData(rhs.m_globalData)
+ , m_shadowsArguments(rhs.m_shadowsArguments)
+ , m_usesEval(rhs.m_usesEval)
+ , m_needsFullActivation(rhs.m_needsFullActivation)
+ , m_allowsNewDecls(rhs.m_allowsNewDecls)
+ , m_strictMode(rhs.m_strictMode)
+ , m_isFunction(rhs.m_isFunction)
+ , m_isFunctionBoundary(rhs.m_isFunctionBoundary)
+ , m_isValidStrictMode(rhs.m_isValidStrictMode)
+ , m_loopDepth(rhs.m_loopDepth)
+ , m_switchDepth(rhs.m_switchDepth)
+ , m_labels(0)
+ {
+ if (rhs.m_labels) {
+ m_labels = adoptPtr(new LabelStack);
+
+ typedef LabelStack::const_iterator iterator;
+ iterator end = rhs.m_labels->end();
+ for (iterator it = rhs.m_labels->begin(); it != end; ++it)
+ m_labels->append(ScopeLabelInfo(it->m_ident, it->m_isLoop));
+ }
+ }
+
void startSwitch() { m_switchDepth++; }
void endSwitch() { m_switchDepth--; }
void startLoop() { m_loopDepth++; }
@@ -305,7 +330,7 @@ private:
void pushLabel(const Identifier* label, bool isLoop)
{
if (!m_labels)
- m_labels = new LabelStack;
+ m_labels = adoptPtr(new LabelStack);
m_labels->append(ScopeLabelInfo(label->impl(), isLoop));
}
@@ -465,13 +490,13 @@ private:
int m_switchDepth;
typedef Vector<ScopeLabelInfo, 2> LabelStack;
- LabelStack* m_labels;
+ OwnPtr<LabelStack> m_labels;
IdentifierSet m_declaredVariables;
IdentifierSet m_usedVariables;
IdentifierSet m_closedVariables;
IdentifierSet m_writtenVariables;
};
-
+
typedef Vector<Scope, 10> ScopeStack;
struct ScopeRef {
@@ -2140,3 +2165,8 @@ template <class TreeBuilder> TreeExpression JSParser::parseUnaryExpression(TreeB
}
}
+
+namespace WTF
+{
+ template <> struct VectorTraits<JSC::JSParser::Scope> : SimpleClassVectorTraits { };
+}