Bug 1550545, part 2 - Pass arguments to mk_method bundled up. r=nika
authorAndrew McCreight <continuation@gmail.com>
Thu, 09 May 2019 22:07:25 +0000
changeset 473319 d9144ab0231e1cb13e8ff2aa886e3550a3334ca1
parent 473318 11117f34b30ee7ae923c312ac655479215244af8
child 473320 8095cb5a0964634f1905cafb714a33a8c7fbbd5f
push id35993
push usernbeleuzu@mozilla.com
push dateFri, 10 May 2019 02:54:27 +0000
treeherdermozilla-central@a42caa9f04fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1550545
milestone68.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 1550545, part 2 - Pass arguments to mk_method bundled up. r=nika Differential Revision: https://phabricator.services.mozilla.com/D30527
xpcom/idl-parser/xpidl/jsonxpt.py
--- a/xpcom/idl-parser/xpidl/jsonxpt.py
+++ b/xpcom/idl-parser/xpidl/jsonxpt.py
@@ -120,36 +120,34 @@ def mk_param(type, in_=0, out=0, optiona
         'flags': flags(
             ('in', in_),
             ('out', out),
             ('optional', optional),
         ),
     }
 
 
-def mk_method(name, params, getter=0, setter=0, notxpcom=0,
-              hidden=0, optargc=0, context=0, hasretval=0,
-              symbol=0):
+def mk_method(method, params, getter=0, setter=0, optargc=0, hasretval=0, symbol=0):
     return {
-        'name': name,
+        'name': method.name,
         # NOTE: We don't include any return value information here, as we'll
         # never call the methods if they're marked notxpcom, and all xpcom
         # methods return the same type (nsresult).
         # XXX: If we ever use these files for other purposes than xptcodegen we
         # may want to write that info.
         'params': params,
         'flags': flags(
             ('getter', getter),
             ('setter', setter),
-            ('notxpcom', notxpcom),
-            ('hidden', hidden),
+            ('notxpcom', method.notxpcom),
+            ('hidden', method.noscript),
             ('optargc', optargc),
-            ('jscontext', context),
+            ('jscontext', method.implicit_jscontext),
             ('hasretval', hasretval),
-            ('symbol', symbol),
+            ('symbol', method.symbol),
         ),
     }
 
 
 def attr_param_idx(p, m, attr):
     if hasattr(p, attr) and getattr(p, attr):
         for i, param in enumerate(m.params):
             if param.name == getattr(p, attr):
@@ -193,39 +191,33 @@ def build_interface(iface):
                 optional=p.optional,
             ))
 
         hasretval = len(m.params) > 0 and m.params[-1].retval
         if not m.notxpcom and m.realtype.name != 'void':
             hasretval = True
             params.append(mk_param(get_type(m.realtype, 'out'), out=1))
 
-        methods.append(mk_method(
-            m.name, params, notxpcom=m.notxpcom, hidden=m.noscript,
-            optargc=m.optional_argc, context=m.implicit_jscontext,
-            hasretval=hasretval, symbol=m.symbol))
+        methods.append(mk_method(m, params, optargc=m.optional_argc,
+                                 hasretval=hasretval))
 
     def build_attr(a):
         assert a.realtype.name != 'void'
         # Write the getter
         getter_params = []
         if not a.notxpcom:
             getter_params.append(mk_param(get_type(a.realtype, 'out'), out=1))
-        methods.append(mk_method(a.name, getter_params, getter=1,
-                                 notxpcom=a.notxpcom, hidden=a.noscript,
-                                 context=a.implicit_jscontext, hasretval=1,
-                                 symbol=a.symbol))
+
+        methods.append(mk_method(a, getter_params, getter=1, hasretval=1))
 
         # And maybe the setter
         if not a.readonly:
             param = mk_param(get_type(a.realtype, 'in'), in_=1)
-            methods.append(mk_method(a.name, [param], setter=1,
-                                     notxpcom=a.notxpcom, hidden=a.noscript,
-                                     context=a.implicit_jscontext,
-                                     symbol=a.symbol))
+            methods.append(mk_method(a, [param], setter=1))
+
 
     for member in iface.members:
         if isinstance(member, xpidl.ConstMember):
             build_const(member)
         elif isinstance(member, xpidl.Attribute):
             build_attr(member)
         elif isinstance(member, xpidl.Method):
             build_method(member)