Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constructor property to Object #1403

Merged
merged 1 commit into from
Mar 28, 2019

Conversation

RReverser
Copy link
Member

Fixes #1361, although shortly after adding this I realised that to be useful wasm-bindgen also needs to expose a way to get constructor of any type as a Function, but not sure what is the best way to expose that yet...

Something like autogenerated fn as_constructor() { ... } on any #[wasm_bindgen] imported type maybe?

Anyway, that can probably be done in a separate PR.

@alexcrichton
Copy link
Contributor

Looks good to me, thanks!

I think that with Deref you can already do Object::constructor(&any_wasm_bindgen_type), right?

@alexcrichton alexcrichton merged commit 1121393 into rustwasm:master Mar 28, 2019
@RReverser RReverser deleted the expose-constructor branch March 28, 2019 14:46
@RReverser
Copy link
Member Author

I think that with Deref you can already do Object::constructor(&any_wasm_bindgen_type), right?

Well you can do even any_value.constructor(), yes, but the problem is that you can't do comparisons like any_value.constructor() == Array::constructor_as_a_function_or_something_like_that() because there is no method to get a constructor of a statically defined type.

@RReverser
Copy link
Member Author

Created a separate issue for tracking #1406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants