| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 if self._HasNativeIndexSetter(): | 376 if self._HasNativeIndexSetter(): |
| 377 self._EmitNativeIndexSetter(dart_element_type) | 377 self._EmitNativeIndexSetter(dart_element_type) |
| 378 else: | 378 else: |
| 379 # The HTML library implementation of NodeList has a custom indexed setter | 379 # The HTML library implementation of NodeList has a custom indexed setter |
| 380 # implementation that uses the parent node the NodeList is associated | 380 # implementation that uses the parent node the NodeList is associated |
| 381 # with if one is available. | 381 # with if one is available. |
| 382 if self._interface.id != 'NodeList': | 382 if self._interface.id != 'NodeList': |
| 383 self._members_emitter.Emit( | 383 self._members_emitter.Emit( |
| 384 '\n' | 384 '\n' |
| 385 ' void operator[]=(int index, $TYPE value) {\n' | 385 ' void operator[]=(int index, $TYPE value) {\n' |
| 386 ' throw new UnsupportedOperationException("Cannot assign element
of immutable List.");\n' | 386 ' throw new UnsupportedError("Cannot assign element of immutable
List.");\n' |
| 387 ' }\n', | 387 ' }\n', |
| 388 TYPE=dart_element_type) | 388 TYPE=dart_element_type) |
| 389 | 389 |
| 390 # The list interface for this class is manually generated. | 390 # The list interface for this class is manually generated. |
| 391 if self._interface.id == 'NodeList': | 391 if self._interface.id == 'NodeList': |
| 392 return | 392 return |
| 393 | 393 |
| 394 # TODO(sra): Use separate mixins for mutable implementations of List<T>. | 394 # TODO(sra): Use separate mixins for mutable implementations of List<T>. |
| 395 # TODO(sra): Use separate mixins for typed array implementations of List<T>. | 395 # TODO(sra): Use separate mixins for typed array implementations of List<T>. |
| 396 template_file = 'immutable_list_mixin.darttemplate' | 396 template_file = 'immutable_list_mixin.darttemplate' |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 def EmitResolver(self, template, output_dir): | 856 def EmitResolver(self, template, output_dir): |
| 857 file_path = os.path.join(output_dir, 'DartResolver.cpp') | 857 file_path = os.path.join(output_dir, 'DartResolver.cpp') |
| 858 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(
template) | 858 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(
template) |
| 859 for header_file in self._headers_list: | 859 for header_file in self._headers_list: |
| 860 path = os.path.relpath(header_file, output_dir) | 860 path = os.path.relpath(header_file, output_dir) |
| 861 includes_emitter.Emit('#include "$PATH"\n', PATH=path) | 861 includes_emitter.Emit('#include "$PATH"\n', PATH=path) |
| 862 body_emitter.Emit( | 862 body_emitter.Emit( |
| 863 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume
ntCount))\n' | 863 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume
ntCount))\n' |
| 864 ' return func;\n', | 864 ' return func;\n', |
| 865 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 865 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| OLD | NEW |