| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 w('attribute %s %s' % (node.type.id, node.id)) | 118 w('attribute %s %s' % (node.type.id, node.id)) |
| 119 if node.raises: | 119 if node.raises: |
| 120 w(' raises (%s)' % node.raises.id) | 120 w(' raises (%s)' % node.raises.id) |
| 121 elif node.get_raises: | 121 elif node.is_fc_getter and node.get_raises: |
| 122 w(' getraises (%s)' % node.get_raises.id) | 122 w(' getraises (%s)' % node.get_raises.id) |
| 123 elif node.set_raises: | 123 elif node.is_fc_setter and node.set_raises: |
| 124 w(' setraises (%s)' % node.set_raises.id) | 124 w(' setraises (%s)' % node.set_raises.id) |
| 125 wln(';') | 125 wln(';') |
| 126 elif isinstance(node, IDLConstant): | 126 elif isinstance(node, IDLConstant): |
| 127 w(node.annotations) | 127 w(node.annotations) |
| 128 w(node.ext_attrs) | 128 w(node.ext_attrs) |
| 129 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)) |
| 130 elif isinstance(node, IDLOperation): | 130 elif isinstance(node, IDLOperation): |
| 131 w(node.annotations) | 131 w(node.annotations) |
| 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 w(')') | 142 w(')') |
| 143 if node.raises: | 143 if node.raises: |
| 144 w(' raises (%s)' % node.raises.id) | 144 w(' raises (%s)' % node.raises.id) |
| 145 wln(';') | 145 wln(';') |
| 146 | |
| 147 elif isinstance(node, IDLArgument): | 146 elif isinstance(node, IDLArgument): |
| 148 w(node.ext_attrs) | 147 w(node.ext_attrs) |
| 149 w('in ') | 148 w('in ') |
| 150 if node.is_optional: | 149 if node.is_optional: |
| 151 w('optional ') | 150 w('optional ') |
| 152 w('%s %s' % (node.type.id, node.id)) | 151 w('%s %s' % (node.type.id, node.id)) |
| 153 else: | 152 else: |
| 154 raise TypeError("Expected str or IDLNode but %s found" % | 153 raise TypeError("Expected str or IDLNode but %s found" % |
| 155 type(node)) | 154 type(node)) |
| 156 | 155 |
| 157 w(idl_node) | 156 w(idl_node) |
| 158 return ''.join(output) | 157 return ''.join(output) |
| OLD | NEW |