Bug 177457 - [WebIDL] Factor out IsExceptionOr check from toJS/toJSNewlyCreated signature
Summary: [WebIDL] Factor out IsExceptionOr check from toJS/toJSNewlyCreated signature
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-25 12:48 PDT by Sam Weinig
Modified: 2017-09-27 12:16 PDT (History)
3 users (show)

See Also:


Attachments
Patch (7.70 KB, patch)
2017-09-25 12:49 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
This also works... (616 bytes, patch)
2017-09-25 16:52 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2017-09-25 12:48:20 PDT
[WebIDL] Factor out IsExceptionOr check from toJS/toJSNewlyCreated signature
Comment 1 Sam Weinig 2017-09-25 12:49:38 PDT
Created attachment 321727 [details]
Patch
Comment 2 youenn fablet 2017-09-25 14:01:31 PDT
Comment on attachment 321727 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=321727&action=review

> Source/WebCore/bindings/js/JSDOMConvertBase.h:91
> +struct IsExceptionOr : public std::integral_constant<bool, WTF::IsTemplate<std::decay_t<T>, ExceptionOr>::value> { };

Would the following work?
template<typename T> using IsExceptionOr = std::integral_constant...
Comment 3 WebKit Commit Bot 2017-09-25 16:27:06 PDT
Comment on attachment 321727 [details]
Patch

Clearing flags on attachment: 321727

Committed r222480: <http://trac.webkit.org/changeset/222480>
Comment 4 WebKit Commit Bot 2017-09-25 16:27:08 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Sam Weinig 2017-09-25 16:52:08 PDT
Created attachment 321767 [details]
This also works...
Comment 6 Sam Weinig 2017-09-25 16:53:27 PDT
(In reply to youenn fablet from comment #2)
> Comment on attachment 321727 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=321727&action=review
> 
> > Source/WebCore/bindings/js/JSDOMConvertBase.h:91
> > +struct IsExceptionOr : public std::integral_constant<bool, WTF::IsTemplate<std::decay_t<T>, ExceptionOr>::value> { };
> 
> Would the following work?
> template<typename T> using IsExceptionOr = std::integral_constant...

That would work too (posted a patch with it above). I have not found a good feel for when to use using vs. inheritance in situations like these. Is there a reason to prefer one over the other here?
Comment 7 youenn fablet 2017-09-25 16:59:30 PDT
'using' seems a bit more readable/closer to the intent than 'struct' as we probably do not want to specialize the struct or add any method to it.
Mostly a style thingy I guess
Comment 8 Radar WebKit Bug Importer 2017-09-27 12:16:59 PDT
<rdar://problem/34692938>