| 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 logging | 10 import logging |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 for path in sorted(self._paths): | 1249 for path in sorted(self._paths): |
| 1250 relpath = os.path.relpath(path, library_file_dir) | 1250 relpath = os.path.relpath(path, library_file_dir) |
| 1251 imports_emitter.Emit( | 1251 imports_emitter.Emit( |
| 1252 "part '$PATH';\n", PATH=massage_path(relpath)) | 1252 "part '$PATH';\n", PATH=massage_path(relpath)) |
| 1253 | 1253 |
| 1254 if map_emitter: | 1254 if map_emitter: |
| 1255 items = self._typeMap.items() | 1255 items = self._typeMap.items() |
| 1256 items.sort() | 1256 items.sort() |
| 1257 for (idl_name, dart_name) in items: | 1257 for (idl_name, dart_name) in items: |
| 1258 map_emitter.Emit( | 1258 map_emitter.Emit( |
| 1259 " '$IDL_NAME': $DART_NAME,\n", | 1259 " '$IDL_NAME': () => $DART_NAME,\n", |
| 1260 IDL_NAME=idl_name, | 1260 IDL_NAME=idl_name, |
| 1261 DART_NAME=dart_name) | 1261 DART_NAME=dart_name) |
| 1262 | 1262 |
| 1263 | 1263 |
| 1264 # ------------------------------------------------------------------------------ | 1264 # ------------------------------------------------------------------------------ |
| 1265 | 1265 |
| 1266 class DartLibraries(): | 1266 class DartLibraries(): |
| 1267 def __init__(self, libraries, template_loader, library_type, output_dir): | 1267 def __init__(self, libraries, template_loader, library_type, output_dir): |
| 1268 self._libraries = {} | 1268 self._libraries = {} |
| 1269 for library_name in libraries: | 1269 for library_name in libraries: |
| 1270 self._libraries[library_name] = DartLibrary( | 1270 self._libraries[library_name] = DartLibrary( |
| 1271 library_name, template_loader, library_type, output_dir) | 1271 library_name, template_loader, library_type, output_dir) |
| 1272 | 1272 |
| 1273 def AddFile(self, basename, library_name, path): | 1273 def AddFile(self, basename, library_name, path): |
| 1274 self._libraries[library_name].AddFile(path) | 1274 self._libraries[library_name].AddFile(path) |
| 1275 | 1275 |
| 1276 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1276 def AddTypeEntry(self, library_name, idl_name, dart_name): |
| 1277 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1277 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
| 1278 | 1278 |
| 1279 def Emit(self, emitter, auxiliary_dir): | 1279 def Emit(self, emitter, auxiliary_dir): |
| 1280 for lib in self._libraries.values(): | 1280 for lib in self._libraries.values(): |
| 1281 lib.Emit(emitter, auxiliary_dir) | 1281 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |