Reviewers: Yang,

Message:
Hi Yang,

I'm not fully sure about this feature.

Bound functions are frequently used. However they look not very nice.
Adding them a human-friendly name could help.

Description:
Give bound function name for aesthetic matters

Please review this at https://codereview.chromium.org/23190013/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/v8natives.js
  M test/mjsunit/function-names.js


Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 76eeac6a58f98552c433103302590d543793b65e..a669890c63b3555224afc750a6a1fcbf7b1dd020 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1728,7 +1728,7 @@ function FunctionBind(this_arg) { // Length is 1.
   if (!IS_SPEC_FUNCTION(this)) {
     throw new $TypeError('Bind must be called on a function');
   }
-  var boundFunction = function () {
+  var boundFunction = function BoundFunction() {
     // Poison .arguments and .caller, but is otherwise not detectable.
     "use strict";
// This function must not use any object literals (Object, Array, RegExp),
Index: test/mjsunit/function-names.js
diff --git a/test/mjsunit/function-names.js b/test/mjsunit/function-names.js
index 5ed0b794e8f988216a817345a2c247733c513e7d..fbc27f4de914d55de264af3259c93648df94001b 100644
--- a/test/mjsunit/function-names.js
+++ b/test/mjsunit/function-names.js
@@ -131,3 +131,10 @@ var globalFunctions = [
     "eval"];

 TestFunctionNames(this, globalFunctions);
+
+// Bound function.
+var boundFunction = (function Some(){}).bind(this);
+print(boundFunction.name);
+print(boundFunction);
+assertTrue(boundFunction.name.indexOf("bound") != -1);
+


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to