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

Unified Diff: test/cctest/test-func-name-inference.cc

Issue 16125007: Fix function name inferring inside closures (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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-func-name-inference.cc
diff --git a/test/cctest/test-func-name-inference.cc b/test/cctest/test-func-name-inference.cc
index a86dfd28a1aab6ae39c307cab87df1d403f04fa5..dcc6272a39ce834787c58d532daf80e39d578370 100644
--- a/test/cctest/test-func-name-inference.cc
+++ b/test/cctest/test-func-name-inference.cc
@@ -258,6 +258,57 @@ TEST(MultipleFuncsInLiteral) {
}
+TEST(AnonymousInAnonymousClosure1) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ v8::Handle<v8::Script> script = Compile(
+ "(function() {\n"
+ " (function() {\n"
+ " var a = 1;\n"
+ " return;\n"
+ " })();\n"
+ " var b = function() {\n"
+ " var c = 1;\n"
+ " return;\n"
+ " };\n"
+ "})();");
+ CheckFunctionName(script, "return", "");
+}
+
+
+TEST(AnonymousInAnonymousClosure2) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ v8::Handle<v8::Script> script = Compile(
+ "(function() {\n"
+ " (function() {\n"
+ " var a = 1;\n"
+ " return;\n"
+ " })();\n"
+ " var c = 1;\n"
+ "})();");
+ CheckFunctionName(script, "return", "");
+}
+
+
+TEST(NamedInAnonymousClosure) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ v8::Handle<v8::Script> script = Compile(
+ "var foo = function() {\n"
+ " (function named() {\n"
+ " var a = 1;\n"
+ " })();\n"
+ " var c = 1;\n"
+ " return;\n"
+ "};");
+ CheckFunctionName(script, "return", "foo");
+}
+
+
// See http://code.google.com/p/v8/issues/detail?id=380
TEST(Issue380) {
CcTest::InitializeVM();
« 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