Bug 729256 - Make xpidl.py error out on multiple-method function interfaces. r=bsmedberg
authorNathan Froyd <froydnj@mozilla.com>
Mon, 27 Feb 2012 18:57:28 -0500
changeset 91155 13bed8cc97503d645a24102f546215480fc9d54f
parent 91154 484b8331a1016704c77eeb15c9b6ae5b7fbbcd67
child 91156 7db039c3f3e26c463671c8d2e4e22cb2266b9bd6
push id136
push userlsblakk@mozilla.com
push dateFri, 01 Jun 2012 02:39:32 +0000
treeherdermozilla-release@7ebf7352c959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs729256
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 729256 - Make xpidl.py error out on multiple-method function interfaces. r=bsmedberg
xpcom/idl-parser/xpidl.py
--- a/xpcom/idl-parser/xpidl.py
+++ b/xpcom/idl-parser/xpidl.py
@@ -526,16 +526,25 @@ class Interface(object):
         # doc comments incorrectly. This is quirks-mode extraordinaire!
         if parent.hasName(self.name):
             for member in self.members:
                 if hasattr(member, 'doccomments'):
                     member.doccomments[0:0] = self.doccomments
                     break
             self.doccomments = parent.getName(self.name, None).doccomments
 
+        if self.attributes.function:
+            has_method = False
+            for member in self.members:
+                if member.kind is 'method':
+                    if has_method:
+                        raise IDLError("interface '%s' has multiple methods, but marked 'function'" % self.name, self.location)
+                    else:
+                        has_method = True
+
         parent.setName(self)
         if self.base is not None:
             realbase = parent.getName(self.base, self.location)
             if realbase.kind != 'interface':
                 raise IDLError("interface '%s' inherits from non-interface type '%s'" % (self.name, self.base), self.location)
 
             if self.attributes.scriptable and not realbase.attributes.scriptable:
                 print >>sys.stderr, IDLError("interface '%s' is scriptable but derives from non-scriptable '%s'" % (self.name, self.base), self.location, warning=True)