Commit 60da267a authored by yurys@chromium.org's avatar yurys@chromium.org

Clear pending functions list in FuncNameInferrer when it closes

BUG=v8:2146
Review URL: https://chromiumcodereview.appspot.com/10414075

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11653 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 86c2a156
......@@ -88,6 +88,8 @@ class FuncNameInferrer : public ZoneObject {
void Leave() {
ASSERT(IsOpen());
names_stack_.Rewind(entries_stack_.RemoveLast());
if (entries_stack_.is_empty())
funcs_to_infer_.Clear();
}
private:
......
......@@ -400,3 +400,41 @@ TEST(AssignmentAndCall) {
// See MultipleAssignments test.
CheckFunctionName(script, "return 2", "Enclosing.Bar");
}
TEST(MethodAssignmentInAnonymousFunctionCall) {
InitializeVM();
v8::HandleScope scope;
v8::Handle<v8::Script> script = Compile(
"(function () {\n"
" var EventSource = function () { };\n"
" EventSource.prototype.addListener = function () {\n"
" return 2012;\n"
" };\n"
" this.PublicEventSource = EventSource;\n"
"})();");
CheckFunctionName(script, "return 2012", "EventSource.addListener");
}
TEST(ReturnAnonymousFunction) {
InitializeVM();
v8::HandleScope scope;
v8::Handle<v8::Script> script = Compile(
"(function() {\n"
" function wrapCode() {\n"
" return function () {\n"
" return 2012;\n"
" };\n"
" };\n"
" var foo = 10;\n"
" function f() {\n"
" return wrapCode();\n"
" }\n"
" this.ref = f;\n"
"})()");
script->Run();
CheckFunctionName(script, "return 2012", "");
}
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