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

Unified Diff: test/cctest/test-parsing.cc

Issue 1306683003: Treat the x*1 generated by parsing a unary + as containing a dot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 4 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/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 73a43e4cf8231360e0a9d84f68e8227edb0b59bf..e18f9ed44e426a445016925a56e4aacca7a78b4f 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1134,10 +1134,19 @@ static void CheckParsesToNumber(const char* source, bool with_dot) {
CHECK(fun->body()->length() == 1);
CHECK(fun->body()->at(0)->IsReturnStatement());
i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement();
- CHECK(ret->expression()->IsLiteral());
i::Literal* lit = ret->expression()->AsLiteral();
- const i::AstValue* val = lit->raw_value();
- CHECK(with_dot == val->ContainsDot());
+ if (lit != NULL) {
+ const i::AstValue* val = lit->raw_value();
+ CHECK(with_dot == val->ContainsDot());
+ } else if (with_dot) {
+ i::BinaryOperation* bin = ret->expression()->AsBinaryOperation();
+ CHECK(bin != NULL);
+ CHECK_EQ(i::Token::MUL, bin->op());
+ i::Literal* rlit = bin->right()->AsLiteral();
+ const i::AstValue* val = rlit->raw_value();
+ CHECK(with_dot == val->ContainsDot());
+ CHECK_EQ(1.0, val->AsNumber());
+ }
}
@@ -1148,6 +1157,7 @@ TEST(ParseNumbers) {
CheckParsesToNumber("134.e44", true);
CheckParsesToNumber("134.44e44", true);
CheckParsesToNumber(".44", true);
+ CheckParsesToNumber("+x", true);
}
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698