Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: src/js/i18n.js

Issue 2109223002: [intl] Clean up function name handling in AddBoundMethod (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/js/macros.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
// -------------------------------------------------------------------
« no previous file with comments | « no previous file | src/js/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698