Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: client/dom/scripts/idlrenderer.dart

Issue 8384029: Work-arounds for missing and broken Frog functionality. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/dom/scripts/idlparser.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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));
11 if (key == null) 11 if (key == null)
12 return compare; 12 return compare;
13 return (a, b) => compare(key(a), key(b)); 13 return (a, b) => compare(key(a), key(b));
14 } 14 }
15 List copy = new List.from(input); 15 List copy = new List.from(input);
16 copy.sort(comparator(compare, key)); 16 copy.sort(comparator(compare, key));
17 return copy; 17 return copy;
18 } 18 }
19 19
20 render(idl_node, [indent_str=' ']) { 20 render(idl_node, [indent_str=' ']) {
21 var output = ['']; 21 var output = [''];
22 var indent_stack = []; 22 var indent_stack = [];
23 23
24 //indented(action()) { 24 indented(action) { // TODO: revert to indented(action()) {
25 indented(action) {
26 indent_stack.add(indent_str); 25 indent_stack.add(indent_str);
27 action(); 26 action();
28 indent_stack.removeLast(); 27 indent_stack.removeLast();
29 } 28 }
30 29
31 sort(nodes) => sorted(nodes, key: (a) => a.id); 30 sort(nodes) => sorted(nodes, key: (a) => a.id);
32 31
33 var w; // For some reason mutually recursive local functions don't work. 32 var w; // For some reason mutually recursive local functions don't work.
34 33
35 wln([node=null]) { 34 wln([node]) {
36 w(node); 35 w(node);
37 output.add('\n'); 36 output.add('\n');
38 } 37 }
39 38
40 w = (node, [list_separator]) { 39 w = (node, [list_separator]) {
41 /* 40 /*
42 Writes the given node. 41 Writes the given node.
43 42
44 Args: 43 Args:
45 node -- a string, IDLNode instance or a list of such. 44 node -- a string, IDLNode instance or a list of such.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (value != null) { 127 if (value != null) {
129 w('='); 128 w('=');
130 w(value); 129 w(value);
131 } 130 }
132 } 131 }
133 w('] '); 132 w('] ');
134 } 133 }
135 } else if (node is IDLAttribute) { 134 } else if (node is IDLAttribute) {
136 w(node.annotations); 135 w(node.annotations);
137 w(node.extAttrs); 136 w(node.extAttrs);
138 if (node.isFcGetter) 137 //if (node.isFcGetter)
139 w('getter '); 138 // w('getter ');
140 if (node.isFcSetter) 139 //if (node.isFcSetter)
141 w('setter '); 140 // w('setter ');
142 wln('attribute ${node.type.id} ${node.id};'); 141 wln('attribute ${node.type.id} ${node.id};');
143 } else if (node is IDLConstant) { 142 } else if (node is IDLConstant) {
144 w(node.annotations); 143 w(node.annotations);
145 w(node.extAttrs); 144 w(node.extAttrs);
146 wln('const ${node.type.id} ${node.id} = ${node.value};'); 145 wln('const ${node.type.id} ${node.id} = ${node.value};');
147 } else if (node is IDLSnippet) { 146 } else if (node is IDLSnippet) {
148 w(node.annotations); 147 w(node.annotations);
149 wln('snippet {${node.text}};'); 148 wln('snippet {${node.text}};');
150 } else if (node is IDLOperation) { 149 } else if (node is IDLOperation) {
151 w(node.annotations); 150 w(node.annotations);
(...skipping 20 matching lines...) Expand all
172 } else if (node is IDLTypeDef) { 171 } else if (node is IDLTypeDef) {
173 wln('typedef ${node.type.id} ${node.id};'); 172 wln('typedef ${node.type.id} ${node.id};');
174 } else { 173 } else {
175 w('// $node\n'); 174 w('// $node\n');
176 } 175 }
177 }; 176 };
178 177
179 w(idl_node); 178 w(idl_node);
180 return Strings.concatAll(output); 179 return Strings.concatAll(output);
181 } 180 }
OLDNEW
« no previous file with comments | « client/dom/scripts/idlparser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698