Pass isMember to getJSToNativeConversionInfo for unions.

Also includes a documentation update for isMember.
This commit is contained in:
Ms2ger 2017-02-14 13:41:06 +01:00
parent 2a50427b1e
commit 7d24cd7752

View file

@ -581,11 +581,9 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
If isDefinitelyObject is True, that means we know the value If isDefinitelyObject is True, that means we know the value
isObject() and we have no need to recheck that. isObject() and we have no need to recheck that.
if isMember is True, we're being converted from a property of some isMember is `False`, "Dictionary", "Union" or "Variadic", and affects
JS object, not from an actual method argument, so we can't rely on whether this function returns code suitable for an on-stack rooted binding
our jsval being rooted or outliving us in any way. Any caller or suitable for storing in an appropriate larger structure.
passing true needs to ensure that it is handled correctly in
typeIsSequenceOrHasSequenceMember.
invalidEnumValueFatal controls whether an invalid enum value conversion invalidEnumValueFatal controls whether an invalid enum value conversion
attempt will throw (if true) or simply return without doing anything (if attempt will throw (if true) or simply return without doing anything (if
@ -4059,7 +4057,8 @@ def getUnionTypeTemplateVars(type, descriptorProvider):
info = getJSToNativeConversionInfo( info = getJSToNativeConversionInfo(
type, descriptorProvider, failureCode="return Ok(None);", type, descriptorProvider, failureCode="return Ok(None);",
exceptionCode='return Err(());', exceptionCode='return Err(());',
isDefinitelyObject=True) isDefinitelyObject=True,
isMember="Union")
template = info.template template = info.template
jsConversion = string.Template(template).substitute({ jsConversion = string.Template(template).substitute({