mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1289467 part 2. Skip example codegen for methods/attributes on maplikes/setlikes/iterables that we auto-generate an implementation for. r=qdot
This commit is contained in:
parent
f7ef79ba7f
commit
f9765094cb
@ -8565,7 +8565,7 @@ class CGSpecializedGetter(CGAbstractStaticMethod):
|
||||
CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args)
|
||||
|
||||
def definition_body(self):
|
||||
if self.attr.maplikeOrSetlike:
|
||||
if self.attr.isMaplikeOrSetlikeAttr():
|
||||
# If the interface is maplike/setlike, there will be one getter
|
||||
# method for the size property of the backing object. Due to having
|
||||
# to unpack the backing object from the slot, this requires its own
|
||||
@ -13923,6 +13923,16 @@ class CGExampleMethod(CGNativeMember):
|
||||
breakAfter=breakAfter,
|
||||
variadicIsSequence=True)
|
||||
|
||||
def declare(self, cgClass):
|
||||
assert self.member.isMethod()
|
||||
# We skip declaring ourselves if this is a maplike/setlike/iterable
|
||||
# method, because those get implemented automatically by the binding
|
||||
# machinery, so the implementor of the interface doesn't have to worry
|
||||
# about it.
|
||||
if self.member.isMaplikeOrSetlikeOrIterableMethod():
|
||||
return ''
|
||||
return CGNativeMember.declare(self, cgClass);
|
||||
|
||||
def define(self, cgClass):
|
||||
return ''
|
||||
|
||||
@ -13936,6 +13946,16 @@ class CGExampleGetter(CGNativeMember):
|
||||
descriptor.getExtendedAttributes(attr,
|
||||
getter=True))
|
||||
|
||||
def declare(self, cgClass):
|
||||
assert self.member.isAttr()
|
||||
# We skip declaring ourselves if this is a maplike/setlike attr (in
|
||||
# practice, "size"), because those get implemented automatically by the
|
||||
# binding machinery, so the implementor of the interface doesn't have to
|
||||
# worry about it.
|
||||
if self.member.isMaplikeOrSetlikeAttr():
|
||||
return ''
|
||||
return CGNativeMember.declare(self, cgClass);
|
||||
|
||||
def define(self, cgClass):
|
||||
return ''
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user