Bug 461770: Fix line numbers for methods and attributes and other miscellaneous bits in the idl parser. r=bsmedberg
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 28 Oct 2008 09:04:41 +0000
changeset 21000 a4575acb14917a2dce868fac103be6c4529f9d3e
parent 20999 833d54c1b774f269e4f2a911820b707d23d5d71a
child 21001 7de88087e15bb5cb03fdb3e4abee3143553e9b53
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs461770
milestone1.9.1b2pre
Bug 461770: Fix line numbers for methods and attributes and other miscellaneous bits in the idl parser. r=bsmedberg
xpcom/idl-parser/xpidl.py
--- a/xpcom/idl-parser/xpidl.py
+++ b/xpcom/idl-parser/xpidl.py
@@ -532,16 +532,17 @@ class Interface(object):
 
         return c.getValue()
 
 class InterfaceAttributes(object):
     uuid = None
     scriptable = False
     function = False
     deprecated = False
+    noscript = False
 
     def setuuid(self, value):
         self.uuid = value.lower()
 
     def setscriptable(self):
         self.scriptable = True
 
     def setfunction(self):
@@ -612,28 +613,32 @@ class ConstMember(object):
         if not isinstance(basetype, Builtin) or not basetype.maybeConst:
             raise IDLError("const may only be a short or long type, not %s" % self.type, self.location)
 
         self.basetype = basetype
 
     def getValue(self):
         return self.value(self.iface)
 
+    def __str__(self):
+        return "\tconst %s %s = %s\n" % (self.type, self.name, self.getValue())
+
 class Attribute(object):
     kind = 'attribute'
     noscript = False
     notxpcom = False
+    readonly = False
+    binaryname = None
 
     def __init__(self, type, name, attlist, readonly, location, doccomments):
         self.type = type
         self.name = name
         self.attlist = attlist
         self.readonly = readonly
         self.location = location
-        self.binaryname = None
         self.doccomments = doccomments
 
         for name, value, aloc in attlist:
             if name == 'binaryname':
                 if value is None:
                     raise IDLError("binaryname attribute requires a value",
                                    aloc)
 
@@ -1120,31 +1125,31 @@ class IDLParser(object):
             doccomments = p[2]
         else:
             doccomments = p.slice[3].doccomments
 
         p[0] = Attribute(type=p[4],
                          name=p[5],
                          attlist=p[1]['attlist'],
                          readonly=p[2] is not None,
-                         location=self.getLocation(p, 1),
+                         location=self.getLocation(p, 3),
                          doccomments=doccomments)
 
     def p_member_method(self, p):
         """member : attributes IDENTIFIER IDENTIFIER '(' paramlist ')' raises ';'"""
         if 'doccomments' in p[1]:
             doccomments = p[1]['doccomments']
         else:
             doccomments = p.slice[2].doccomments
 
         p[0] = Method(type=p[2],
                       name=p[3],
                       attlist=p[1]['attlist'],
                       paramlist=p[5],
-                      location=self.getLocation(p, 1),
+                      location=self.getLocation(p, 3),
                       doccomments=doccomments,
                       raises=p[7])
 
     def p_paramlist(self, p):
         """paramlist : param moreparams
                      | """
         if len(p) == 1:
             p[0] = []