emscripten-core / emscripten-core/emscripten
Support for interface inheritance in Web IDL
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.36 (518d9fea335f7cd2b5771e43df76e0535c6df5dd)
clang version 17.0.0 (https://github.com/llvm/llvm-project 5084abbea933b1a510556726a9e226b5ae22f19f)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: E:\Emscripten-Offical\emsdk\upstream\bin
I tried to use idl fragment like this:
interface A {
void f();
void g();
};
interface B : A {
void f();
void g(DOMString x);
};
in the .idl file, then I parsed the .idl file using command line "python tools/webidl_binder.py test.idl glue". And No errors were reported.
I noticed that in the generated "glue.js" file, B's prototype is not A.prototype, but WrapperObject.prototype, like this:
// B
/** @suppress {undefinedVars, duplicate} @this{Object} */function B() { throw "cannot construct a B, no constructor in IDL" }
B.prototype = Object.create(WrapperObject.prototype);
B.prototype.constructor = B;
B.prototype.__class__ = B;
B.__cache__ = {};
Module['B'] = B;
Does this mean that Emscripten does not currently support "An interface can be defined to inherit from another interface." as described in www.w3.org website? And Why isn't it supported?
link: https://www.w3.org/2017/08/webidl-fpwd-draft.html#idl-interfaces
Contributor guide
Assessment
This issue has not been assessed yet.