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
This commit is contained in:
parent
86c2a15691
commit
60da267ab6
@ -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", "");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user