Skip to content

Commit

Permalink
Bug 1293001 - Part 3: Prevent virtual method overloading in xpidl wit…
Browse files Browse the repository at this point in the history
…h the parser, r=froydnj

MozReview-Commit-ID: 7nFq3wJtUoi
  • Loading branch information
mystor committed Aug 11, 2016
1 parent 6cd018c commit f6abe0f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions xpcom/idl-parser/xpidl/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,21 @@ def write_interface(iface, fd):
if iface.namemap is None:
raise Exception("Interface was not resolved.")

# Confirm that no names of methods will overload in this interface
names = set()
def record_name(name):
if name in names:
raise Exception("Unexpected overloaded virtual method %s in interface %s"
% (name, iface.name))
names.add(name)
for m in iface.members:
if type(m) == xpidl.Attribute:
record_name(attributeNativeName(m, getter=True))
if not m.readonly:
record_name(attributeNativeName(m, getter=False))
elif type(m) == xpidl.Method:
record_name(methodNativeName(m))

def write_const_decls(g):
fd.write(" enum {\n")
enums = []
Expand Down

0 comments on commit f6abe0f

Please sign in to comment.