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

Unified Diff: test/cctest/test-ast-expression-visitor.cc

Issue 1316633002: Fix AstExpressionVisitor to correctly handle switch + for. (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/ast-expression-visitor.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-ast-expression-visitor.cc
diff --git a/test/cctest/test-ast-expression-visitor.cc b/test/cctest/test-ast-expression-visitor.cc
index f2709639e3570c402b423ad6646171ff1d5b3d0d..bee0a73de1b0eeefbea0828c242028123e72a27b 100644
--- a/test/cctest/test-ast-expression-visitor.cc
+++ b/test/cctest/test-ast-expression-visitor.cc
@@ -256,3 +256,44 @@ TEST(VisitExpressions) {
}
CHECK_TYPES_END
}
+
+
+TEST(VisitEmptyForStatment) {
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
+ // Check that traversing an empty for statement works.
+ const char test_function[] =
+ "function foo() {\n"
+ " for (;;) {}\n"
+ "}\n";
+ CollectTypes(&handles, test_function, &types);
+ CHECK_TYPES_BEGIN {
+ CHECK_EXPR(FunctionLiteral, DEFAULT_TYPE) {}
+ }
+ CHECK_TYPES_END
+}
+
+
+TEST(VisitSwitchStatment) {
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
+ // Check that traversing a switch with a default works.
+ const char test_function[] =
+ "function foo() {\n"
+ " switch (0) { case 1: break; default: break; }\n"
+ "}\n";
+ CollectTypes(&handles, test_function, &types);
+ CHECK_TYPES_BEGIN {
+ CHECK_EXPR(FunctionLiteral, DEFAULT_TYPE) {
+ CHECK_EXPR(Assignment, DEFAULT_TYPE) {
+ CHECK_VAR(.switch_tag, DEFAULT_TYPE);
+ CHECK_EXPR(Literal, DEFAULT_TYPE);
+ }
+ CHECK_VAR(.switch_tag, DEFAULT_TYPE);
+ CHECK_EXPR(Literal, DEFAULT_TYPE);
+ }
+ }
+ CHECK_TYPES_END
+}
« no previous file with comments | « src/ast-expression-visitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698