| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 # and | 421 # and |
| 422 # | 422 # |
| 423 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } | 423 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } |
| 424 # | 424 # |
| 425 dart_element_type = self._DartType(element_type) | 425 dart_element_type = self._DartType(element_type) |
| 426 if self._HasNativeIndexGetter(): | 426 if self._HasNativeIndexGetter(): |
| 427 self._EmitNativeIndexGetter(dart_element_type) | 427 self._EmitNativeIndexGetter(dart_element_type) |
| 428 else: | 428 else: |
| 429 self._members_emitter.Emit( | 429 self._members_emitter.Emit( |
| 430 '\n' | 430 '\n' |
| 431 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n'
, | 431 ' $TYPE operator[](int index) {\n' |
| 432 ' if (index < 0 || index >= length)\n' |
| 433 ' throw new RangeError.range(index, 0, length);\n' |
| 434 ' return _nativeIndexedGetter(index);\n' |
| 435 ' }\n' |
| 436 ' $TYPE _nativeIndexedGetter(int index) native "$(INTERFACE)_item_Cal
lback";\n', |
| 432 TYPE=self.SecureOutputType(element_type), | 437 TYPE=self.SecureOutputType(element_type), |
| 433 INTERFACE=self._interface.id) | 438 INTERFACE=self._interface.id) |
| 434 | 439 |
| 435 if self._HasNativeIndexSetter(): | 440 if self._HasNativeIndexSetter(): |
| 436 self._EmitNativeIndexSetter(dart_element_type) | 441 self._EmitNativeIndexSetter(dart_element_type) |
| 437 else: | 442 else: |
| 438 self._members_emitter.Emit( | 443 self._members_emitter.Emit( |
| 439 '\n' | 444 '\n' |
| 440 ' void operator[]=(int index, $TYPE value) {\n' | 445 ' void operator[]=(int index, $TYPE value) {\n' |
| 441 ' throw new UnsupportedError("Cannot assign element of immutable Li
st.");\n' | 446 ' throw new UnsupportedError("Cannot assign element of immutable Li
st.");\n' |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 952 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 948 ' return func;\n', | 953 ' return func;\n', |
| 949 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 954 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 950 | 955 |
| 951 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 956 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 952 return ( | 957 return ( |
| 953 interface.id.endswith('Event') and | 958 interface.id.endswith('Event') and |
| 954 operation.id.startswith('init') and | 959 operation.id.startswith('init') and |
| 955 argument.ext_attrs.get('Default') == 'Undefined' and | 960 argument.ext_attrs.get('Default') == 'Undefined' and |
| 956 argument.type.id == 'DOMString') | 961 argument.type.id == 'DOMString') |
| OLD | NEW |