From f9765094cb23e3c2ee5afefe640d40cd5b026bf6 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 27 Jul 2016 11:05:35 -0400 Subject: [PATCH] Bug 1289467 part 2. Skip example codegen for methods/attributes on maplikes/setlikes/iterables that we auto-generate an implementation for. r=qdot --- dom/bindings/Codegen.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 95c028f5b090..8098c9bae261 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -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 ''