| OLD | NEW |
| 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 import monitored | 10 import monitored |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 # In the non-root case we have to choose between: | 701 # In the non-root case we have to choose between: |
| 702 # | 702 # |
| 703 # class YImpl extends XImpl { add List<T> methods; } | 703 # class YImpl extends XImpl { add List<T> methods; } |
| 704 # | 704 # |
| 705 # and | 705 # and |
| 706 # | 706 # |
| 707 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } | 707 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } |
| 708 # | 708 # |
| 709 | 709 |
| 710 ext_attrs = self._interface.ext_attrs | 710 ext_attrs = self._interface.ext_attrs |
| 711 has_indexed_getter = ('IndexedGetter' in ext_attrs or | 711 has_indexed_getter = 'CustomIndexedGetter' in ext_attrs |
| 712 'CustomIndexedSetter' in ext_attrs) | 712 for operation in self._interface.operations: |
| 713 if operation.id == 'item' and 'getter' in operation.specials: |
| 714 has_indexed_getter = True |
| 715 break |
| 713 | 716 |
| 714 if has_indexed_getter: | 717 if has_indexed_getter: |
| 715 indexed_getter = ('JS("%s", "#[#]", this, index)' % | 718 indexed_getter = ('JS("%s", "#[#]", this, index)' % |
| 716 self.SecureOutputType(element_type)); | 719 self.SecureOutputType(element_type)); |
| 717 elif any(op.id == 'getItem' for op in self._interface.operations): | 720 elif any(op.id == 'getItem' for op in self._interface.operations): |
| 718 indexed_getter = 'this.getItem(index)' | 721 indexed_getter = 'this.getItem(index)' |
| 719 elif any(op.id == 'item' for op in self._interface.operations): | 722 elif any(op.id == 'item' for op in self._interface.operations): |
| 720 indexed_getter = 'this.item(index)' | 723 indexed_getter = 'this.item(index)' |
| 721 | 724 |
| 722 if indexed_getter: | 725 if indexed_getter: |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 for library_name in libraries: | 1174 for library_name in libraries: |
| 1172 self._libraries[library_name] = DartLibrary( | 1175 self._libraries[library_name] = DartLibrary( |
| 1173 library_name, template_loader, library_type, output_dir) | 1176 library_name, template_loader, library_type, output_dir) |
| 1174 | 1177 |
| 1175 def AddFile(self, basename, library_name, path): | 1178 def AddFile(self, basename, library_name, path): |
| 1176 self._libraries[library_name].AddFile(path) | 1179 self._libraries[library_name].AddFile(path) |
| 1177 | 1180 |
| 1178 def Emit(self, emitter, auxiliary_dir): | 1181 def Emit(self, emitter, auxiliary_dir): |
| 1179 for lib in self._libraries.values(): | 1182 for lib in self._libraries.values(): |
| 1180 lib.Emit(emitter, auxiliary_dir) | 1183 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |