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
This commit is contained in:
parent
b8154d9353
commit
a5c629cc11
@ -3435,6 +3435,7 @@ Expression* Parser::ParseLeftHandSideExpression(bool* ok) {
|
|||||||
top_scope_->DeclarationScope()->RecordEvalCall();
|
top_scope_->DeclarationScope()->RecordEvalCall();
|
||||||
}
|
}
|
||||||
result = factory()->NewCall(result, args, pos);
|
result = factory()->NewCall(result, args, pos);
|
||||||
|
if (fni_ != NULL) fni_->RemoveLastFunction();
|
||||||
break;
|
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
|
// See http://code.google.com/p/v8/issues/detail?id=380
|
||||||
TEST(Issue380) {
|
TEST(Issue380) {
|
||||||
CcTest::InitializeVM();
|
CcTest::InitializeVM();
|
||||||
|
Loading…
Reference in New Issue
Block a user