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

Side by Side Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 10916098: Fix dart2dart warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months 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 | « no previous file | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class ElementAst { 5 class ElementAst {
6 final Node ast; 6 final Node ast;
7 final TreeElements treeElements; 7 final TreeElements treeElements;
8 8
9 ElementAst(this.ast, this.treeElements); 9 ElementAst(this.ast, this.treeElements);
10 ElementAst.forClassLike(this.ast) 10 ElementAst.forClassLike(this.ast)
(...skipping 15 matching lines...) Expand all
26 return result !== null ? 26 return result !== null ?
27 result : getFirstNotNullResult((e) => e.getSelector(send)); 27 result : getFirstNotNullResult((e) => e.getSelector(send));
28 } 28 }
29 29
30 DartType getType(TypeAnnotation annotation) { 30 DartType getType(TypeAnnotation annotation) {
31 final result = super.getType(annotation); 31 final result = super.getType(annotation);
32 return result !== null ? 32 return result !== null ?
33 result : getFirstNotNullResult((e) => e.getType(annotation)); 33 result : getFirstNotNullResult((e) => e.getType(annotation));
34 } 34 }
35 35
36 getFirstNotNullResult(f(Element element)) { 36 getFirstNotNullResult(f(TreeElements element)) {
37 for (final element in treeElements) { 37 for (final element in treeElements) {
38 final result = f(element); 38 final result = f(element);
39 if (result !== null) return result; 39 if (result !== null) return result;
40 } 40 }
41 41
42 return null; 42 return null;
43 } 43 }
44 } 44 }
45 45
46 class VariableListAst extends ElementAst { 46 class VariableListAst extends ElementAst {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 }; 169 };
170 170
171 resolvedElements.forEach((element, treeElements) { 171 resolvedElements.forEach((element, treeElements) {
172 if (!shouldOutput(element)) return; 172 if (!shouldOutput(element)) return;
173 173
174 var elementAst = new ElementAst(parse(element), treeElements); 174 var elementAst = new ElementAst(parse(element), treeElements);
175 if (element.isField()) { 175 if (element.isField()) {
176 final list = (element as VariableElement).variables; 176 final list = (element as VariableElement).variables;
177 elementAst = elementAsts.putIfAbsent( 177 elementAst = elementAsts.putIfAbsent(
178 list, () => new VariableListAst(parse(list))); 178 list, () => new VariableListAst(parse(list)));
179 elementAst.add(element, treeElements); 179 (elementAst as VariableListAst).add(element, treeElements);
180 element = list; 180 element = list;
181 } 181 }
182 182
183 if (element.isMember()) { 183 if (element.isMember()) {
184 ClassElement enclosingClass = element.getEnclosingClass(); 184 ClassElement enclosingClass = element.getEnclosingClass();
185 assert(enclosingClass.isClass()); 185 assert(enclosingClass.isClass());
186 assert(enclosingClass.isTopLevel()); 186 assert(enclosingClass.isTopLevel());
187 assert(shouldOutput(enclosingClass)); 187 assert(shouldOutput(enclosingClass));
188 addClass(enclosingClass); 188 addClass(enclosingClass);
189 classMembers[enclosingClass].add(element); 189 classMembers[enclosingClass].add(element);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 319 }
320 320
321 compareElements(e0, e1) { 321 compareElements(e0, e1) {
322 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); 322 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1);
323 if (result != 0) return result; 323 if (result != 0) return result;
324 return compareBy((e) => e.position().charOffset)(e0, e1); 324 return compareBy((e) => e.position().charOffset)(e0, e1);
325 } 325 }
326 326
327 List<Element> sortElements(Collection<Element> elements) => 327 List<Element> sortElements(Collection<Element> elements) =>
328 sorted(elements, compareElements); 328 sorted(elements, compareElements);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698