Reviewers: Michael Starzinger, rossberg,
Message:
An initial patch. Still figuring out how to test it.
Description:
Fix crasher when checking for "of", but no next token present
Possibly fixes crashers parsing for-in with --harmony. Also fix a typo
in an assertion in scanner.h.
[email protected], [email protected]
BUG=
Please review this at https://codereview.chromium.org/16549003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/preparser.cc
M src/scanner.h
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index
243a3ed34c52e20ca31b48d4bcffadd25bc8c8dd..828177aee0a696ddf51c75b2ca7867aacc163522
100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -662,6 +662,7 @@ PreParser::Statement
PreParser::ParseWhileStatement(bool* ok) {
bool PreParser::CheckInOrOf() {
if (peek() == i::Token::IN ||
(allow_for_of() &&
+ peek() == i::Token::IDENTIFIER &&
scanner_->is_next_contextual_keyword(v8::internal::CStrVector("of")))) {
Next();
return true;
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index
368ec1beae557568aee0c52f65aa50f483a3b9d8..eb6764e80f3c4be38bbdbf73aedfcbe4dcb8af9e
100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -331,7 +331,7 @@ class Scanner {
return current_.literal_chars->is_ascii();
}
bool is_literal_contextual_keyword(Vector<const char> keyword) {
- ASSERT_NOT_NULL(next_.literal_chars);
+ ASSERT_NOT_NULL(current_.literal_chars);
return current_.literal_chars->is_contextual_keyword(keyword);
}
int literal_length() const {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.