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, |