summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/parser
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-09-14 16:29:47 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-09-14 16:29:47 +0200
commitd0424a769059c84ae20beb3c217812792ea6726b (patch)
tree6f94a5c3db8c52c6694ee56498542a6c35417350 /Source/JavaScriptCore/parser
parent88a04ac016f57c2d78e714682445dff2e7db4ade (diff)
downloadqtwebkit-d0424a769059c84ae20beb3c217812792ea6726b.tar.gz
Imported WebKit commit 37c5e5041d39a14ea0d429a77ebd352e4bd26516 (http://svn.webkit.org/repository/webkit/trunk@128608)
New snapshot that enables WebKit2 build on Windows (still some bugs) and allows for WebKit to be built with qmake && make
Diffstat (limited to 'Source/JavaScriptCore/parser')
-rw-r--r--Source/JavaScriptCore/parser/Lexer.cpp10
-rw-r--r--Source/JavaScriptCore/parser/NodeConstructors.h2
-rw-r--r--Source/JavaScriptCore/parser/Nodes.h1
-rw-r--r--Source/JavaScriptCore/parser/Parser.h4
-rw-r--r--Source/JavaScriptCore/parser/SourceCode.h6
-rw-r--r--Source/JavaScriptCore/parser/SourceProvider.h18
6 files changed, 19 insertions, 22 deletions
diff --git a/Source/JavaScriptCore/parser/Lexer.cpp b/Source/JavaScriptCore/parser/Lexer.cpp
index 063168be1..8c9eaa12c 100644
--- a/Source/JavaScriptCore/parser/Lexer.cpp
+++ b/Source/JavaScriptCore/parser/Lexer.cpp
@@ -405,10 +405,10 @@ void Lexer<T>::setCode(const SourceCode& source, ParserArena* arena)
m_lineNumber = source.firstLine();
m_lastToken = -1;
- const StringImpl* sourceString = source.provider()->data();
+ const String& sourceString = source.provider()->source();
- if (sourceString)
- setCodeStart(sourceString);
+ if (!sourceString.isNull())
+ setCodeStart(sourceString.impl());
else
m_codeStart = 0;
@@ -1689,8 +1689,8 @@ void Lexer<T>::clear()
template <typename T>
SourceCode Lexer<T>::sourceCode(int openBrace, int closeBrace, int firstLine)
{
- ASSERT((*m_source->provider()->data())[openBrace] == '{');
- ASSERT((*m_source->provider()->data())[closeBrace] == '}');
+ ASSERT(m_source->provider()->source()[openBrace] == '{');
+ ASSERT(m_source->provider()->source()[closeBrace] == '}');
return SourceCode(m_source->provider(), openBrace, closeBrace + 1, firstLine);
}
diff --git a/Source/JavaScriptCore/parser/NodeConstructors.h b/Source/JavaScriptCore/parser/NodeConstructors.h
index 1678bf7ea..274491960 100644
--- a/Source/JavaScriptCore/parser/NodeConstructors.h
+++ b/Source/JavaScriptCore/parser/NodeConstructors.h
@@ -812,7 +812,6 @@ namespace JSC {
, m_lexpr(l)
, m_expr(expr)
, m_statement(statement)
- , m_identIsVarDecl(false)
{
}
@@ -822,7 +821,6 @@ namespace JSC {
, m_lexpr(new (globalData) ResolveNode(location, ident, divot - startOffset))
, m_expr(expr)
, m_statement(statement)
- , m_identIsVarDecl(true)
{
if (in) {
AssignResolveNode* node = new (globalData) AssignResolveNode(location, ident, in);
diff --git a/Source/JavaScriptCore/parser/Nodes.h b/Source/JavaScriptCore/parser/Nodes.h
index 475689ce9..509d36d1a 100644
--- a/Source/JavaScriptCore/parser/Nodes.h
+++ b/Source/JavaScriptCore/parser/Nodes.h
@@ -1204,7 +1204,6 @@ namespace JSC {
ExpressionNode* m_lexpr;
ExpressionNode* m_expr;
StatementNode* m_statement;
- bool m_identIsVarDecl;
};
class ContinueNode : public StatementNode, public ThrowableExpressionData {
diff --git a/Source/JavaScriptCore/parser/Parser.h b/Source/JavaScriptCore/parser/Parser.h
index 3a61da1a8..e657e12cd 100644
--- a/Source/JavaScriptCore/parser/Parser.h
+++ b/Source/JavaScriptCore/parser/Parser.h
@@ -1029,9 +1029,9 @@ PassRefPtr<ParsedNode> parse(JSGlobalData* globalData, JSGlobalObject* lexicalGl
{
SamplingRegion samplingRegion("Parsing");
- ASSERT(source.provider()->data());
+ ASSERT(!source.provider()->source().isNull());
- if (source.provider()->data()->is8Bit()) {
+ if (source.provider()->source().is8Bit()) {
Parser< Lexer<LChar> > parser(globalData, source, parameters, name, strictness, parserMode);
return parser.parse<ParsedNode>(lexicalGlobalObject, debugger, execState, exception);
}
diff --git a/Source/JavaScriptCore/parser/SourceCode.h b/Source/JavaScriptCore/parser/SourceCode.h
index bda91b3c8..a094469a2 100644
--- a/Source/JavaScriptCore/parser/SourceCode.h
+++ b/Source/JavaScriptCore/parser/SourceCode.h
@@ -47,7 +47,7 @@ namespace JSC {
SourceCode(PassRefPtr<SourceProvider> provider, int firstLine = 1)
: m_provider(provider)
, m_startChar(0)
- , m_endChar(m_provider->length())
+ , m_endChar(m_provider->source().length())
, m_firstLine(std::max(firstLine, 1))
{
}
@@ -97,8 +97,8 @@ namespace JSC {
inline SourceCode SourceCode::subExpression(unsigned openBrace, unsigned closeBrace, int firstLine)
{
- ASSERT((*provider()->data())[openBrace] == '{');
- ASSERT((*provider()->data())[closeBrace] == '}');
+ ASSERT(provider()->source()[openBrace] == '{');
+ ASSERT(provider()->source()[closeBrace] == '}');
return SourceCode(provider(), openBrace, closeBrace + 1, firstLine);
}
diff --git a/Source/JavaScriptCore/parser/SourceProvider.h b/Source/JavaScriptCore/parser/SourceProvider.h
index 7f2e8d995..145b2dd16 100644
--- a/Source/JavaScriptCore/parser/SourceProvider.h
+++ b/Source/JavaScriptCore/parser/SourceProvider.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -56,10 +56,12 @@ namespace JSC {
delete m_cache;
}
- virtual String getRange(int start, int end) const = 0;
- virtual const StringImpl* data() const = 0;
- virtual int length() const = 0;
-
+ virtual const String& source() const = 0;
+ String getRange(int start, int end) const
+ {
+ return source().substringSharingImpl(start, end - start);
+ }
+
const String& url() { return m_url; }
TextPosition startPosition() const { return m_startPosition; }
intptr_t asID()
@@ -93,12 +95,10 @@ namespace JSC {
return adoptRef(new StringSourceProvider(source, url, startPosition));
}
- virtual String getRange(int start, int end) const OVERRIDE
+ virtual const String& source() const OVERRIDE
{
- return m_source.substringSharingImpl(start, end - start);
+ return m_source;
}
- const StringImpl* data() const { return m_source.impl(); }
- int length() const { return m_source.length(); }
private:
StringSourceProvider(const String& source, const String& url, const TextPosition& startPosition)