You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The old servo/rust-bindgen supported them by appending 1, 2, 3, ... to each overload, but the new one does not.
I'll make a fix.
Test case (this should generate bindings for each overload):
structJSContext;
structReadOnlyCompileOptions;
structSourceBufferHolder;
structAutoObjectVector;
structchar16_t;
#defineJS_PUBLIC_API(t) t
namespaceJS {
structMutableHandleValue {};
/** * Evaluate the given source buffer in the scope of the current global of cx.*/externJS_PUBLIC_API(bool)
Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options,
SourceBufferHolder& srcBuf, JS::MutableHandleValue rval);
/** * As above, but providing an explicit scope chain. envChain must not include * the global object on it; that's implicit. It needs to contain the other * objects that should end up on the script's scope chain.*/externJS_PUBLIC_API(bool)
Evaluate(JSContext* cx, AutoObjectVector& envChain, const ReadOnlyCompileOptions& options,
SourceBufferHolder& srcBuf, JS::MutableHandleValue rval);
/** * Evaluate the given character buffer in the scope of the current global of cx.*/externJS_PUBLIC_API(bool)
Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options,
constchar16_t* chars, int length, JS::MutableHandleValue rval);
/** * As above, but providing an explicit scope chain. envChain must not include * the global object on it; that's implicit. It needs to contain the other * objects that should end up on the script's scope chain.*/externJS_PUBLIC_API(bool)
Evaluate(JSContext* cx, AutoObjectVector& envChain, const ReadOnlyCompileOptions& options,
constchar16_t* chars, int length, JS::MutableHandleValue rval);
/** * Evaluate the given byte buffer in the scope of the current global of cx.*/externJS_PUBLIC_API(bool)
Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options,
constchar* bytes, int length, JS::MutableHandleValue rval);
/** * Evaluate the given file in the scope of the current global of cx.*/externJS_PUBLIC_API(bool)
Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options,
constchar* filename, JS::MutableHandleValue rval);
} // namespace JS
But we only get bindings for the first:
/* automatically generated by rust-bindgen */extern"C"{/** * Evaluate the given source buffer in the scope of the current global of cx. */#[link_name ="_ZN2JS8EvaluateEP9JSContextRK22ReadOnlyCompileOptionsR18SourceBufferHolderNS_18MutableHandleValueE"]pubfnEvaluate(cx:*mutJSContext,options:*constReadOnlyCompileOptions,srcBuf:*mutSourceBufferHolder,rval:MutableHandleValue)
-> bool;}
The text was updated successfully, but these errors were encountered:
Add support for bindings to overloaded functions
This commit (re)adds support for generating bindings to overloaded
functions. First, we use the symbol name instead of the canonical name
when checking if we have already generated bindings for a given
function. Second, we add a map from canonical names to number of times
we have generated a function with that canonical name. We increment this
number every time we generate a function. When the number is greater
than zero, we append it to the function name so that overloaded
functions get a unique Rust symbol.
Fixes#239
r? @emilio
The old
servo/rust-bindgen
supported them by appending 1, 2, 3, ... to each overload, but the new one does not.I'll make a fix.
Test case (this should generate bindings for each overload):
But we only get bindings for the first:
The text was updated successfully, but these errors were encountered: