Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: src/scanner.cc

Issue 2959007: Fix preparsing from a source string that is not external.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
===================================================================
--- src/scanner.cc (revision 5044)
+++ src/scanner.cc (working copy)
@@ -341,8 +341,7 @@
void Scanner::Initialize(Handle<String> source,
ParserLanguage language) {
- safe_string_input_buffer_.Reset(source.location());
- Init(source, &safe_string_input_buffer_, 0, source->length(), language);
+ Init(source, NULL, 0, source->length(), language);
}
@@ -357,9 +356,7 @@
int start_position,
int end_position,
ParserLanguage language) {
- safe_string_input_buffer_.Reset(source.location());
- Init(source, &safe_string_input_buffer_,
- start_position, end_position, language);
+ Init(source, NULL, start_position, end_position, language);
}
@@ -368,6 +365,10 @@
int start_position,
int end_position,
ParserLanguage language) {
+ // Either initialize the scanner from a character stream or from a
+ // string.
+ ASSERT(source.is_null() || stream == NULL);
+
// Initialize the source buffer.
if (!source.is_null() && StringShape(*source).IsExternalTwoByte()) {
two_byte_string_buffer_.Initialize(
@@ -382,6 +383,10 @@
end_position);
source_ = &ascii_string_buffer_;
} else {
+ if (!source.is_null()) {
+ safe_string_input_buffer_.Reset(source.location());
+ stream = &safe_string_input_buffer_;
+ }
char_stream_buffer_.Initialize(source,
stream,
start_position,
« no previous file with comments | « src/compiler.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698