Support nullable typed arrays in codegen

This commit is contained in:
Igor Matuszewski 2018-03-13 13:05:04 +01:00
parent e025bbb079
commit 6beb32e28e
3 changed files with 5 additions and 2 deletions

View file

@ -882,7 +882,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
else:
unwrapFailureCode = failureCode
typeName = type.name
typeName = type.unroll().name # unroll because it may be nullable
if isMember == "Union":
typeName = "Heap" + typeName
@ -902,7 +903,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
if isMember == "Union":
templateBody = "RootedTraceableBox::new(%s)" % templateBody
declType = CGGeneric("typedarray::%s" % type.name)
declType = CGGeneric("typedarray::%s" % typeName)
if type.nullable():
templateBody = "Some(%s)" % templateBody
declType = CGWrapper(declType, pre="Option<", post=">")