| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 w('=%s' % v.__str__()) | 108 w('=%s' % v.__str__()) |
| 109 i += 1 | 109 i += 1 |
| 110 w('] ') | 110 w('] ') |
| 111 elif isinstance(node, IDLAttribute): | 111 elif isinstance(node, IDLAttribute): |
| 112 w(node.annotations) | 112 w(node.annotations) |
| 113 w(node.ext_attrs) | 113 w(node.ext_attrs) |
| 114 if node.is_fc_getter: | 114 if node.is_fc_getter: |
| 115 w('getter ') | 115 w('getter ') |
| 116 if node.is_fc_setter: | 116 if node.is_fc_setter: |
| 117 w('setter ') | 117 w('setter ') |
| 118 wln('attribute %s %s;' % (node.type.id, node.id)) | 118 w('attribute %s %s' % (node.type.id, node.id)) |
| 119 if node.raises: |
| 120 w(' raises (%s)' % node.raises.id) |
| 121 elif node.get_raises: |
| 122 w(' getraises (%s)' % node.get_raises.id) |
| 123 elif node.set_raises: |
| 124 w(' setraises (%s)' % node.set_raises.id) |
| 125 wln(';') |
| 119 elif isinstance(node, IDLConstant): | 126 elif isinstance(node, IDLConstant): |
| 120 w(node.annotations) | 127 w(node.annotations) |
| 121 w(node.ext_attrs) | 128 w(node.ext_attrs) |
| 122 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) | 129 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) |
| 123 elif isinstance(node, IDLOperation): | 130 elif isinstance(node, IDLOperation): |
| 124 w(node.annotations) | 131 w(node.annotations) |
| 125 w(node.ext_attrs) | 132 w(node.ext_attrs) |
| 126 if node.is_static: | 133 if node.is_static: |
| 127 w('static ') | 134 w('static ') |
| 128 if node.specials: | 135 if node.specials: |
| 129 w(node.specials, ' ') | 136 w(node.specials, ' ') |
| 130 w(' ') | 137 w(' ') |
| 131 w('%s ' % node.type.id) | 138 w('%s ' % node.type.id) |
| 132 w(node.id) | 139 w(node.id) |
| 133 w('(') | 140 w('(') |
| 134 w(node.arguments, ', ') | 141 w(node.arguments, ', ') |
| 135 wln(');') | 142 wln(');') |
| 136 elif isinstance(node, IDLArgument): | 143 elif isinstance(node, IDLArgument): |
| 137 w(node.ext_attrs) | 144 w(node.ext_attrs) |
| 138 w('in ') | 145 w('in ') |
| 139 if node.is_optional: | 146 if node.is_optional: |
| 140 w('optional ') | 147 w('optional ') |
| 141 w('%s %s' % (node.type.id, node.id)) | 148 w('%s %s' % (node.type.id, node.id)) |
| 142 else: | 149 else: |
| 143 raise TypeError("Expected str or IDLNode but %s found" % | 150 raise TypeError("Expected str or IDLNode but %s found" % |
| 144 type(node)) | 151 type(node)) |
| 145 | 152 |
| 146 w(idl_node) | 153 w(idl_node) |
| 147 return ''.join(output) | 154 return ''.join(output) |
| OLD | NEW |