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

Side by Side Diff: dart/pkg/dart2js_incremental/lib/diff.dart

Issue 659813002: Apply updates to static methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library trydart.poi.diff; 5 library trydart.poi.diff;
6 6
7 import 'package:compiler/implementation/elements/elements.dart' show 7 import 'package:compiler/implementation/elements/elements.dart' show
8 AbstractFieldElement, 8 AbstractFieldElement,
9 ClassElement, 9 ClassElement,
10 CompilationUnitElement, 10 CompilationUnitElement,
(...skipping 13 matching lines...) Expand all
24 ErrorToken, 24 ErrorToken,
25 IDENTIFIER_TOKEN, 25 IDENTIFIER_TOKEN,
26 KEYWORD_TOKEN, 26 KEYWORD_TOKEN,
27 PartialClassElement, 27 PartialClassElement,
28 PartialElement, 28 PartialElement,
29 Token; 29 Token;
30 30
31 class Difference { 31 class Difference {
32 final DeclarationSite before; 32 final DeclarationSite before;
33 final DeclarationSite after; 33 final DeclarationSite after;
34 Token token; 34 Token token;
Johnni Winther 2014/10/16 07:48:46 Add comment on the semantics of [token].
ahe 2014/10/16 09:19:48 Done.
35 35
36 Difference(this.before, this.after); 36 Difference(this.before, this.after) {
37 if (before == after) {
38 throw '[before] and [after] are the same.';
39 }
40 }
37 41
38 String toString() { 42 String toString() {
39 if (before == null) return 'Added($after)'; 43 if (before == null) return 'Added($after)';
40 if (after == null) return 'Removed($before)'; 44 if (after == null) return 'Removed($before)';
41 return 'Modified($after -> $before)'; 45 return 'Modified($after -> $before)';
42 } 46 }
43 } 47 }
44 48
45 List<Difference> computeDifference( 49 List<Difference> computeDifference(
46 ScopeContainerElement before, 50 ScopeContainerElement before,
47 ScopeContainerElement after) { 51 ScopeContainerElement after) {
48 Map<String, DeclarationSite> beforeMap = <String, DeclarationSite>{}; 52 Map<String, DeclarationSite> beforeMap = <String, DeclarationSite>{};
49 before.forEachLocalMember((modelx.ElementX element) { 53 before.forEachLocalMember((modelx.ElementX element) {
50 DeclarationSite site = element.declarationSite; 54 DeclarationSite site = element.declarationSite;
51 assert(site != null); 55 assert(site != null || element.isSynthesized);
52 beforeMap[element.name] = site; 56 if (!element.isSynthesized) {
57 beforeMap[element.name] = site;
58 }
53 }); 59 });
54 List<Difference> modifications = <Difference>[]; 60 List<Difference> modifications = <Difference>[];
55 List<Difference> potentiallyChanged = <Difference>[]; 61 List<Difference> potentiallyChanged = <Difference>[];
56 after.forEachLocalMember((modelx.ElementX element) { 62 after.forEachLocalMember((modelx.ElementX element) {
57 DeclarationSite existing = beforeMap.remove(element.name); 63 DeclarationSite existing = beforeMap.remove(element.name);
58 if (existing == null) { 64 if (existing == null) {
59 modifications.add(new Difference(null, element.declarationSite)); 65 modifications.add(new Difference(null, element.declarationSite));
60 } else { 66 } else {
61 potentiallyChanged.add(new Difference(existing, element.declarationSite)); 67 potentiallyChanged.add(new Difference(existing, element.declarationSite));
62 } 68 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 beforeToken = beforeToken.next; 106 beforeToken = beforeToken.next;
101 afterToken = afterToken.next; 107 afterToken = afterToken.next;
102 beforeKind = beforeToken.kind; 108 beforeKind = beforeToken.kind;
103 afterKind = afterToken.kind; 109 afterKind = afterToken.kind;
104 } 110 }
105 return beforeKind != afterKind; 111 return beforeKind != afterKind;
106 } 112 }
107 print("$before isn't a PartialElement"); 113 print("$before isn't a PartialElement");
108 return true; 114 return true;
109 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698