Right now we pass one location directly and the rest in a list. That's kinda hacky; we should just pass a list. Will wait for Peter to land unions before doing this...
Created attachment 636387 [details] [diff] [review] Make the WebIDLError constructor take a list of locations.
> class WebIDLError(Exception): >- def __init__(self, message, location, warning=False, extraLocations=): >+ def __init__(self, message, locations, warning=False): > self.message = message >- self.location = location >+ self.locations = [str(loc) for loc in locations] > self.warning = warning >- self.extraLocations = [str(loc) for loc in extraLocations] Hm, this may have been a good opportunity to use Python's *arg syntax: def __init__(self, message, *locations): There may be a way to shim the warning=False arg into there (although I don't see how that would work), but we could also have WebIDLError and WebIDLWarning as separate classes. OTOH the list is totally clear, and I don't think we have to mess with this further unless you want to. > class BuiltinLocation(object): > def __init__(self, text): >- self.msg = text >+ self.msg = text + "\n" To make sure I understood why you did this: You want BuiltinLocation to have an extra blank line to match Location's _pointerline marker?
> You want BuiltinLocation to have an extra blank line to match Location's _pointerline > marker? Hmm. I added it because stuff was ending up on the same line to my eyes, but yes, looks like that's the main effect.