mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Don't generate union conversion functions for object variants.
This commit is contained in:
parent
bbb5c8436e
commit
e481e8934a
1 changed files with 6 additions and 2 deletions
|
@ -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}")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue