| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 elif isinstance(node, IDLConstant): | 123 elif isinstance(node, IDLConstant): |
| 124 w(node.annotations) | 124 w(node.annotations) |
| 125 w(node.ext_attrs) | 125 w(node.ext_attrs) |
| 126 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) | 126 wln('const %s %s = %s;' % (node.type.id, node.id, node.value)) |
| 127 elif isinstance(node, IDLSnippet): | 127 elif isinstance(node, IDLSnippet): |
| 128 w(node.annotations) | 128 w(node.annotations) |
| 129 wln('snippet {%s};' % node.text) | 129 wln('snippet {%s};' % node.text) |
| 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: |
| 134 w('static ') |
| 133 if node.specials: | 135 if node.specials: |
| 134 w(node.specials, ' ') | 136 w(node.specials, ' ') |
| 135 w(' ') | 137 w(' ') |
| 136 w('%s ' % node.type.id) | 138 w('%s ' % node.type.id) |
| 137 w(node.id) | 139 w(node.id) |
| 138 w('(') | 140 w('(') |
| 139 w(node.arguments, ', ') | 141 w(node.arguments, ', ') |
| 140 wln(');') | 142 wln(');') |
| 141 elif isinstance(node, IDLArgument): | 143 elif isinstance(node, IDLArgument): |
| 142 w(node.ext_attrs) | 144 w(node.ext_attrs) |
| 143 w('in ') | 145 w('in ') |
| 144 if node.is_optional: | 146 if node.is_optional: |
| 145 w('optional ') | 147 w('optional ') |
| 146 w('%s %s' % (node.type.id, node.id)) | 148 w('%s %s' % (node.type.id, node.id)) |
| 147 else: | 149 else: |
| 148 raise TypeError("Expected str or IDLNode but %s found" % | 150 raise TypeError("Expected str or IDLNode but %s found" % |
| 149 type(node)) | 151 type(node)) |
| 150 | 152 |
| 151 w(idl_node) | 153 w(idl_node) |
| 152 return ''.join(output) | 154 return ''.join(output) |
| OLD | NEW |