Allow union types to be used as return values

This commit is contained in:
Manish Goregaokar 2014-06-07 23:44:21 +05:30
parent 1184b500e5
commit 7843b7b317
4 changed files with 28 additions and 8 deletions

View file

@ -1002,6 +1002,11 @@ def getRetvalDeclarationForType(returnType, descriptorProvider):
if returnType.nullable():
result = CGWrapper(result, pre="Option<", post=">")
return result
if returnType.isUnion():
result = CGGeneric('%s::%s' % (returnType.unroll().name, returnType.unroll().name))
if returnType.nullable():
result = CGWrapper(result, pre="Option<", post=">")
return result
if returnType.isAny():
return CGGeneric("JSVal")
if returnType.isObject() or returnType.isSpiderMonkeyInterface():