mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Use handleOptional for the 'any' conversion.
This commit is contained in:
parent
b264c65f2e
commit
1e2be02eb8
1 changed files with 2 additions and 7 deletions
|
@ -757,13 +757,8 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
assert not isEnforceRange and not isClamp
|
assert not isEnforceRange and not isClamp
|
||||||
|
|
||||||
declType = CGGeneric("JSVal")
|
declType = CGGeneric("JSVal")
|
||||||
value = CGGeneric("${val}")
|
templateBody = handleDefaultNull("${val}", "NullValue()")
|
||||||
if isOptional:
|
return handleOptional(templateBody, declType, isOptional)
|
||||||
declType = CGWrapper(declType, pre="Option<", post=">")
|
|
||||||
value = CGWrapper(value, pre="Some(", post=")")
|
|
||||||
|
|
||||||
templateBody = handleDefaultNull(value.define(), "NullValue()")
|
|
||||||
return (templateBody, declType, isOptional, "None" if isOptional else None)
|
|
||||||
|
|
||||||
if type.isObject():
|
if type.isObject():
|
||||||
raise TypeError("Can't handle object arguments yet")
|
raise TypeError("Can't handle object arguments yet")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue