OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, 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 from idlnode import * | 6 from idlnode import * |
7 | 7 |
8 | 8 |
9 def render(idl_node, indent_str=' '): | 9 def render(idl_node, indent_str=' '): |
10 output = [] | 10 output = [] |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 w(node.id) | 162 w(node.id) |
163 w('(') | 163 w('(') |
164 w(node.arguments, ', ') | 164 w(node.arguments, ', ') |
165 w(')') | 165 w(')') |
166 if node.raises: | 166 if node.raises: |
167 w(' raises (%s)' % node.raises.id) | 167 w(' raises (%s)' % node.raises.id) |
168 wln(';') | 168 wln(';') |
169 elif isinstance(node, IDLArgument): | 169 elif isinstance(node, IDLArgument): |
170 wsp(node.ext_attrs) | 170 wsp(node.ext_attrs) |
171 w('in ') | 171 w('in ') |
172 if node.is_optional: | |
173 w('optional ') | |
174 w('%s %s' % (node.type.id, node.id)) | 172 w('%s %s' % (node.type.id, node.id)) |
175 else: | 173 else: |
176 raise TypeError("Expected str or IDLNode but %s found" % | 174 raise TypeError("Expected str or IDLNode but %s found" % |
177 type(node)) | 175 type(node)) |
178 | 176 |
179 w(idl_node) | 177 w(idl_node) |
180 return ''.join(output) | 178 return ''.join(output) |
OLD | NEW |