Commit a5c629cc authored by yurys@chromium.org's avatar yurys@chromium.org

Fix function name inferring inside closures

BUG=224884
R=loislo@chromium.org, yangguo@chromium.org

Review URL: https://codereview.chromium.org/16125007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14903 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b8154d93
......@@ -3435,6 +3435,7 @@ Expression* Parser::ParseLeftHandSideExpression(bool* ok) {
top_scope_->DeclarationScope()->RecordEvalCall();
}
result = factory()->NewCall(result, args, pos);
if (fni_ != NULL) fni_->RemoveLastFunction();
break;
}
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment