mirror of
https://github.com/servo/servo.git
synced 2025-06-09 17:13:24 +00: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
|
||||
|
||||
declType = CGGeneric("JSVal")
|
||||
value = CGGeneric("${val}")
|
||||
if 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)
|
||||
templateBody = handleDefaultNull("${val}", "NullValue()")
|
||||
return handleOptional(templateBody, declType, isOptional)
|
||||
|
||||
if type.isObject():
|
||||
raise TypeError("Can't handle object arguments yet")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue