summaryrefslogtreecommitdiff
path: root/deps/v8/src/scanner-base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/scanner-base.cc')
-rw-r--r--deps/v8/src/scanner-base.cc32
1 files changed, 15 insertions, 17 deletions
diff --git a/deps/v8/src/scanner-base.cc b/deps/v8/src/scanner-base.cc
index b26fee01a7..9e58c4e637 100644
--- a/deps/v8/src/scanner-base.cc
+++ b/deps/v8/src/scanner-base.cc
@@ -35,6 +35,12 @@ namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
+// UTF16Buffer
+
+UTF16Buffer::UTF16Buffer()
+ : pos_(0), end_(kNoEndPosition) { }
+
+// ----------------------------------------------------------------------------
// LiteralCollector
LiteralCollector::LiteralCollector()
@@ -86,7 +92,7 @@ bool ScannerConstants::IsIdentifier(unibrow::CharacterStream* buffer) {
// ----------------------------------------------------------------------------
// Scanner
-Scanner::Scanner() { }
+Scanner::Scanner() : source_(NULL) {}
uc32 Scanner::ScanHexEscape(uc32 c, int length) {
@@ -136,7 +142,8 @@ uc32 Scanner::ScanOctalEscape(uc32 c, int length) {
// ----------------------------------------------------------------------------
// JavaScriptScanner
-JavaScriptScanner::JavaScriptScanner() : Scanner() {}
+JavaScriptScanner::JavaScriptScanner()
+ : has_line_terminator_before_next_(false) {}
Token::Value JavaScriptScanner::Next() {
@@ -496,21 +503,12 @@ void JavaScriptScanner::Scan() {
void JavaScriptScanner::SeekForward(int pos) {
- // After this call, we will have the token at the given position as
- // the "next" token. The "current" token will be invalid.
- if (pos == next_.location.beg_pos) return;
- int current_pos = source_pos();
- ASSERT_EQ(next_.location.end_pos, current_pos);
- // Positions inside the lookahead token aren't supported.
- ASSERT(pos >= current_pos);
- if (pos != current_pos) {
- source_->SeekForward(pos - source_->pos());
- Advance();
- // This function is only called to seek to the location
- // of the end of a function (at the "}" token). It doesn't matter
- // whether there was a line terminator in the part we skip.
- has_line_terminator_before_next_ = false;
- }
+ source_->SeekForward(pos - 1);
+ Advance();
+ // This function is only called to seek to the location
+ // of the end of a function (at the "}" token). It doesn't matter
+ // whether there was a line terminator in the part we skip.
+ has_line_terminator_before_next_ = false;
Scan();
}