feat: Implement JSValue::new_array and other small clean up#17
Conversation
This patch implements `JSValue::new_array`, which creates an array pre- filled with items of kind `JSValue`.
This patch implements a new constructor: `JSValue::new_inner` that replaces a manual struct construction.
This patch implements `From<JSValue>` for `JSException`. It simplifies the code a little bit.
943a07e to
ff58b54
Compare
waywardmonkeys
left a comment
There was a problem hiding this comment.
I'm tempted to just merge this as is, but I wanted to bring up some thoughts I had about JSException since this touches some of that.
I think what you have is fine for now, but should be revisited in that area comprehensively. I think the JSException should be storing a JSObject instead which is an actual exception. There's some other accessors that need to be added.
I was looking at https://github.com/WebKit/WebKit/blob/f8937a35f02f3c64eb02529b413b65c33d65e565/Source/JavaScriptCore/API/glib/JSCException.cpp for some ideas on what things should look like in this regard.
But as I said ... I think I'll land this and then we can revisit.
What do you think?
|
I would prefer to see this PR merged, and to open an issue to land the ideas about |
|
Sure thing. And I was out for a couple of hours (I'm GMT+5), but I'll be around to merge stuff and so on for the next 3-4 hours now. |
|
Perfect, thanks! I'm on UTC+2. Maybe we can talk in a Matrix room or a similar network? |
Built on top of #16.This PR should ideally be reviewed commit-by-commit for a better experience.
Basically, it adds
JSValue::new_array.In addition, it adds
JSValue::new_innerwhich simplify the code greatly.Finally, it implements
From<JSValue>forJSException, which adds another simplification of the code.