| 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 logging | 10 import logging |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 ' // Use implementation from $SUPER.\n' | 901 ' // Use implementation from $SUPER.\n' |
| 902 ' // final $TYPE $NAME;\n', | 902 ' // final $TYPE $NAME;\n', |
| 903 SUPER=super_attribute_interface, | 903 SUPER=super_attribute_interface, |
| 904 NAME=html_name, | 904 NAME=html_name, |
| 905 TYPE=self.SecureOutputType(attribute.type.id, False, read_only)) | 905 TYPE=self.SecureOutputType(attribute.type.id, False, read_only)) |
| 906 return | 906 return |
| 907 self._members_emitter.Emit('\n // Shadowing definition.') | 907 self._members_emitter.Emit('\n // Shadowing definition.') |
| 908 self._AddAttributeUsingProperties(attribute, html_name, read_only) | 908 self._AddAttributeUsingProperties(attribute, html_name, read_only) |
| 909 return | 909 return |
| 910 | 910 |
| 911 # If the attribute is shadowed incompatibly in a subclass then we also |
| 912 # can't just generate it as a field. In particular, this happens with |
| 913 # DomMatrixReadOnly and its subclass DomMatrix. Force the superclass |
| 914 # to generate getters. Hardcoding the known problem classes for now. |
| 915 # TODO(alanknight): Fix this more generally. |
| 916 if (self._interface.id == 'DOMMatrixReadOnly' or self._interface.id == 'DOMP
ointReadOnly'): |
| 917 self._AddAttributeUsingProperties(attribute, html_name, read_only) |
| 918 return |
| 919 |
| 911 # If the type has a conversion we need a getter or setter to contain the | 920 # If the type has a conversion we need a getter or setter to contain the |
| 912 # conversion code. | 921 # conversion code. |
| 913 if (self._OutputConversion(attribute.type.id, attribute.id) or | 922 if (self._OutputConversion(attribute.type.id, attribute.id) or |
| 914 self._InputConversion(attribute.type.id, attribute.id)): | 923 self._InputConversion(attribute.type.id, attribute.id)): |
| 915 self._AddAttributeUsingProperties(attribute, html_name, read_only) | 924 self._AddAttributeUsingProperties(attribute, html_name, read_only) |
| 916 return | 925 return |
| 917 | 926 |
| 918 output_type = self.SecureOutputType(attribute.type.id, False, read_only) | 927 output_type = self.SecureOutputType(attribute.type.id, False, read_only) |
| 919 input_type = self._NarrowInputType(attribute.type.id) | 928 input_type = self._NarrowInputType(attribute.type.id) |
| 920 metadata = self._Metadata(attribute.type.id, attribute.id, output_type) | 929 metadata = self._Metadata(attribute.type.id, attribute.id, output_type) |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 | 1308 |
| 1300 def AddFile(self, basename, library_name, path): | 1309 def AddFile(self, basename, library_name, path): |
| 1301 self._libraries[library_name].AddFile(path) | 1310 self._libraries[library_name].AddFile(path) |
| 1302 | 1311 |
| 1303 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1312 def AddTypeEntry(self, library_name, idl_name, dart_name): |
| 1304 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1313 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
| 1305 | 1314 |
| 1306 def Emit(self, emitter, auxiliary_dir): | 1315 def Emit(self, emitter, auxiliary_dir): |
| 1307 for lib in self._libraries.values(): | 1316 for lib in self._libraries.values(): |
| 1308 lib.Emit(emitter, auxiliary_dir) | 1317 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |