| 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 | |
| 920 # If the type has a conversion we need a getter or setter to contain the | 911 # If the type has a conversion we need a getter or setter to contain the |
| 921 # conversion code. | 912 # conversion code. |
| 922 if (self._OutputConversion(attribute.type.id, attribute.id) or | 913 if (self._OutputConversion(attribute.type.id, attribute.id) or |
| 923 self._InputConversion(attribute.type.id, attribute.id)): | 914 self._InputConversion(attribute.type.id, attribute.id)): |
| 924 self._AddAttributeUsingProperties(attribute, html_name, read_only) | 915 self._AddAttributeUsingProperties(attribute, html_name, read_only) |
| 925 return | 916 return |
| 926 | 917 |
| 927 output_type = self.SecureOutputType(attribute.type.id, False, read_only) | 918 output_type = self.SecureOutputType(attribute.type.id, False, read_only) |
| 928 input_type = self._NarrowInputType(attribute.type.id) | 919 input_type = self._NarrowInputType(attribute.type.id) |
| 929 metadata = self._Metadata(attribute.type.id, attribute.id, output_type) | 920 metadata = self._Metadata(attribute.type.id, attribute.id, output_type) |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 | 1299 |
| 1309 def AddFile(self, basename, library_name, path): | 1300 def AddFile(self, basename, library_name, path): |
| 1310 self._libraries[library_name].AddFile(path) | 1301 self._libraries[library_name].AddFile(path) |
| 1311 | 1302 |
| 1312 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1303 def AddTypeEntry(self, library_name, idl_name, dart_name): |
| 1313 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1304 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
| 1314 | 1305 |
| 1315 def Emit(self, emitter, auxiliary_dir): | 1306 def Emit(self, emitter, auxiliary_dir): |
| 1316 for lib in self._libraries.values(): | 1307 for lib in self._libraries.values(): |
| 1317 lib.Emit(emitter, auxiliary_dir) | 1308 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |