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 os | 10 import os |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 self._interface, self._database) | 340 self._interface, self._database) |
341 if element_type: | 341 if element_type: |
342 self._members_emitter.Emit( | 342 self._members_emitter.Emit( |
343 '\n' | 343 '\n' |
344 ' factory $CTOR(int length) =>\n' | 344 ' factory $CTOR(int length) =>\n' |
345 ' $FACTORY.create$(CTOR)(length);\n' | 345 ' $FACTORY.create$(CTOR)(length);\n' |
346 '\n' | 346 '\n' |
347 ' factory $CTOR.fromList(List<$TYPE> list) =>\n' | 347 ' factory $CTOR.fromList(List<$TYPE> list) =>\n' |
348 ' $FACTORY.create$(CTOR)_fromList(list);\n' | 348 ' $FACTORY.create$(CTOR)_fromList(list);\n' |
349 '\n' | 349 '\n' |
350 ' factory $CTOR.fromBuffer(ArrayBuffer buffer, [int byteOffset, int l
ength]) => \n' | 350 ' factory $CTOR.fromBuffer(ArrayBuffer buffer, [int byteOffset, int l
ength]) =>\n' |
351 ' $FACTORY.create$(CTOR)_fromBuffer(buffer, byteOffset, length);\n'
, | 351 ' $FACTORY.create$(CTOR)_fromBuffer(buffer, byteOffset, length);\n'
, |
352 CTOR=self._interface.id, | 352 CTOR=self._interface.id, |
353 TYPE=self._DartType(element_type), | 353 TYPE=self._DartType(element_type), |
354 FACTORY=factory_provider) | 354 FACTORY=factory_provider) |
355 | 355 |
356 events_interface = self._event_generator.ProcessInterface( | 356 events_interface = self._event_generator.ProcessInterface( |
357 self._interface, interface_name, | 357 self._interface, interface_name, |
358 self._backend.CustomJSMembers(), | 358 self._backend.CustomJSMembers(), |
359 interface_emitter, implementation_emitter) | 359 interface_emitter, implementation_emitter) |
360 if events_interface: | 360 if events_interface: |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 | 1112 |
1113 library_emitter = self._multiemitter.FileEmitter(library_file_path) | 1113 library_emitter = self._multiemitter.FileEmitter(library_file_path) |
1114 library_file_dir = os.path.dirname(library_file_path) | 1114 library_file_dir = os.path.dirname(library_file_path) |
1115 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) | 1115 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) |
1116 imports_emitter = library_emitter.Emit( | 1116 imports_emitter = library_emitter.Emit( |
1117 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) | 1117 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) |
1118 for path in sorted(self._path_to_emitter.keys()): | 1118 for path in sorted(self._path_to_emitter.keys()): |
1119 relpath = os.path.relpath(path, library_file_dir) | 1119 relpath = os.path.relpath(path, library_file_dir) |
1120 imports_emitter.Emit( | 1120 imports_emitter.Emit( |
1121 "#source('$PATH');\n", PATH=massage_path(relpath)) | 1121 "#source('$PATH');\n", PATH=massage_path(relpath)) |
OLD | NEW |