OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 mojom.generate.generator as generator | 7 import mojom.generate.generator as generator |
8 import mojom.generate.module as mojom | 8 import mojom.generate.module as mojom |
9 import mojom.generate.pack as pack | 9 import mojom.generate.pack as pack |
10 from mojom.generate.template_expander import UseJinja | 10 from mojom.generate.template_expander import UseJinja |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 _kind_to_dart_decl_type = { | 39 _kind_to_dart_decl_type = { |
40 mojom.BOOL: "bool", | 40 mojom.BOOL: "bool", |
41 mojom.INT8: "int", | 41 mojom.INT8: "int", |
42 mojom.UINT8: "int", | 42 mojom.UINT8: "int", |
43 mojom.INT16: "int", | 43 mojom.INT16: "int", |
44 mojom.UINT16: "int", | 44 mojom.UINT16: "int", |
45 mojom.INT32: "int", | 45 mojom.INT32: "int", |
46 mojom.UINT32: "int", | 46 mojom.UINT32: "int", |
47 mojom.FLOAT: "double", | 47 mojom.FLOAT: "double", |
48 mojom.HANDLE: "RawMojoHandle", | 48 mojom.HANDLE: "core.RawMojoHandle", |
49 mojom.DCPIPE: "RawMojoHandle", | 49 mojom.DCPIPE: "core.RawMojoHandle", |
50 mojom.DPPIPE: "RawMojoHandle", | 50 mojom.DPPIPE: "core.RawMojoHandle", |
51 mojom.MSGPIPE: "RawMojoHandle", | 51 mojom.MSGPIPE: "core.RawMojoHandle", |
52 mojom.SHAREDBUFFER: "RawMojoHandle", | 52 mojom.SHAREDBUFFER: "core.RawMojoHandle", |
53 mojom.NULLABLE_HANDLE: "RawMojoHandle", | 53 mojom.NULLABLE_HANDLE: "core.RawMojoHandle", |
54 mojom.NULLABLE_DCPIPE: "RawMojoHandle", | 54 mojom.NULLABLE_DCPIPE: "core.RawMojoHandle", |
55 mojom.NULLABLE_DPPIPE: "RawMojoHandle", | 55 mojom.NULLABLE_DPPIPE: "core.RawMojoHandle", |
56 mojom.NULLABLE_MSGPIPE: "RawMojoHandle", | 56 mojom.NULLABLE_MSGPIPE: "core.RawMojoHandle", |
57 mojom.NULLABLE_SHAREDBUFFER: "RawMojoHandle", | 57 mojom.NULLABLE_SHAREDBUFFER: "core.RawMojoHandle", |
58 mojom.INT64: "int", | 58 mojom.INT64: "int", |
59 mojom.UINT64: "int", | 59 mojom.UINT64: "int", |
60 mojom.DOUBLE: "double", | 60 mojom.DOUBLE: "double", |
61 mojom.STRING: "String", | 61 mojom.STRING: "String", |
62 mojom.NULLABLE_STRING: "String" | 62 mojom.NULLABLE_STRING: "String" |
63 } | 63 } |
64 | 64 |
65 | 65 |
66 def DartType(kind): | 66 def DartType(kind): |
67 if kind.imported_from: | 67 if kind.imported_from: |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 counter += 1 | 286 counter += 1 |
287 return self.module.imports | 287 return self.module.imports |
288 | 288 |
289 def GetImportedInterfaces(self): | 289 def GetImportedInterfaces(self): |
290 interface_to_import = {}; | 290 interface_to_import = {}; |
291 for each_import in self.module.imports: | 291 for each_import in self.module.imports: |
292 for each_interface in each_import["module"].interfaces: | 292 for each_interface in each_import["module"].interfaces: |
293 name = each_interface.name | 293 name = each_interface.name |
294 interface_to_import[name] = each_import["unique_name"] + "." + name | 294 interface_to_import[name] = each_import["unique_name"] + "." + name |
295 return interface_to_import; | 295 return interface_to_import; |
OLD | NEW |