mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1033100. Fix event codegen to compile when an event has a sequence-of-non-null-interface-type member. r=smaug
This commit is contained in:
parent
828e5a160f
commit
f890ca7741
@ -13799,7 +13799,27 @@ class CGEventMethod(CGNativeMember):
|
||||
cgClass.descriptor.interface).identifier.name == "Event":
|
||||
continue
|
||||
name = CGDictionary.makeMemberName(m.identifier.name)
|
||||
members += "e->%s = %s.%s;\n" % (name, self.args[1].name, name)
|
||||
if m.type.isSequence():
|
||||
# For sequences we may not be able to do a simple
|
||||
# assignment because the underlying types may not match.
|
||||
# For example, the argument can be a
|
||||
# Sequence<OwningNonNull<SomeInterface>> while our
|
||||
# member is an nsTArray<nsRefPtr<SomeInterface>>. So
|
||||
# use AppendElements, which is actually a template on
|
||||
# the incoming type on nsTArray and does the right thing
|
||||
# for this case.
|
||||
target = name;
|
||||
source = "%s.%s" % (self.args[1].name, name)
|
||||
sequenceCopy = "e->%s.AppendElements(%s);\n"
|
||||
if m.type.nullable():
|
||||
sequenceCopy = CGIfWrapper(
|
||||
CGGeneric(sequenceCopy),
|
||||
"!%s.IsNull()" % source).define()
|
||||
target += ".SetValue()"
|
||||
source += ".Value()"
|
||||
members += sequenceCopy % (target, source)
|
||||
else:
|
||||
members += "e->%s = %s.%s;\n" % (name, self.args[1].name, name)
|
||||
if m.type.isAny() or m.type.isObject() or m.type.isSpiderMonkeyInterface():
|
||||
holdJS = "mozilla::HoldJSObjects(e.get());\n"
|
||||
iface = iface.parent
|
||||
|
Loading…
Reference in New Issue
Block a user