mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Fix binding generation for overloaded functions with optionals and default values
This commit is contained in:
parent
33fa728d6e
commit
2974dae431
6 changed files with 14 additions and 7 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -1661,7 +1661,7 @@ dependencies = [
|
||||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hashglobe 0.1.0",
|
"hashglobe 0.1.0",
|
||||||
"mozjs 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mozjs 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo_arc 0.0.1",
|
"servo_arc 0.0.1",
|
||||||
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1811,7 +1811,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs"
|
name = "mozjs"
|
||||||
version = "0.1.7"
|
version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2536,7 +2536,7 @@ dependencies = [
|
||||||
"mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mozjs 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mozjs 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
"nonzero 0.0.1",
|
"nonzero 0.0.1",
|
||||||
|
@ -3794,7 +3794,7 @@ dependencies = [
|
||||||
"checksum mio 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9e965267d4d58496fc4f740e9861118367f13570cadf66316ed2c3f2f14d87c7"
|
"checksum mio 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9e965267d4d58496fc4f740e9861118367f13570cadf66316ed2c3f2f14d87c7"
|
||||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||||
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
|
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
|
||||||
"checksum mozjs 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a77c99a22091d3e6f7cd93caaf18bcb9ce5ff0a5d93c45aa73e443a447ab4296"
|
"checksum mozjs 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "722aeeec7049d03494ef79190343c2dea89c743c2d66acfb4555aef69dd77061"
|
||||||
"checksum mozjs_sys 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1e24df9f76502cd4459919098ec1ac3af75ce694ec5b8837aa91f69f2ad0eb"
|
"checksum mozjs_sys 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1e24df9f76502cd4459919098ec1ac3af75ce694ec5b8837aa91f69f2ad0eb"
|
||||||
"checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de"
|
"checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de"
|
||||||
"checksum mp4parse 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b81651f9ede53d59281b54c7eb51ae50a868ac4765dd3bdfbbc79ce3d8aca7a"
|
"checksum mp4parse 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b81651f9ede53d59281b54c7eb51ae50a868ac4765dd3bdfbbc79ce3d8aca7a"
|
||||||
|
|
|
@ -16,7 +16,7 @@ app_units = "0.5.5"
|
||||||
cssparser = "0.22.0"
|
cssparser = "0.22.0"
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
hashglobe = { path = "../hashglobe" }
|
hashglobe = { path = "../hashglobe" }
|
||||||
mozjs = { version = "0.1.7", features = ["promises"], optional = true }
|
mozjs = { version = "0.1.8", features = ["promises"], optional = true }
|
||||||
servo_arc = { path = "../servo_arc" }
|
servo_arc = { path = "../servo_arc" }
|
||||||
smallbitvec = "1.0.3"
|
smallbitvec = "1.0.3"
|
||||||
smallvec = "0.4"
|
smallvec = "0.4"
|
||||||
|
|
|
@ -51,7 +51,6 @@ hyper = "0.10"
|
||||||
hyper_serde = "0.7"
|
hyper_serde = "0.7"
|
||||||
image = "0.16"
|
image = "0.16"
|
||||||
ipc-channel = "0.9"
|
ipc-channel = "0.9"
|
||||||
mozjs = { version = "0.1.7", features = ["promises"]}
|
|
||||||
jstraceable_derive = {path = "../jstraceable_derive"}
|
jstraceable_derive = {path = "../jstraceable_derive"}
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
@ -62,6 +61,7 @@ metrics = {path = "../metrics"}
|
||||||
mitochondria = "1.1.2"
|
mitochondria = "1.1.2"
|
||||||
mime = "0.2.1"
|
mime = "0.2.1"
|
||||||
mime_guess = "1.8.0"
|
mime_guess = "1.8.0"
|
||||||
|
mozjs = { version = "0.1.8", features = ["promises"]}
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
net_traits = {path = "../net_traits"}
|
net_traits = {path = "../net_traits"}
|
||||||
nonzero = {path = "../nonzero"}
|
nonzero = {path = "../nonzero"}
|
||||||
|
|
|
@ -483,7 +483,8 @@ class CGMethodCall(CGThing):
|
||||||
else:
|
else:
|
||||||
# Just throw; we have no idea what we're supposed to
|
# Just throw; we have no idea what we're supposed to
|
||||||
# do with this.
|
# do with this.
|
||||||
caseBody.append(CGGeneric("return Throw(cx, NS_ERROR_XPC_BAD_CONVERT_JS);"))
|
caseBody.append(CGGeneric("throw_internal_error(cx, \"Could not convert JavaScript argument\");\n"
|
||||||
|
"return false;"))
|
||||||
|
|
||||||
argCountCases.append(CGCase(str(argCount),
|
argCountCases.append(CGCase(str(argCount),
|
||||||
CGList(caseBody, "\n")))
|
CGList(caseBody, "\n")))
|
||||||
|
@ -5591,6 +5592,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
||||||
'js::JSCLASS_RESERVED_SLOTS_MASK',
|
'js::JSCLASS_RESERVED_SLOTS_MASK',
|
||||||
'js::JS_CALLEE',
|
'js::JS_CALLEE',
|
||||||
'js::error::throw_type_error',
|
'js::error::throw_type_error',
|
||||||
|
'js::error::throw_internal_error',
|
||||||
'js::jsapi::AutoIdVector',
|
'js::jsapi::AutoIdVector',
|
||||||
'js::jsapi::Call',
|
'js::jsapi::Call',
|
||||||
'js::jsapi::CallArgs',
|
'js::jsapi::CallArgs',
|
||||||
|
|
|
@ -601,6 +601,8 @@ impl TestBindingMethods for TestBinding {
|
||||||
fn PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>) {}
|
fn PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>) {}
|
||||||
fn PassOptionalNullableUsvstringWithNonNullDefault(&self, _: Option<USVString>) {}
|
fn PassOptionalNullableUsvstringWithNonNullDefault(&self, _: Option<USVString>) {}
|
||||||
// fn PassOptionalNullableEnumWithNonNullDefault(self, _: Option<TestEnum>) {}
|
// fn PassOptionalNullableEnumWithNonNullDefault(self, _: Option<TestEnum>) {}
|
||||||
|
fn PassOptionalOverloaded(&self, a: &TestBinding, _: u32, _: u32) -> DomRoot<TestBinding> { DomRoot::from_ref(a) }
|
||||||
|
fn PassOptionalOverloaded_(&self, _: &Blob, _: u32) { }
|
||||||
|
|
||||||
fn PassVariadicBoolean(&self, _: Vec<bool>) {}
|
fn PassVariadicBoolean(&self, _: Vec<bool>) {}
|
||||||
fn PassVariadicBooleanAndDefault(&self, _: bool, _: Vec<bool>) {}
|
fn PassVariadicBooleanAndDefault(&self, _: bool, _: Vec<bool>) {}
|
||||||
|
|
|
@ -409,6 +409,9 @@ interface TestBinding {
|
||||||
// void passOptionalNullableEnumWithNonNullDefault(optional TestEnum? arg = "foo");
|
// void passOptionalNullableEnumWithNonNullDefault(optional TestEnum? arg = "foo");
|
||||||
// void passOptionalNullableUnionWithNonNullDefault(optional (HTMLElement or long)? arg = 7);
|
// void passOptionalNullableUnionWithNonNullDefault(optional (HTMLElement or long)? arg = 7);
|
||||||
// void passOptionalNullableUnion2WithNonNullDefault(optional (Event or DOMString)? data = "foo");
|
// void passOptionalNullableUnion2WithNonNullDefault(optional (Event or DOMString)? data = "foo");
|
||||||
|
TestBinding passOptionalOverloaded(TestBinding arg0, optional unsigned long arg1 = 0,
|
||||||
|
optional unsigned long arg2 = 0);
|
||||||
|
void passOptionalOverloaded(Blob arg0, optional unsigned long arg1 = 0);
|
||||||
|
|
||||||
void passVariadicBoolean(boolean... args);
|
void passVariadicBoolean(boolean... args);
|
||||||
void passVariadicBooleanAndDefault(optional boolean arg = true, boolean... args);
|
void passVariadicBooleanAndDefault(optional boolean arg = true, boolean... args);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue