| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 wsp(node.annotations) | 146 wsp(node.annotations) |
| 147 wsp(node.ext_attrs) | 147 wsp(node.ext_attrs) |
| 148 if node.is_read_only: | 148 if node.is_read_only: |
| 149 w('readonly ') | 149 w('readonly ') |
| 150 w('attribute ') | 150 w('attribute ') |
| 151 w(node.type.id) | 151 w(node.type.id) |
| 152 if (node.type.nullable): | 152 if (node.type.nullable): |
| 153 w('?') | 153 w('?') |
| 154 w(' ') | 154 w(' ') |
| 155 w(node.id) | 155 w(node.id) |
| 156 if node.raises: | |
| 157 w(' raises (%s)' % node.raises.id) | |
| 158 else: | |
| 159 if node.get_raises: | |
| 160 w(' getraises (%s)' % node.get_raises.id) | |
| 161 if node.set_raises: | |
| 162 w(' setraises (%s)' % node.set_raises.id) | |
| 163 wln(';') | 156 wln(';') |
| 164 elif isinstance(node, IDLConstant): | 157 elif isinstance(node, IDLConstant): |
| 165 wsp(node.annotations) | 158 wsp(node.annotations) |
| 166 wsp(node.ext_attrs) | 159 wsp(node.ext_attrs) |
| 167 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) | 160 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) |
| 168 elif isinstance(node, IDLOperation): | 161 elif isinstance(node, IDLOperation): |
| 169 wsp(node.annotations) | 162 wsp(node.annotations) |
| 170 wsp(node.ext_attrs) | 163 wsp(node.ext_attrs) |
| 171 if node.is_static: | 164 if node.is_static: |
| 172 w('static ') | 165 w('static ') |
| 173 if node.specials: | 166 if node.specials: |
| 174 w(node.specials, ' ') | 167 w(node.specials, ' ') |
| 175 w(' ') | 168 w(' ') |
| 176 w(node.type.id) | 169 w(node.type.id) |
| 177 if (node.type.nullable): | 170 if (node.type.nullable): |
| 178 w('?') | 171 w('?') |
| 179 w(' ') | 172 w(' ') |
| 180 w(node.id) | 173 w(node.id) |
| 181 w('(') | 174 w('(') |
| 182 w(node.arguments, ', ') | 175 w(node.arguments, ', ') |
| 183 w(')') | 176 w(')') |
| 184 if node.raises: | |
| 185 w(' raises (%s)' % node.raises.id) | |
| 186 wln(';') | 177 wln(';') |
| 187 elif isinstance(node, IDLArgument): | 178 elif isinstance(node, IDLArgument): |
| 188 wsp(node.ext_attrs) | 179 wsp(node.ext_attrs) |
| 189 w('in ') | 180 w('in ') |
| 190 w('%s %s' % (node.type.id, node.id)) | 181 w('%s %s' % (node.type.id, node.id)) |
| 191 else: | 182 else: |
| 192 raise TypeError("Expected str or IDLNode but %s found" % | 183 raise TypeError("Expected str or IDLNode but %s found" % |
| 193 type(node)) | 184 type(node)) |
| 194 | 185 |
| 195 w(idl_node) | 186 w(idl_node) |
| 196 return ''.join(output) | 187 return ''.join(output) |
| OLD | NEW |