Bug 681740 - xpidl.py does not resolve references to consts in superinterfaces. r=bsmedberg
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 25 Aug 2011 10:24:58 -0700
changeset 77294 844bfd249e6a42b860c7cbf2c48c41cf356ce928
parent 77293 20e301ec28a0569379c03f42bfeb375a2638a014
child 77295 a80fe3a6586f0b4123b562731dfa5e4afb7d7ba9
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs681740
milestone9.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 681740 - xpidl.py does not resolve references to consts in superinterfaces. r=bsmedberg
xpcom/idl-parser/xpidl.py
xpcom/idl-parser/xpidlyacc.py
--- a/xpcom/idl-parser/xpidl.py
+++ b/xpcom/idl-parser/xpidl.py
@@ -560,17 +560,23 @@ class Interface(object):
         if self.members is None:
             l.append("\tincomplete type\n")
         else:
             for m in self.members:
                 l.append(str(m))
         return "".join(l)
 
     def getConst(self, name, location):
-        c = self.namemap.get(name, location)
+        # The constant may be in a base class
+        iface = self
+        while name not in iface.namemap and iface is not None:
+            iface = self.idl.getName(self.base, self.location)
+        if iface is None:
+            raise IDLError("cannot find symbol '%s'" % name, c.location)
+        c = iface.namemap.get(name, location)
         if c.kind != 'const':
             raise IDLError("symbol '%s' is not a constant", c.location)
 
         return c.getValue()
 
     def needsJSTypes(self):
         for m in self.members:
             if m.kind == "attribute" and m.type == "jsval":
--- a/xpcom/idl-parser/xpidlyacc.py
+++ b/xpcom/idl-parser/xpidlyacc.py
@@ -21,65 +21,65 @@ del _lr_action_items
 _lr_goto = { }
 for _k, _v in _lr_goto_items.items():
    for _x,_y in zip(_v[0],_v[1]):
        if not _x in _lr_goto: _lr_goto[_x] = { }
        _lr_goto[_x][_k] = _y
 del _lr_goto_items
 _lr_productions = [
   ("S' -> idlfile","S'",1,None,None,None),
-  ('idlfile -> productions','idlfile',1,'p_idlfile','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1055),
-  ('productions -> <empty>','productions',0,'p_productions_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1059),
-  ('productions -> CDATA productions','productions',2,'p_productions_cdata','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1063),
-  ('productions -> INCLUDE productions','productions',2,'p_productions_include','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1068),
-  ('productions -> interface productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1073),
-  ('productions -> typedef productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1074),
-  ('productions -> native productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1075),
-  ('typedef -> TYPEDEF IDENTIFIER IDENTIFIER ;','typedef',4,'p_typedef','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1080),
-  ('native -> attributes NATIVE IDENTIFIER afternativeid ( NATIVEID ) ;','native',8,'p_native','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1087),
-  ('afternativeid -> <empty>','afternativeid',0,'p_afternativeid','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1094),
-  ('anyident -> IDENTIFIER','anyident',1,'p_anyident','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1100),
-  ('anyident -> CONST','anyident',1,'p_anyident','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1101),
-  ('attributes -> [ attlist ]','attributes',3,'p_attributes','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1106),
-  ('attributes -> <empty>','attributes',0,'p_attributes','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1107),
-  ('attlist -> attribute','attlist',1,'p_attlist_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1115),
-  ('attlist -> attribute , attlist','attlist',3,'p_attlist_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1119),
-  ('attribute -> anyident attributeval','attribute',2,'p_attribute','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1124),
-  ('attributeval -> ( IDENTIFIER )','attributeval',3,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1128),
-  ('attributeval -> ( IID )','attributeval',3,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1129),
-  ('attributeval -> <empty>','attributeval',0,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1130),
-  ('interface -> attributes INTERFACE IDENTIFIER ifacebase ifacebody ;','interface',6,'p_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1135),
-  ('ifacebody -> { members }','ifacebody',3,'p_ifacebody','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1164),
-  ('ifacebody -> <empty>','ifacebody',0,'p_ifacebody','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1165),
-  ('ifacebase -> : IDENTIFIER','ifacebase',2,'p_ifacebase','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1170),
-  ('ifacebase -> <empty>','ifacebase',0,'p_ifacebase','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1171),
-  ('members -> <empty>','members',0,'p_members_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1176),
-  ('members -> member members','members',2,'p_members_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1180),
-  ('member -> CDATA','member',1,'p_member_cdata','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1185),
-  ('member -> CONST IDENTIFIER IDENTIFIER = number ;','member',6,'p_member_const','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1189),
-  ('number -> NUMBER','number',1,'p_number_decimal','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1197),
-  ('number -> HEXNUM','number',1,'p_number_hex','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1202),
-  ('number -> IDENTIFIER','number',1,'p_number_identifier','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1207),
-  ('number -> ( number )','number',3,'p_number_paren','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1213),
-  ('number -> - number','number',2,'p_number_neg','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1217),
-  ('number -> number + number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1222),
-  ('number -> number - number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1223),
-  ('number -> number * number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1224),
-  ('number -> number LSHIFT number','number',3,'p_number_shift','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1235),
-  ('number -> number RSHIFT number','number',3,'p_number_shift','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1236),
-  ('number -> number | number','number',3,'p_number_bitor','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1245),
-  ('member -> attributes optreadonly ATTRIBUTE IDENTIFIER IDENTIFIER ;','member',6,'p_member_att','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1251),
-  ('member -> attributes IDENTIFIER IDENTIFIER ( paramlist ) raises ;','member',8,'p_member_method','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1267),
-  ('paramlist -> param moreparams','paramlist',2,'p_paramlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1282),
-  ('paramlist -> <empty>','paramlist',0,'p_paramlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1283),
-  ('moreparams -> <empty>','moreparams',0,'p_moreparams_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1291),
-  ('moreparams -> , param moreparams','moreparams',3,'p_moreparams_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1295),
-  ('param -> attributes paramtype IDENTIFIER IDENTIFIER','param',4,'p_param','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1300),
-  ('paramtype -> IN','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1308),
-  ('paramtype -> INOUT','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1309),
-  ('paramtype -> OUT','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1310),
-  ('optreadonly -> READONLY','optreadonly',1,'p_optreadonly','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1314),
-  ('optreadonly -> <empty>','optreadonly',0,'p_optreadonly','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1315),
-  ('raises -> RAISES ( idlist )','raises',4,'p_raises','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1322),
-  ('raises -> <empty>','raises',0,'p_raises','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1323),
-  ('idlist -> IDENTIFIER','idlist',1,'p_idlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1330),
-  ('idlist -> IDENTIFIER , idlist','idlist',3,'p_idlist_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1334),
+  ('idlfile -> productions','idlfile',1,'p_idlfile','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1088),
+  ('productions -> <empty>','productions',0,'p_productions_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1092),
+  ('productions -> CDATA productions','productions',2,'p_productions_cdata','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1096),
+  ('productions -> INCLUDE productions','productions',2,'p_productions_include','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1101),
+  ('productions -> interface productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1106),
+  ('productions -> typedef productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1107),
+  ('productions -> native productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1108),
+  ('typedef -> TYPEDEF IDENTIFIER IDENTIFIER ;','typedef',4,'p_typedef','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1113),
+  ('native -> attributes NATIVE IDENTIFIER afternativeid ( NATIVEID ) ;','native',8,'p_native','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1120),
+  ('afternativeid -> <empty>','afternativeid',0,'p_afternativeid','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1127),
+  ('anyident -> IDENTIFIER','anyident',1,'p_anyident','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1133),
+  ('anyident -> CONST','anyident',1,'p_anyident','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1134),
+  ('attributes -> [ attlist ]','attributes',3,'p_attributes','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1139),
+  ('attributes -> <empty>','attributes',0,'p_attributes','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1140),
+  ('attlist -> attribute','attlist',1,'p_attlist_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1148),
+  ('attlist -> attribute , attlist','attlist',3,'p_attlist_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1152),
+  ('attribute -> anyident attributeval','attribute',2,'p_attribute','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1157),
+  ('attributeval -> ( IDENTIFIER )','attributeval',3,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1161),
+  ('attributeval -> ( IID )','attributeval',3,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1162),
+  ('attributeval -> <empty>','attributeval',0,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1163),
+  ('interface -> attributes INTERFACE IDENTIFIER ifacebase ifacebody ;','interface',6,'p_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1168),
+  ('ifacebody -> { members }','ifacebody',3,'p_ifacebody','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1197),
+  ('ifacebody -> <empty>','ifacebody',0,'p_ifacebody','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1198),
+  ('ifacebase -> : IDENTIFIER','ifacebase',2,'p_ifacebase','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1203),
+  ('ifacebase -> <empty>','ifacebase',0,'p_ifacebase','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1204),
+  ('members -> <empty>','members',0,'p_members_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1209),
+  ('members -> member members','members',2,'p_members_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1213),
+  ('member -> CDATA','member',1,'p_member_cdata','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1218),
+  ('member -> CONST IDENTIFIER IDENTIFIER = number ;','member',6,'p_member_const','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1222),
+  ('number -> NUMBER','number',1,'p_number_decimal','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1230),
+  ('number -> HEXNUM','number',1,'p_number_hex','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1235),
+  ('number -> IDENTIFIER','number',1,'p_number_identifier','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1240),
+  ('number -> ( number )','number',3,'p_number_paren','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1246),
+  ('number -> - number','number',2,'p_number_neg','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1250),
+  ('number -> number + number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1255),
+  ('number -> number - number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1256),
+  ('number -> number * number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1257),
+  ('number -> number LSHIFT number','number',3,'p_number_shift','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1268),
+  ('number -> number RSHIFT number','number',3,'p_number_shift','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1269),
+  ('number -> number | number','number',3,'p_number_bitor','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1278),
+  ('member -> attributes optreadonly ATTRIBUTE IDENTIFIER IDENTIFIER ;','member',6,'p_member_att','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1284),
+  ('member -> attributes IDENTIFIER IDENTIFIER ( paramlist ) raises ;','member',8,'p_member_method','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1300),
+  ('paramlist -> param moreparams','paramlist',2,'p_paramlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1315),
+  ('paramlist -> <empty>','paramlist',0,'p_paramlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1316),
+  ('moreparams -> <empty>','moreparams',0,'p_moreparams_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1324),
+  ('moreparams -> , param moreparams','moreparams',3,'p_moreparams_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1328),
+  ('param -> attributes paramtype IDENTIFIER IDENTIFIER','param',4,'p_param','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1333),
+  ('paramtype -> IN','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1341),
+  ('paramtype -> INOUT','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1342),
+  ('paramtype -> OUT','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1343),
+  ('optreadonly -> READONLY','optreadonly',1,'p_optreadonly','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1347),
+  ('optreadonly -> <empty>','optreadonly',0,'p_optreadonly','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1348),
+  ('raises -> RAISES ( idlist )','raises',4,'p_raises','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1355),
+  ('raises -> <empty>','raises',0,'p_raises','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1356),
+  ('idlist -> IDENTIFIER','idlist',1,'p_idlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1363),
+  ('idlist -> IDENTIFIER , idlist','idlist',3,'p_idlist_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1367),
 ]