| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 'LocalWindow': 'Window', | 59 'LocalWindow': 'Window', |
| 60 'LocalLocation': 'Location', | 60 'LocalLocation': 'Location', |
| 61 'LocalHistory': 'History', | 61 'LocalHistory': 'History', |
| 62 } | 62 } |
| 63 | 63 |
| 64 def SecureOutputType(generator, type_name, is_dart_type=False): | 64 def SecureOutputType(generator, type_name, is_dart_type=False): |
| 65 if is_dart_type: | 65 if is_dart_type: |
| 66 dart_name = type_name | 66 dart_name = type_name |
| 67 else: | 67 else: |
| 68 dart_name = generator._DartType(type_name) | 68 dart_name = generator._DartType(type_name) |
| 69 if dart_name in _secure_base_types: | 69 # We only need to secure Window. Only local History and Location are returned |
| 70 # in generated code. |
| 71 if dart_name == 'LocalWindow': |
| 70 return _secure_base_types[dart_name] | 72 return _secure_base_types[dart_name] |
| 71 return dart_name | 73 return dart_name |
| 72 | 74 |
| 73 # Information for generating element constructors. | 75 # Information for generating element constructors. |
| 74 # | 76 # |
| 75 # TODO(sra): maybe remove all the argument complexity and use cascades. | 77 # TODO(sra): maybe remove all the argument complexity and use cascades. |
| 76 # | 78 # |
| 77 # var c = new CanvasElement(width: 100, height: 70); | 79 # var c = new CanvasElement(width: 100, height: 70); |
| 78 # var c = new CanvasElement()..width = 100..height = 70; | 80 # var c = new CanvasElement()..width = 100..height = 70; |
| 79 # | 81 # |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 | 1128 |
| 1127 library_emitter = self._multiemitter.FileEmitter(library_file_path) | 1129 library_emitter = self._multiemitter.FileEmitter(library_file_path) |
| 1128 library_file_dir = os.path.dirname(library_file_path) | 1130 library_file_dir = os.path.dirname(library_file_path) |
| 1129 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) | 1131 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) |
| 1130 imports_emitter = library_emitter.Emit( | 1132 imports_emitter = library_emitter.Emit( |
| 1131 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) | 1133 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) |
| 1132 for path in sorted(self._path_to_emitter.keys()): | 1134 for path in sorted(self._path_to_emitter.keys()): |
| 1133 relpath = os.path.relpath(path, library_file_dir) | 1135 relpath = os.path.relpath(path, library_file_dir) |
| 1134 imports_emitter.Emit( | 1136 imports_emitter.Emit( |
| 1135 "#source('$PATH');\n", PATH=massage_path(relpath)) | 1137 "#source('$PATH');\n", PATH=massage_path(relpath)) |
| OLD | NEW |