| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 w(']') | 127 w(']') |
| 128 elif isinstance(node, IDLExtAttrFunctionValue): | 128 elif isinstance(node, IDLExtAttrFunctionValue): |
| 129 if node.id: | 129 if node.id: |
| 130 w(node.id) | 130 w(node.id) |
| 131 w('(') | 131 w('(') |
| 132 w(node.arguments, ', ') | 132 w(node.arguments, ', ') |
| 133 w(')') | 133 w(')') |
| 134 elif isinstance(node, IDLAttribute): | 134 elif isinstance(node, IDLAttribute): |
| 135 wsp(node.annotations) | 135 wsp(node.annotations) |
| 136 wsp(node.ext_attrs) | 136 wsp(node.ext_attrs) |
| 137 if node.is_fc_getter: | 137 if node.is_read_only: |
| 138 w('getter ') | 138 w('readonly ') |
| 139 if node.is_fc_setter: | |
| 140 w('setter ') | |
| 141 w('attribute %s %s' % (node.type.id, node.id)) | 139 w('attribute %s %s' % (node.type.id, node.id)) |
| 142 if node.raises: | 140 if node.raises: |
| 143 w(' raises (%s)' % node.raises.id) | 141 w(' raises (%s)' % node.raises.id) |
| 144 elif node.is_fc_getter and node.get_raises: | 142 else: |
| 145 w(' getraises (%s)' % node.get_raises.id) | 143 if node.get_raises: |
| 146 elif node.is_fc_setter and node.set_raises: | 144 w(' getraises (%s)' % node.get_raises.id) |
| 147 w(' setraises (%s)' % node.set_raises.id) | 145 if node.set_raises: |
| 146 w(' setraises (%s)' % node.set_raises.id) |
| 148 wln(';') | 147 wln(';') |
| 149 elif isinstance(node, IDLConstant): | 148 elif isinstance(node, IDLConstant): |
| 150 wsp(node.annotations) | 149 wsp(node.annotations) |
| 151 wsp(node.ext_attrs) | 150 wsp(node.ext_attrs) |
| 152 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) | 151 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) |
| 153 elif isinstance(node, IDLOperation): | 152 elif isinstance(node, IDLOperation): |
| 154 wsp(node.annotations) | 153 wsp(node.annotations) |
| 155 wsp(node.ext_attrs) | 154 wsp(node.ext_attrs) |
| 156 if node.is_static: | 155 if node.is_static: |
| 157 w('static ') | 156 w('static ') |
| (...skipping 11 matching lines...) Expand all Loading... |
| 169 elif isinstance(node, IDLArgument): | 168 elif isinstance(node, IDLArgument): |
| 170 wsp(node.ext_attrs) | 169 wsp(node.ext_attrs) |
| 171 w('in ') | 170 w('in ') |
| 172 w('%s %s' % (node.type.id, node.id)) | 171 w('%s %s' % (node.type.id, node.id)) |
| 173 else: | 172 else: |
| 174 raise TypeError("Expected str or IDLNode but %s found" % | 173 raise TypeError("Expected str or IDLNode but %s found" % |
| 175 type(node)) | 174 type(node)) |
| 176 | 175 |
| 177 w(idl_node) | 176 w(idl_node) |
| 178 return ''.join(output) | 177 return ''.join(output) |
| OLD | NEW |