| Index: test/cctest/test-func-name-inference.cc
|
| ===================================================================
|
| --- test/cctest/test-func-name-inference.cc (revision 11629)
|
| +++ test/cctest/test-func-name-inference.cc (working copy)
|
| @@ -400,3 +400,41 @@
|
| // 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", "");
|
| +}
|
|
|