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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 w(node.ext_attrs) | 132 w(node.ext_attrs) |
133 if node.is_static: | 133 if node.is_static: |
134 w('static ') | 134 w('static ') |
135 if node.specials: | 135 if node.specials: |
136 w(node.specials, ' ') | 136 w(node.specials, ' ') |
137 w(' ') | 137 w(' ') |
138 w('%s ' % node.type.id) | 138 w('%s ' % node.type.id) |
139 w(node.id) | 139 w(node.id) |
140 w('(') | 140 w('(') |
141 w(node.arguments, ', ') | 141 w(node.arguments, ', ') |
142 wln(');') | 142 w(')') |
| 143 if node.raises: |
| 144 w(' raises (%s)' % node.raises.id) |
| 145 wln(';') |
| 146 |
143 elif isinstance(node, IDLArgument): | 147 elif isinstance(node, IDLArgument): |
144 w(node.ext_attrs) | 148 w(node.ext_attrs) |
145 w('in ') | 149 w('in ') |
146 if node.is_optional: | 150 if node.is_optional: |
147 w('optional ') | 151 w('optional ') |
148 w('%s %s' % (node.type.id, node.id)) | 152 w('%s %s' % (node.type.id, node.id)) |
149 else: | 153 else: |
150 raise TypeError("Expected str or IDLNode but %s found" % | 154 raise TypeError("Expected str or IDLNode but %s found" % |
151 type(node)) | 155 type(node)) |
152 | 156 |
153 w(idl_node) | 157 w(idl_node) |
154 return ''.join(output) | 158 return ''.join(output) |
OLD | NEW |