Index: client/dom/scripts/dartgenerator.py |
diff --git a/client/dom/scripts/dartgenerator.py b/client/dom/scripts/dartgenerator.py |
index acff25a3a3adfcb94f860b2b7ed5d5664169e9d6..813443a2a9b620a15fb25b29b0049fd91730fc85 100755 |
--- a/client/dom/scripts/dartgenerator.py |
+++ b/client/dom/scripts/dartgenerator.py |
@@ -449,6 +449,10 @@ class DartGenerator(object): |
continue |
interfaces.append(interface) |
+ # TODO(sra): Use this list of exception names to generate information to |
+ # tell Frog which exceptions can be passed from JS to Dart code. |
+ exceptions = self._CollectExceptions(interfaces) |
+ |
# Render all interfaces into Dart and save them in files. |
for interface in self._PreOrderInterfaces(interfaces): |
@@ -630,6 +634,21 @@ class DartGenerator(object): |
return result; |
+ def _CollectExceptions(self, interfaces): |
+ """Returns the names of all exception classes raised.""" |
+ exceptions = set() |
+ for interface in interfaces: |
+ for attribute in interface.attributes: |
+ if attribute.get_raises: |
+ exceptions.add(attribute.get_raises.id) |
+ if attribute.set_raises: |
+ exceptions.add(attribute.set_raises.id) |
+ for operation in interface.operations: |
+ if operation.raises: |
+ exceptions.add(operation.raises.id) |
+ return exceptions |
+ |
+ |
def Flush(self): |
"""Write out all pending files.""" |
_logger.info('Flush...') |