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

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

Issue 10388084: Better support for the case of typed arrays inheriting from other typed arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 from systemfrog import * 9 from systemfrog import *
10 from systeminterface import * 10 from systeminterface import *
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 self._dart_interface_file_paths.append(dart_interface_file_path) 598 self._dart_interface_file_paths.append(dart_interface_file_path)
599 599
600 dart_interface_code = self._emitters.FileEmitter(dart_interface_file_path) 600 dart_interface_code = self._emitters.FileEmitter(dart_interface_file_path)
601 601
602 template_file = 'interface_%s.darttemplate' % interface_name 602 template_file = 'interface_%s.darttemplate' % interface_name
603 template = self._templates.TryLoad(template_file) 603 template = self._templates.TryLoad(template_file)
604 if not template: 604 if not template:
605 template = self._templates.Load('interface.darttemplate') 605 template = self._templates.Load('interface.darttemplate')
606 606
607 return HtmlDartInterfaceGenerator( 607 return HtmlDartInterfaceGenerator(
608 interface, dart_interface_code, 608 self, interface, dart_interface_code,
609 template, 609 template,
610 common_prefix, super_interface_name, 610 common_prefix, super_interface_name,
611 source_filter, self, self._shared) 611 source_filter, self._shared)
612 612
613 def ProcessCallback(self, interface, info): 613 def ProcessCallback(self, interface, info):
614 """Generates a typedef for the callback interface.""" 614 """Generates a typedef for the callback interface."""
615 interface_name = interface.id 615 interface_name = interface.id
616 file_path = self._FilePathForDartInterface(interface_name) 616 file_path = self._FilePathForDartInterface(interface_name)
617 self._ProcessCallback(interface, info, file_path) 617 self._ProcessCallback(interface, info, file_path)
618 618
619 def GenerateLibraries(self, lib_dir): 619 def GenerateLibraries(self, lib_dir):
620 pass 620 pass
621 621
622 622
623 def _FilePathForDartInterface(self, interface_name): 623 def _FilePathForDartInterface(self, interface_name):
624 """Returns the file path of the Dart interface definition.""" 624 """Returns the file path of the Dart interface definition."""
625 # TODO(jmesserly): is this the right path 625 # TODO(jmesserly): is this the right path
626 return os.path.join(self._output_dir, 'html', 'interface', 626 return os.path.join(self._output_dir, 'html', 'interface',
627 '%s.dart' % interface_name) 627 '%s.dart' % interface_name)
628 628
629 # ------------------------------------------------------------------------------ 629 # ------------------------------------------------------------------------------
630 630
631 # TODO(jmesserly): inheritance is probably not the right way to factor this long 631 # TODO(jmesserly): inheritance is probably not the right way to factor this long
632 # term, but it makes merging better for now. 632 # term, but it makes merging better for now.
633 class HtmlDartInterfaceGenerator(DartInterfaceGenerator): 633 class HtmlDartInterfaceGenerator(DartInterfaceGenerator):
634 """Generates Dart Interface definition for one DOM IDL interface.""" 634 """Generates Dart Interface definition for one DOM IDL interface."""
635 635
636 def __init__(self, interface, emitter, template, 636 def __init__(self, system, interface, emitter, template,
637 common_prefix, super_interface, source_filter, system, shared): 637 common_prefix, super_interface, source_filter, shared):
638 super(HtmlDartInterfaceGenerator, self).__init__(interface, 638 super(HtmlDartInterfaceGenerator, self).__init__(system, interface,
639 emitter, template, common_prefix, super_interface, source_filter) 639 emitter, template, common_prefix, super_interface, source_filter)
640 self._system = system
641 self._shared = shared 640 self._shared = shared
642 641
643 def StartInterface(self): 642 def StartInterface(self):
644 typename = self._interface.id 643 typename = self._interface.id
645 644
646 extends = [] 645 extends = []
647 suppressed_extends = [] 646 suppressed_extends = []
648 647
649 for parent in self._interface.parents: 648 for parent in self._interface.parents:
650 # TODO(vsm): Remove source_filter. 649 # TODO(vsm): Remove source_filter.
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee 1704 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee
1706 # that Y = Z-X, so we need to check for Y. 1705 # that Y = Z-X, so we need to check for Y.
1707 true_code = emitter.Emit( 1706 true_code = emitter.Emit(
1708 '$(INDENT)if ($COND) {\n' 1707 '$(INDENT)if ($COND) {\n'
1709 '$!TRUE' 1708 '$!TRUE'
1710 '$(INDENT)}\n', 1709 '$(INDENT)}\n',
1711 COND=test, INDENT=indent) 1710 COND=test, INDENT=indent)
1712 self.GenerateDispatch( 1711 self.GenerateDispatch(
1713 true_code, info, indent + ' ', position + 1, positive) 1712 true_code, info, indent + ' ', position + 1, positive)
1714 return True 1713 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698