diff options
author | Josh Matthews <josh@joshmatthews.net> | 2017-05-26 12:40:50 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2017-09-25 16:10:57 -0400 |
commit | e481e8934a0c37a4b1eba19862ff732ec9bf19c9 (patch) | |
tree | 9bf008e46b816264155122622669d8d1c4a940c2 /components/script/dom/bindings/codegen/CodegenRust.py | |
parent | bbb5c8436edb89235fe030e8dc965b9bef43c071 (diff) | |
download | servo-e481e8934a0c37a4b1eba19862ff732ec9bf19c9.tar.gz servo-e481e8934a0c37a4b1eba19862ff732ec9bf19c9.zip |
Don't generate union conversion functions for object variants.
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 9a98848108b..208d4b1d923 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -4313,10 +4313,14 @@ class CGUnionConversionStruct(CGThing): returnType = "Result<Option<%s>, ()>" % templateVars["typeName"] jsConversion = templateVars["jsConversion"] + # Any code to convert to Object is unused, since we're already converting + # from an Object value. + if t.name == 'Object': + return CGGeneric('') + return CGWrapper( CGIndenter(jsConversion, 4), - # TryConvertToObject is unused, but not generating it while generating others is tricky. - pre="#[allow(dead_code)] unsafe fn TryConvertTo%s(cx: *mut JSContext, value: HandleValue) -> %s {\n" + pre="unsafe fn TryConvertTo%s(cx: *mut JSContext, value: HandleValue) -> %s {\n" % (t.name, returnType), post="\n}") |