Both sequence<T> and record<K, V> must be able to handle cases where T and V are nullable.
At the moment, "void foo(sequence<long?> arg)" generates the following excerpt:
Vector<int32_t> arg;
arg = toImplArray<Vector<int32_t>>(info[0], 1, info.GetIsolate(), exceptionState);
which will coerce null values into numbers instead of just accepting them.
Similarly, "void foo(record<DOMString, long?> arg)" generates:
Vector<std::pair<String, int32_t>> arg;
arg = NativeValueTraits<IDLRecord<IDLString, IDLLong>>::nativeValue(info.GetIsolate(), info[0], exceptionState);
which has the same issue.
Passing types back to JavaScript is also a problem, as we don't even have a ToV8() overload for blink::Nullable.
Comment 1 by raphael....@intel.com
, Mar 20 2017Hmm, fixing this requires some wider changes, as the code for attribute getters and setters is not very Nullable-friendly at the moment. attribute byte? byteOrNullAttribute; generates a getter like this one: bool isNull = false; int8_t cppValue(impl->byteOrNullAttribute(isNull)); if (isNull) { v8SetReturnValueNull(info); return; } v8SetReturnValueInt(info, cppValue); and a setter like this: int8_t cppValue = NativeValueTraits<IDLByte>::nativeValue(info.GetIsolate(), v8Value, exceptionState, NormalConversion); if (exceptionState.hadException()) return; impl->setByteOrNullAttribute(cppValue); instead of using Nullable<>, so the actual implementations would need to be changed as well.