示例#1
0
    def _process_method_argument(self, method, language):
        """Process a XPCOM method description
        @param method {xpcom.xpt.Method} The method to process
        @returns (args, returntype)
            args {list of str} The arguments' citdl
            returntype {str} The return type citdl
        """
        args = []
        returntype = None
        param_count = 1
        for param in method.params:
            t = xpt.TypeDescriber(param.type_desc[0], param)
            if t.tag in (xpt.T_INTERFACE, ):
                arg_type = t.Describe()
            elif t.tag in (xpt.T_ARRAY, ):
                arg_type = "Array"
            else:
                arg_type = self._LANG_TYPE_FROM_XPT_TAG\
                               .get(language, {})\
                               .get(t.tag, "unknown")

            if param.IsIn():
                args.append("in %s" % (arg_type))
                param_count += 1
            elif param.IsRetval():
                if t.tag in (xpt.T_INTERFACE, ):
                    returntype = "Components.interfaces.%s" % (arg_type)
                else:
                    returntype = arg_type
            elif param.IsOut():
                args.append("out %s" % (arg_type))
                param_count += 1
        return args, returntype
示例#2
0
 def process_xpcom_arguments(m):
     args = []
     returntype = None
     param_count = 1
     for param in m.params:
         t = xpt.TypeDescriber(param.type_desc[0], param)
         if t.tag in (xpt.T_INTERFACE, ):
             arg_type = t.Describe()
         elif t.tag in (xpt.T_ARRAY, ):
             arg_type = "Array"
         else:
             arg_type = javascript_type_from_xpt_tag.get(t.tag, "unknown")
 
         if param.IsIn():
             args.append("in %s" % (arg_type))
             param_count += 1
         elif param.IsRetval():
             if t.tag in (xpt.T_INTERFACE, ):
                 returntype = "Components.interfaces.%s" % (arg_type)
             else:
                 returntype = arg_type
         elif param.IsOut():
             args.append("out %s" % (arg_type))
             param_count += 1
     return args, returntype