OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 List sorted(Iterable input, [compare, key]) { | 5 List sorted(Iterable input, [compare, key]) { |
6 comparator(compare, key) { | 6 comparator(compare, key) { |
7 if (compare == null && key == null) | 7 if (compare == null && key == null) |
8 return (a, b) => a.compareTo(b); | 8 return (a, b) => a.compareTo(b); |
9 if (compare == null) | 9 if (compare == null) |
10 return (a, b) => key(a).compareTo(key(b)); | 10 return (a, b) => key(a).compareTo(key(b)); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 w('@$name'); | 104 w('@$name'); |
105 } else { | 105 } else { |
106 var formattedArgs = []; | 106 var formattedArgs = []; |
107 for (var argName in sorted(args.keys)) { | 107 for (var argName in sorted(args.keys)) { |
108 var argValue = args[argName]; | 108 var argValue = args[argName]; |
109 if (argValue == null) | 109 if (argValue == null) |
110 formattedArgs.add(argName); | 110 formattedArgs.add(argName); |
111 else | 111 else |
112 formattedArgs.add('$argName=$argValue'); | 112 formattedArgs.add('$argName=$argValue'); |
113 } | 113 } |
114 w('@$name(${Strings.join(formattedArgs,',')})'); | 114 w('@$name(${formattedArgs.join(',')})'); |
115 } | 115 } |
116 w(' '); | 116 w(' '); |
117 } | 117 } |
118 } else if (node is IDLExtAttrs) { | 118 } else if (node is IDLExtAttrs) { |
119 if(!node.map.isEmpty) { | 119 if(!node.map.isEmpty) { |
120 w('['); | 120 w('['); |
121 var sep = null; | 121 var sep = null; |
122 for (var name in sorted(node.map.keys)) { | 122 for (var name in sorted(node.map.keys)) { |
123 w(sep); | 123 w(sep); |
124 sep = ', '; | 124 sep = ', '; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 w(node.arguments, ', '); | 169 w(node.arguments, ', '); |
170 w(')'); | 170 w(')'); |
171 } else if (node is IDLTypeDef) { | 171 } else if (node is IDLTypeDef) { |
172 wln('typedef ${node.type.id} ${node.id};'); | 172 wln('typedef ${node.type.id} ${node.id};'); |
173 } else { | 173 } else { |
174 w('// $node\n'); | 174 w('// $node\n'); |
175 } | 175 } |
176 }; | 176 }; |
177 | 177 |
178 w(idl_node); | 178 w(idl_node); |
179 return Strings.concatAll(output); | 179 return output.join(); |
180 } | 180 } |
OLD | NEW |