| 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 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 fromBufferAnnotations = FormatAnnotationsAndComments( | 381 fromBufferAnnotations = FormatAnnotationsAndComments( |
| 382 GetAnnotationsAndComments(self._library_name, self._interface.id, | 382 GetAnnotationsAndComments(self._library_name, self._interface.id, |
| 383 'fromBuffer'), ' ') | 383 'fromBuffer'), ' ') |
| 384 | 384 |
| 385 if typed_array_type: | 385 if typed_array_type: |
| 386 self._members_emitter.Emit( | 386 self._members_emitter.Emit( |
| 387 '\n $(ANNOTATIONS)factory $CTOR(int length) =>\n' | 387 '\n $(ANNOTATIONS)factory $CTOR(int length) =>\n' |
| 388 ' $FACTORY.create$(CTOR)(length);\n' | 388 ' $FACTORY.create$(CTOR)(length);\n' |
| 389 '\n $(LIST_ANNOTATIONS)factory $CTOR.fromList(List<$TYPE> list) =>\n' | 389 '\n $(LIST_ANNOTATIONS)factory $CTOR.fromList(List<$TYPE> list) =>\n' |
| 390 ' $FACTORY.create$(CTOR)_fromList(list);\n' | 390 ' $FACTORY.create$(CTOR)_fromList(list);\n' |
| 391 '\n $(BUFFER_ANNOTATIONS)factory $CTOR.fromBuffer(ArrayBuffer buffer,
' | 391 '\n $(BUFFER_ANNOTATIONS)factory $CTOR.view(ByteBuffer buffer, ' |
| 392 '[int byteOffset, int length]) => \n' | 392 '[int byteOffset, int length]) => \n' |
| 393 ' $FACTORY.create$(CTOR)_fromBuffer(buffer, byteOffset, length);\n'
, | 393 ' $FACTORY.create$(CTOR)_fromBuffer(buffer, byteOffset, length);\n'
, |
| 394 CTOR=self._interface.id, | 394 CTOR=self._renamer.RenameInterface(interface), |
| 395 ANNOTATIONS=annotations, | 395 ANNOTATIONS=annotations, |
| 396 LIST_ANNOTATIONS=fromListAnnotations, | 396 LIST_ANNOTATIONS=fromListAnnotations, |
| 397 BUFFER_ANNOTATIONS=fromBufferAnnotations, | 397 BUFFER_ANNOTATIONS=fromBufferAnnotations, |
| 398 TYPE=self._DartType(typed_array_type), | 398 TYPE=self._DartType(typed_array_type), |
| 399 FACTORY=factory_name) | 399 FACTORY=factory_name) |
| 400 | 400 |
| 401 def _AddConstructor(self, | 401 def _AddConstructor(self, |
| 402 constructor_info, factory_name, factory_constructor_name): | 402 constructor_info, factory_name, factory_constructor_name): |
| 403 if self.GenerateCustomFactory(constructor_info): | 403 if self.GenerateCustomFactory(constructor_info): |
| 404 return | 404 return |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 walk(interface.parents) | 651 walk(interface.parents) |
| 652 else: | 652 else: |
| 653 walk(interface.parents[1:]) | 653 walk(interface.parents[1:]) |
| 654 return result | 654 return result |
| 655 | 655 |
| 656 def _DartType(self, type_name): | 656 def _DartType(self, type_name): |
| 657 return self._type_registry.DartType(type_name) | 657 return self._type_registry.DartType(type_name) |
| 658 | 658 |
| 659 def _IsPrivate(self, name): | 659 def _IsPrivate(self, name): |
| 660 return name.startswith('_') | 660 return name.startswith('_') |
| OLD | NEW |