| 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 systems to generate | 6 """This module provides shared functionality for the systems to generate |
| 7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import os | 10 import os |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 # is not virtual and accessing it through Uint8Array pointer | 507 # is not virtual and accessing it through Uint8Array pointer |
| 508 # would lead to wrong semantics (modulo vs. clamping.) | 508 # would lead to wrong semantics (modulo vs. clamping.) |
| 509 dart_element_type = self._DartType(element_type) | 509 dart_element_type = self._DartType(element_type) |
| 510 | 510 |
| 511 if self._HasNativeIndexGetter(): | 511 if self._HasNativeIndexGetter(): |
| 512 self._EmitNativeIndexGetter(dart_element_type) | 512 self._EmitNativeIndexGetter(dart_element_type) |
| 513 if self._HasNativeIndexSetter(): | 513 if self._HasNativeIndexSetter(): |
| 514 self._EmitNativeIndexSetter(dart_element_type) | 514 self._EmitNativeIndexSetter(dart_element_type) |
| 515 | 515 |
| 516 def _HasNativeIndexGetter(self): | 516 def _HasNativeIndexGetter(self): |
| 517 ext_attrs = self._interface.ext_attrs | 517 return 'CustomIndexedGetter' in self._interface.ext_attrs |
| 518 return ('CustomIndexedGetter' in ext_attrs or | |
| 519 'NumericIndexedGetter' in ext_attrs) | |
| 520 | 518 |
| 521 def _EmitNativeIndexGetter(self, element_type): | 519 def _EmitNativeIndexGetter(self, element_type): |
| 522 dart_declaration = '%s operator[](int index)' % \ | 520 dart_declaration = '%s operator[](int index)' % \ |
| 523 self.SecureOutputType(element_type, True) | 521 self.SecureOutputType(element_type, True) |
| 524 self._GenerateNativeBinding('numericIndexGetter', 2, dart_declaration, | 522 self._GenerateNativeBinding('numericIndexGetter', 2, dart_declaration, |
| 525 'Callback', True) | 523 'Callback', True) |
| 526 | 524 |
| 527 def _HasNativeIndexSetter(self): | 525 def _HasNativeIndexSetter(self): |
| 528 return 'CustomIndexedSetter' in self._interface.ext_attrs | 526 return 'CustomIndexedSetter' in self._interface.ext_attrs |
| 529 | 527 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 1016 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 1019 ' return func;\n', | 1017 ' return func;\n', |
| 1020 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 1018 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 1021 | 1019 |
| 1022 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1020 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1023 return ( | 1021 return ( |
| 1024 interface.id.endswith('Event') and | 1022 interface.id.endswith('Event') and |
| 1025 operation.id.startswith('init') and | 1023 operation.id.startswith('init') and |
| 1026 argument.ext_attrs.get('Default') == 'Undefined' and | 1024 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1027 argument.type.id == 'DOMString') | 1025 argument.type.id == 'DOMString') |
| OLD | NEW |