Bug 1550545, part 1 - Remove the unused isScriptable methods. r=nika
authorAndrew McCreight <continuation@gmail.com>
Thu, 09 May 2019 22:07:07 +0000
changeset 532135 11117f34b30ee7ae923c312ac655479215244af8
parent 532134 4e8c439818a32288a0f3466c73e15cdab54b05cb
child 532136 d9144ab0231e1cb13e8ff2aa886e3550a3334ca1
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [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 1 - Remove the unused isScriptable methods. r=nika Differential Revision: https://phabricator.services.mozilla.com/D30526
xpcom/idl-parser/xpidl/xpidl.py
--- a/xpcom/idl-parser/xpidl/xpidl.py
+++ b/xpcom/idl-parser/xpidl/xpidl.py
@@ -11,19 +11,16 @@ import sys
 import os.path
 import re
 from ply import lex
 from ply import yacc
 from collections import namedtuple
 
 """A type conforms to the following pattern:
 
-    def isScriptable(self):
-        'returns True or False'
-
     def nativeType(self, calltype):
         'returns a string representation of the native type
         calltype must be 'in', 'out', 'inout', or 'element'
 
 Interface members const/method/attribute conform to the following pattern:
 
     name = 'string'
 
@@ -119,19 +116,16 @@ class Builtin(object):
 
     def __init__(self, name, nativename, rustname, signed=False, maybeConst=False):
         self.name = name
         self.nativename = nativename
         self.rustname = rustname
         self.signed = signed
         self.maybeConst = maybeConst
 
-    def isScriptable(self):
-        return True
-
     def isPointer(self):
         """Check if this type is a pointer type - this will control how pointers act"""
         return self.nativename.endswith('*')
 
     def nativeType(self, calltype, shared=False, const=False):
         if self.name in ["string", "wstring"] and calltype == 'element':
             raise IDLError("Use string class types for string Array elements", self.location)
 
@@ -410,19 +404,16 @@ class Typedef(object):
 
     def resolve(self, parent):
         parent.setName(self)
         self.realtype = parent.getName(self.type, self.location)
 
         if not isinstance(self.realtype, (Builtin, Native, Typedef)):
             raise IDLError("Unsupported typedef target type", self.location)
 
-    def isScriptable(self):
-        return self.realtype.isScriptable()
-
     def nativeType(self, calltype):
         return "%s %s" % (self.name, '*' if 'out' in calltype else '')
 
     def rustType(self, calltype):
         if self.name == 'nsresult':
             return "%s::nserror::nsresult" % ('*mut ' if 'out' in calltype else '')
 
         return "%s%s" % ('*mut ' if 'out' in calltype else '', self.name)
@@ -451,19 +442,16 @@ class Forward(object):
                     break
             for i in xrange(i + 1, len(parent.productions)):
                 if hasattr(parent.productions[i], 'doccomments'):
                     parent.productions[i].doccomments[0:0] = self.doccomments
                     break
 
         parent.setName(self)
 
-    def isScriptable(self):
-        return True
-
     def nativeType(self, calltype):
         if calltype == 'element':
             return 'RefPtr<%s>' % self.name
         return "%s *%s" % (self.name, '*' if 'out' in calltype else '')
 
     def rustType(self, calltype):
         if rustBlacklistedForward(self.name):
             raise RustNoncompat("forward declaration %s is unsupported" % self.name)
@@ -519,28 +507,16 @@ class Native(object):
         return (self.name == other.name and
                 self.nativename == other.nativename and
                 self.modifier == other.modifier and
                 self.specialtype == other.specialtype)
 
     def resolve(self, parent):
         parent.setName(self)
 
-    def isScriptable(self):
-        if self.specialtype is None:
-            return False
-
-        if self.specialtype == 'promise':
-            return self.modifier == 'ptr'
-
-        if self.specialtype == 'nsid':
-            return self.modifier is not None
-
-        return self.modifier == 'ref'
-
     def isPtr(self, calltype):
         return self.modifier == 'ptr'
 
     def isRef(self, calltype):
         return self.modifier == 'ref'
 
     def nativeType(self, calltype, const=False, shared=False):
         if shared:
@@ -650,19 +626,16 @@ class WebIDL(object):
         if self.native is None:
             self.native = "mozilla::dom::%s" % self.name
         self.headerFile = config.get('headerFile')
         if self.headerFile is None:
             self.headerFile = self.native.replace('::', '/') + '.h'
 
         parent.setName(self)
 
-    def isScriptable(self):
-        return True  # All DOM objects are script exposed.
-
     def nativeType(self, calltype):
         if calltype == 'element':
             return 'RefPtr<%s>' % self.native
         return "%s *%s" % (self.native, '*' if 'out' in calltype else '')
 
     def rustType(self, calltype):
         # Just expose the type as a void* - we can't do any better.
         return "%s*const libc::c_void" % ('*mut ' if 'out' in calltype else '')
@@ -750,22 +723,16 @@ class Interface(object):
 
         # The number 250 is NOT arbitrary; this number is the maximum number of
         # stub entries defined in xpcom/reflect/xptcall/genstubs.pl
         # Do not increase this value without increasing the number in that
         # location, or you WILL cause otherwise unknown problems!
         if self.countEntries() > 250 and not self.attributes.builtinclass:
             raise IDLError("interface '%s' has too many entries" % self.name, self.location)
 
-    def isScriptable(self):
-        # NOTE: this is not whether *this* interface is scriptable... it's
-        # whether, when used as a type, it's scriptable, which is true of all
-        # interfaces.
-        return True
-
     def nativeType(self, calltype, const=False):
         if calltype == 'element':
             return 'RefPtr<%s>' % self.name
         return "%s%s *%s" % ('const ' if const else '', self.name,
                              '*' if 'out' in calltype else '')
 
     def rustType(self, calltype, const=False):
         if calltype == 'element':
@@ -978,19 +945,16 @@ class CEnum(object):
                 next_value = variant.value = variant.value(self.iface)
             else:
                 variant.value = next_value
             next_value += 1
 
     def count(self):
         return 0
 
-    def isScriptable(self):
-        return True
-
     def nativeType(self, calltype):
         if 'out' in calltype:
             return "%s::%s *" % (self.iface.name, self.basename)
         return "%s::%s " % (self.iface.name, self.basename)
 
     def rustType(self, calltype):
         raise RustNoncompat('cenums unimplemented')
 
@@ -1292,19 +1256,16 @@ class Param(object):
                                self.name)
 
 
 class LegacyArray(object):
     def __init__(self, basetype):
         self.type = basetype
         self.location = self.type.location
 
-    def isScriptable(self):
-        return self.type.isScriptable()
-
     def nativeType(self, calltype, const=False):
         if 'element' in calltype:
             raise IDLError("nested [array] unsupported", self.location)
 
         # For legacy reasons, we have to add a 'const ' to builtin pointer array
         # types. (`[array] in string` and `[array] in wstring` parameters)
         if calltype == 'in' and isinstance(self.type, Builtin) and self.type.isPointer():
             const = True
@@ -1328,19 +1289,16 @@ class Array(object):
 
     @property
     def name(self):
         return "Array<%s>" % self.type.name
 
     def resolve(self, idl):
         idl.getName(self.type, self.location)
 
-    def isScriptable(self):
-        return self.type.isScriptable()
-
     def nativeType(self, calltype):
         if calltype == 'legacyelement':
             raise IDLError("[array] Array<T> is unsupported", self.location)
 
         base = 'nsTArray<%s>' % self.type.nativeType('element')
         if 'out' in calltype:
             return '%s& ' % base
         elif 'in' == calltype: