Benjamin Smedberg wrote:
Taras Glek wrote:
Benjamin Smedberg wrote:
Taras Glek wrote:

I don't think it's right. Correct way would be to use prototypes and
instanceOf. File a bug if you agree.
Can I switch() on instanceof? There's also the slight problem that I'm
mixing dehydra types and lazy treehydra reflections in this code, so I need
to be able to have the lazy converter use the same API.
you can switch on .constructor

Can you provide a code example? I'm not clear how you'd switch on .constructor, especially with two different codebases providing the same general object types.
It's just a matter of doing new FooNode(), instead of {} or new Object() and something similar on the C side.
Currently dehydra types don't have prototypes anyway, do they? Are you suggesting that I could add prototypes to these objects and add the .kind property to the prototype instead of the type object itself?
Right. I think I need to start using prototypes when constructing objects in C, the rest is going to be easy.

I'm attaching an example of the two ways of checking for object type that we'd be using in dehydra.

Taras

Attachment: test.js
Description: JavaScript source

_______________________________________________
Dev-static-analysis mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-static-analysis

Reply via email to