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 base functionality for systems to generate | 6 """This module provides base functionality for systems to generate |
7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
8 | 8 |
9 import os | 9 import os |
10 from generator import * | 10 from generator import * |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 # Helper methods used by several systems. | 48 # Helper methods used by several systems. |
49 | 49 |
50 def _ProcessCallback(self, interface, info, file_path): | 50 def _ProcessCallback(self, interface, info, file_path): |
51 """Generates a typedef for the callback interface.""" | 51 """Generates a typedef for the callback interface.""" |
52 self._dart_interface_file_paths.append(file_path) | 52 self._dart_interface_file_paths.append(file_path) |
53 code = self._emitters.FileEmitter(file_path) | 53 code = self._emitters.FileEmitter(file_path) |
54 | 54 |
55 code.Emit(self._templates.Load('callback.darttemplate')) | 55 code.Emit(self._templates.Load('callback.darttemplate')) |
56 code.Emit('typedef $TYPE $NAME($PARAMS);\n', | 56 code.Emit('typedef $TYPE $NAME($PARAMS);\n', |
57 NAME=interface.id, | 57 NAME=interface.id, |
58 TYPE=info.type_name, | 58 TYPE=DartType(info.type_name), |
59 PARAMS=info.ParametersImplementationDeclaration()) | 59 PARAMS=info.ParametersImplementationDeclaration()) |
60 | 60 |
61 | 61 |
62 def _GenerateLibFile(self, lib_template, lib_file_path, file_paths, | 62 def _GenerateLibFile(self, lib_template, lib_file_path, file_paths, |
63 **template_args): | 63 **template_args): |
64 """Generates a lib file from a template and a list of files. | 64 """Generates a lib file from a template and a list of files. |
65 | 65 |
66 Additional keyword arguments are passed to the template. | 66 Additional keyword arguments are passed to the template. |
67 Typically called from self.GenerateLibraries. | 67 Typically called from self.GenerateLibraries. |
68 """ | 68 """ |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 parent = interface.parents[0] | 217 parent = interface.parents[0] |
218 if IsPureInterface(parent.type.id): | 218 if IsPureInterface(parent.type.id): |
219 walk(interface.parents) | 219 walk(interface.parents) |
220 else: | 220 else: |
221 walk(interface.parents[1:]) | 221 walk(interface.parents[1:]) |
222 return result | 222 return result |
223 | 223 |
224 | 224 |
225 def IsReadOnly(attribute): | 225 def IsReadOnly(attribute): |
226 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs | 226 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs |
OLD | NEW |