09:58
<sideshowbarker>

WebIDL JS bindings-generation question: Any clues as to why JS bindings-generation code would try to generate a callable function for something defined in WebIDL as an attribute?

Specifically, if I’ve updated Document.idl to add this:

 [SameObject] readonly attribute FragmentDirective fragmentDirective;

And in some corresponding C++ sources, for Document.h, I’ve just done this:

 FragmentDirective fragmentDirective;

Then the bindings generator appears to be trying to do this:

RELEASE_AND_RETURN(throwScope, (toJS<IDLInterface<FragmentDirective>>(lexicalGlobalObject,
    *thisObject.globalObject(), throwScope, impl.fragmentDirective())));

And I realize that different bindings generators for different engines might do some different things — but I’d assume they should be doing basically the same thing (e.g., in this case, they’d all for some reason try to generate a callable fragmentDirective()).

13:03
<Domenic>
That looks to me like it's trying to call a C++ fragmentDirective() function. So to implement the getter for the fragmentDirective JavaScript property, you'd implement a C++ fragmentDirective() function. No real contradiction there.
13:50
<emilio>
sideshowbarker: Domenic is correct. Since JS attributes can generally run arbitrary code it is easier to generate code that calls a function unconditionally even when it's just a plain member or what not