konsoletyper / teavm

Compiles Java bytecode to JavaScript, WebAssembly and C
https://teavm.org
Apache License 2.0
2.55k stars 262 forks source link

Support `instanceof` in JSO #808

Closed konsoletyper closed 2 months ago

konsoletyper commented 8 months ago

Currently, instanceof with JSO object on right side won't differentiate particular types. For classes, however, this is possible. Perhaps, additional annotations are required for various purposes:

  1. To 'erase' JS type, so that it behaves like old-fashioned JS object (or JSO interface)
  2. To declare some other name or location of JS type
  3. To declare that some type is a primitive type, so typeof value == 'type' should be generated instead of value instanceof type.