Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: lib/dom/scripts/systemhtml.py

Issue 10702202: Introduce TypeRegistry class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 10
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 750
751 if events or interface.id in _html_explicit_event_classes: 751 if events or interface.id in _html_explicit_event_classes:
752 return True, events 752 return True, events
753 else: 753 else:
754 return False, None 754 return False, None
755 755
756 def IsPrivate(self, name): 756 def IsPrivate(self, name):
757 return name.startswith('_') 757 return name.startswith('_')
758 758
759 def DartType(self, idl_type): 759 def DartType(self, idl_type):
760 type_info = GetIDLTypeInfo(idl_type) 760 type_info = TypeRegistry().TypeInfo(idl_type)
761 return self._HTMLInterfaceName(type_info.dart_type()) 761 return self._HTMLInterfaceName(type_info.dart_type())
762 762
763 class HtmlSystem(System): 763 class HtmlSystem(System):
764 764
765 def __init__(self, templates, database, emitters, output_dir): 765 def __init__(self, options):
766 super(HtmlSystem, self).__init__( 766 super(HtmlSystem, self).__init__(options)
767 templates, database, emitters, output_dir) 767 self._shared = HtmlSystemShared(self._database)
768 self._shared = HtmlSystemShared(database)
769 768
770 class HtmlInterfacesSystem(HtmlSystem): 769 class HtmlInterfacesSystem(HtmlSystem):
771 770
772 def __init__(self, templates, database, emitters, output_dir, backend): 771 def __init__(self, options, backend):
773 super(HtmlInterfacesSystem, self).__init__( 772 super(HtmlInterfacesSystem, self).__init__(options)
774 templates, database, emitters, output_dir)
775 self._backend = backend 773 self._backend = backend
776 self._dart_interface_file_paths = [] 774 self._dart_interface_file_paths = []
777 self._elements_factory_emitter = None 775 self._elements_factory_emitter = None
778 776
779 def ProcessInterface(self, interface): 777 def ProcessInterface(self, interface):
780 HtmlDartInterfaceGenerator(self, interface).Generate() 778 HtmlDartInterfaceGenerator(self, interface).Generate()
781 779
782 def ProcessCallback(self, interface, info): 780 def ProcessCallback(self, interface, info):
783 """Generates a typedef for the callback interface.""" 781 """Generates a typedef for the callback interface."""
784 interface_name = interface.id 782 interface_name = interface.id
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 lambda type_name: self._NarrowInputType(type_name))) 1347 lambda type_name: self._NarrowInputType(type_name)))
1350 1348
1351 def _HasCustomImplementation(self, member_name): 1349 def _HasCustomImplementation(self, member_name):
1352 member_name = '%s.%s' % (self._html_interface_name, member_name) 1350 member_name = '%s.%s' % (self._html_interface_name, member_name)
1353 return member_name in _js_custom_members 1351 return member_name in _js_custom_members
1354 1352
1355 # ------------------------------------------------------------------------------ 1353 # ------------------------------------------------------------------------------
1356 1354
1357 class HtmlFrogSystem(HtmlSystem): 1355 class HtmlFrogSystem(HtmlSystem):
1358 1356
1359 def __init__(self, templates, database, emitters, output_dir): 1357 def __init__(self, options):
1360 super(HtmlFrogSystem, self).__init__( 1358 super(HtmlFrogSystem, self).__init__(options)
1361 templates, database, emitters, output_dir)
1362 1359
1363 def ImplementationGenerator(self, interface): 1360 def ImplementationGenerator(self, interface):
1364 return HtmlFrogClassGenerator(self, interface) 1361 return HtmlFrogClassGenerator(self, interface)
1365 1362
1366 def GenerateLibraries(self, dart_files): 1363 def GenerateLibraries(self, dart_files):
1367 self._GenerateLibFile( 1364 self._GenerateLibFile(
1368 'html_frog.darttemplate', 1365 'html_frog.darttemplate',
1369 os.path.join(self._output_dir, 'html_frog.dart'), 1366 os.path.join(self._output_dir, 'html_frog.dart'),
1370 dart_files) 1367 dart_files)
1371 1368
(...skipping 18 matching lines...) Expand all
1390 Collect(database.GetInterface(parent.type.id), 1387 Collect(database.GetInterface(parent.type.id),
1391 seen, collected) 1388 seen, collected)
1392 1389
1393 inheritance_closure = {} 1390 inheritance_closure = {}
1394 for interface in database.GetInterfaces(): 1391 for interface in database.GetInterfaces():
1395 seen = set() 1392 seen = set()
1396 collected = [] 1393 collected = []
1397 Collect(interface, seen, collected) 1394 Collect(interface, seen, collected)
1398 inheritance_closure[interface.id] = collected 1395 inheritance_closure[interface.id] = collected
1399 return inheritance_closure 1396 return inheritance_closure
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698