aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index bd8232b2a75..37cab821d92 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1032,8 +1032,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
if type.isAny():
assert not isEnforceRange and not isClamp
- declType = ""
- default = ""
if isMember == "Dictionary":
# TODO: Need to properly root dictionaries
# https://github.com/servo/servo/issues/6381
@@ -1047,17 +1045,18 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
default = "UndefinedValue()"
else:
raise TypeError("Can't handle non-null, non-undefined default value here")
- else:
- declType = CGGeneric("HandleValue")
+ return handleOptional("${val}", declType, default)
- if defaultValue is None:
- default = None
- elif isinstance(defaultValue, IDLNullValue):
- default = "HandleValue::null()"
- elif isinstance(defaultValue, IDLUndefinedValue):
- default = "HandleValue::undefined()"
- else:
- raise TypeError("Can't handle non-null, non-undefined default value here")
+ declType = CGGeneric("HandleValue")
+
+ if defaultValue is None:
+ default = None
+ elif isinstance(defaultValue, IDLNullValue):
+ default = "HandleValue::null()"
+ elif isinstance(defaultValue, IDLUndefinedValue):
+ default = "HandleValue::undefined()"
+ else:
+ raise TypeError("Can't handle non-null, non-undefined default value here")
return handleOptional("${val}", declType, default)