Bug 1034923 - Make AccEventGen.py code generator generate classes with private destructors. r=tbsaunde

This commit is contained in:
Andrew McCreight 2014-07-28 10:15:58 -07:00
parent c595fb5556
commit 6a63277739

View File

@ -68,27 +68,19 @@ def print_header_file(fd, conf):
initializers = [] initializers = []
for a in attributes: for a in attributes:
initializers.append("m%s(a%s)" % (firstCap(a.name), firstCap(a.name))) initializers.append("m%s(a%s)" % (firstCap(a.name), firstCap(a.name)))
fd.write(" %s\n {}\n" % ", ".join(initializers)) fd.write(" %s\n {}\n\n" % ", ".join(initializers))
fd.write(" ~%s() {}\n\n" % classname)
fd.write(" NS_DECL_CYCLE_COLLECTING_ISUPPORTS\n") fd.write(" NS_DECL_CYCLE_COLLECTING_ISUPPORTS\n")
fd.write(" NS_DECL_CYCLE_COLLECTION_CLASS(%s)\n" % (classname)) fd.write(" NS_DECL_CYCLE_COLLECTION_CLASS(%s)\n" % (classname))
for iface in filter(lambda i: i.name != "nsISupports", baseinterfaces): for iface in filter(lambda i: i.name != "nsISupports", baseinterfaces):
fd.write(" NS_DECL_%s\n" % iface.name.upper()) fd.write(" NS_DECL_%s\n" % iface.name.upper())
fd.write("private:\n") fd.write("\nprivate:\n")
fd.write(" ~%s() {}\n\n" % classname)
for a in attributes: for a in attributes:
fd.write(" %s\n" % attributeVariableTypeAndName(a)) fd.write(" %s\n" % attributeVariableTypeAndName(a))
fd.write("};\n\n") fd.write("};\n\n")
fd.write("namespace mozilla {\n"
"template<>\n"
"struct HasDangerousPublicDestructor<%s>\n"
"{\n"
" static const bool value = true;\n"
"};\n"
"}\n" % classname)
fd.write("#endif\n") fd.write("#endif\n")
def interfaceAttributeTypes(idl): def interfaceAttributeTypes(idl):