зеркало из https://github.com/mozilla/gecko-dev.git
Bug 676649 - Include jspubtd.h automagically when necessary in IDL files; r=khuey
This commit is contained in:
Родитель
b5d390cce8
Коммит
2fcad809a4
|
@ -178,6 +178,10 @@ include = """
|
|||
#endif
|
||||
"""
|
||||
|
||||
jspubtd_include = """
|
||||
#include "jspubtd.h"
|
||||
"""
|
||||
|
||||
header_end = """/* For IDL files that don't want to include root IDL files. */
|
||||
#ifndef NS_NO_VTABLE
|
||||
#define NS_NO_VTABLE
|
||||
|
@ -207,6 +211,9 @@ def print_header(idl, fd, filename):
|
|||
fd.write('\n')
|
||||
fd.write(include % {'basename': idl_basename(inc.filename)})
|
||||
|
||||
if idl.needsJSTypes():
|
||||
fd.write(jspubtd_include)
|
||||
|
||||
fd.write('\n')
|
||||
fd.write(header_end)
|
||||
|
||||
|
|
|
@ -322,6 +322,12 @@ class IDL(object):
|
|||
if p.kind == 'include':
|
||||
yield p
|
||||
|
||||
def needsJSTypes(self):
|
||||
for p in self.productions:
|
||||
if p.kind == 'interface' and p.needsJSTypes():
|
||||
return True
|
||||
return False
|
||||
|
||||
class CDATA(object):
|
||||
kind = 'cdata'
|
||||
_re = re.compile(r'\n+')
|
||||
|
@ -552,6 +558,14 @@ class Interface(object):
|
|||
|
||||
return c.getValue()
|
||||
|
||||
def needsJSTypes(self):
|
||||
for m in self.members:
|
||||
if m.kind == "attribute" and m.type == "jsval":
|
||||
return True
|
||||
if m.kind == "method" and m.needsJSTypes():
|
||||
return True
|
||||
return False
|
||||
|
||||
class InterfaceAttributes(object):
|
||||
uuid = None
|
||||
scriptable = False
|
||||
|
@ -815,6 +829,15 @@ class Method(object):
|
|||
for p in self.params]),
|
||||
raises)
|
||||
|
||||
def needsJSTypes(self):
|
||||
if self.implicit_jscontext:
|
||||
return True
|
||||
for p in self.params:
|
||||
t = p.realtype
|
||||
if isinstance(t, Native) and t.specialtype == "jsval":
|
||||
return True
|
||||
return False
|
||||
|
||||
class Param(object):
|
||||
size_is = None
|
||||
iid_is = None
|
||||
|
|
Загрузка…
Ссылка в новой задаче