OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Generates dart source files from a mojom.Module.""" | 5 """Generates dart source files from a mojom.Module.""" |
6 | 6 |
7 import errno | 7 import errno |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 # These names are the class fields and methods of the Proxy class in | 70 # These names are the class fields and methods of the Proxy class in |
71 # lib/src/proxy.dart of Dart's mojo package. If these names appear in a .mojom | 71 # lib/src/proxy.dart of Dart's mojo package. If these names appear in a .mojom |
72 # they must be mangled to avoid name conflicts. They are mangled by appending | 72 # they must be mangled to avoid name conflicts. They are mangled by appending |
73 # an underscore ('_'), which is banned on names in mojom interfaces. | 73 # an underscore ('_'), which is banned on names in mojom interfaces. |
74 _reserved_words = _dart_reserved_words + [ | 74 _reserved_words = _dart_reserved_words + [ |
75 "close", | 75 "close", |
76 "connectToService", | 76 "connectToService", |
77 "ctrl", | 77 "ctrl", |
78 "fromEndpoint", | 78 "fromEndpoint", |
79 "fromHandle", | 79 "fromHandle", |
| 80 "impl", |
80 "newFromEndpoint", | 81 "newFromEndpoint", |
81 "responseOrError", | 82 "responseOrError", |
| 83 "serviceDescription", |
82 "serviceName", | 84 "serviceName", |
83 "unbound", | 85 "unbound", |
84 ] | 86 ] |
85 | 87 |
86 _kind_to_dart_default_value = { | 88 _kind_to_dart_default_value = { |
87 mojom.BOOL: "false", | 89 mojom.BOOL: "false", |
88 mojom.INT8: "0", | 90 mojom.INT8: "0", |
89 mojom.UINT8: "0", | 91 mojom.UINT8: "0", |
90 mojom.INT16: "0", | 92 mojom.INT16: "0", |
91 mojom.UINT16: "0", | 93 mojom.UINT16: "0", |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 interface_to_import[name] = each_import["unique_name"] + "." + name | 646 interface_to_import[name] = each_import["unique_name"] + "." + name |
645 return interface_to_import | 647 return interface_to_import |
646 | 648 |
647 def ImportedFrom(self): | 649 def ImportedFrom(self): |
648 interface_to_import = {} | 650 interface_to_import = {} |
649 for each_import in self.module.imports: | 651 for each_import in self.module.imports: |
650 for each_interface in each_import["module"].interfaces: | 652 for each_interface in each_import["module"].interfaces: |
651 name = each_interface.name | 653 name = each_interface.name |
652 interface_to_import[name] = each_import["unique_name"] + "." | 654 interface_to_import[name] = each_import["unique_name"] + "." |
653 return interface_to_import | 655 return interface_to_import |
OLD | NEW |