Closed Bug 1306540 Opened 3 years ago Closed 3 years ago
Enum String Index to JSAPI signature convention .
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from bug 1289050 comment #43) > > template<bool InvalidValueFatal> > > inline int > > FindEnumStringIndex(JSContext* cx, JS::Handle<JS::Value> v, const EnumEntry* values, > > const char* type, const char* sourceDescription, bool* ok) > > It would be good to file a followup bug to convert this to the JSAPI > signature convention of returning false on failure, filling the index in an > outparam. This is in a bunch of JSAPI-using code, and the oddball > convention makes the code harder to read -- plus you have oddities like > being forced to set an outparam *and* return a value that should never be > examined (like |return 0| when ToString fails is a perfectly reasonable > return value, but you have to know the caller will never look at it because > of the |*ok = false;| to know it's fine).
Assignee: nobody → jwalden+bmo
Status: NEW → ASSIGNED
Comment on attachment 8796427 [details] [diff] [review] Patch r=me
Attachment #8796427 - Flags: review?(peterv) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/83fd09630531 FindEnumStringIndex should follow JSAPI interface conventions. r=bz
You need to log in before you can comment on or make changes to this bug.