| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 for k in sorted(node): | 114 for k in sorted(node): |
| 115 if i > 0: | 115 if i > 0: |
| 116 w(', ') | 116 w(', ') |
| 117 w(k) | 117 w(k) |
| 118 v = node[k] | 118 v = node[k] |
| 119 if v is not None: | 119 if v is not None: |
| 120 if isinstance(v, IDLExtAttrFunctionValue): | 120 if isinstance(v, IDLExtAttrFunctionValue): |
| 121 if v.id: | 121 if v.id: |
| 122 w('=') | 122 w('=') |
| 123 w(v) | 123 w(v) |
| 124 elif isinstance(v, list): |
| 125 assert k == 'Constructor' |
| 126 w(v[0]) |
| 127 for c in v[1:]: |
| 128 w(', '); w(k); w(c) |
| 124 else: | 129 else: |
| 125 w('=%s' % v.__str__()) | 130 w('=%s' % v.__str__()) |
| 126 i += 1 | 131 i += 1 |
| 127 w(']') | 132 w(']') |
| 128 elif isinstance(node, IDLExtAttrFunctionValue): | 133 elif isinstance(node, IDLExtAttrFunctionValue): |
| 129 if node.id: | 134 if node.id: |
| 130 w(node.id) | 135 w(node.id) |
| 131 w('(') | 136 w('(') |
| 132 w(node.arguments, ', ') | 137 w(node.arguments, ', ') |
| 133 w(')') | 138 w(')') |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 elif isinstance(node, IDLArgument): | 173 elif isinstance(node, IDLArgument): |
| 169 wsp(node.ext_attrs) | 174 wsp(node.ext_attrs) |
| 170 w('in ') | 175 w('in ') |
| 171 w('%s %s' % (node.type.id, node.id)) | 176 w('%s %s' % (node.type.id, node.id)) |
| 172 else: | 177 else: |
| 173 raise TypeError("Expected str or IDLNode but %s found" % | 178 raise TypeError("Expected str or IDLNode but %s found" % |
| 174 type(node)) | 179 type(node)) |
| 175 | 180 |
| 176 w(idl_node) | 181 w(idl_node) |
| 177 return ''.join(output) | 182 return ''.join(output) |
| OLD | NEW |