Index: src/js/i18n.js |
diff --git a/src/js/i18n.js b/src/js/i18n.js |
index 6c769a74ab79e2ea0c08737111d0e69163ed5ae0..48a6d4d7b5816a5940182ce003b2e8f4def11cd0 100644 |
--- a/src/js/i18n.js |
+++ b/src/js/i18n.js |
@@ -94,33 +94,34 @@ function AddBoundMethod(obj, methodName, implementation, length, type) { |
if (IS_UNDEFINED(this[internalName])) { |
var boundMethod; |
if (IS_UNDEFINED(length) || length === 2) { |
- boundMethod = (x, y) => implementation(this, x, y); |
+ boundMethod = ANONYMOUS_FUNCTION((x, y) => implementation(this, x, y)); |
} else if (length === 1) { |
- boundMethod = x => implementation(this, x); |
+ boundMethod = ANONYMOUS_FUNCTION(x => implementation(this, x)); |
} else { |
- boundMethod = (...args) => { |
- // DateTimeFormat.format needs to be 0 arg method, but can stil |
- // receive optional dateValue param. If one was provided, pass it |
+ boundMethod = ANONYMOUS_FUNCTION((...args) => { |
+ // DateTimeFormat.format needs to be 0 arg method, but can still |
+ // receive an optional dateValue param. If one was provided, pass it |
// along. |
if (args.length > 0) { |
return implementation(this, args[0]); |
} else { |
return implementation(this); |
} |
- } |
+ }); |
} |
- // TODO(littledan): Once function name reform is shipped, remove the |
- // following line and wrap the boundMethod definition in an anonymous |
- // function macro. |
- %FunctionSetName(boundMethod, '__bound' + methodName + '__'); |
- %FunctionRemovePrototype(boundMethod); |
%SetNativeFlag(boundMethod); |
this[internalName] = boundMethod; |
} |
return this[internalName]; |
}; |
- InstallGetter(obj.prototype, methodName, getter, DONT_ENUM); |
+ InstallGetter(obj.prototype, methodName, getter, DONT_ENUM, |
+ true /* skipSetFunctionName */); |
+ |
+ // All functions returned from AddBoundMethod share a single |
+ // SharedFunctionInfo, so we have to set the "name" property |
+ // on the JSFunction itself. |
+ %object_define_property(getter, "name", {value: "get " + methodName}); |
Dan Ehrenberg
2016/06/29 21:10:12
The name should be configurable, but seems to be d
adamk
2016/06/29 22:53:10
For pre-existing properties (as "name" is here), d
adamk
2016/06/29 23:19:15
I now take a different approach. Let me know if yo
|
} |
// ------------------------------------------------------------------- |