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

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: Fix types. 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
« no previous file with comments | « no previous file | dart/pkg/dart2js_incremental/lib/library_updater.dart » ('j') | 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) 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
35 /// Records the position of first difference between [before] and [after]. If
36 /// either [before] or [after] are null, [token] is null.
34 Token token; 37 Token token;
35 38
36 Difference(this.before, this.after); 39 Difference(this.before, this.after) {
40 if (before == after) {
41 throw '[before] and [after] are the same.';
42 }
43 }
37 44
38 String toString() { 45 String toString() {
39 if (before == null) return 'Added($after)'; 46 if (before == null) return 'Added($after)';
40 if (after == null) return 'Removed($before)'; 47 if (after == null) return 'Removed($before)';
41 return 'Modified($after -> $before)'; 48 return 'Modified($after -> $before)';
42 } 49 }
43 } 50 }
44 51
45 List<Difference> computeDifference( 52 List<Difference> computeDifference(
46 ScopeContainerElement before, 53 ScopeContainerElement before,
47 ScopeContainerElement after) { 54 ScopeContainerElement after) {
48 Map<String, DeclarationSite> beforeMap = <String, DeclarationSite>{}; 55 Map<String, DeclarationSite> beforeMap = <String, DeclarationSite>{};
49 before.forEachLocalMember((modelx.ElementX element) { 56 before.forEachLocalMember((modelx.ElementX element) {
50 DeclarationSite site = element.declarationSite; 57 DeclarationSite site = element.declarationSite;
51 assert(site != null); 58 assert(site != null || element.isSynthesized);
52 beforeMap[element.name] = site; 59 if (!element.isSynthesized) {
60 beforeMap[element.name] = site;
61 }
53 }); 62 });
54 List<Difference> modifications = <Difference>[]; 63 List<Difference> modifications = <Difference>[];
55 List<Difference> potentiallyChanged = <Difference>[]; 64 List<Difference> potentiallyChanged = <Difference>[];
56 after.forEachLocalMember((modelx.ElementX element) { 65 after.forEachLocalMember((modelx.ElementX element) {
57 DeclarationSite existing = beforeMap.remove(element.name); 66 DeclarationSite existing = beforeMap.remove(element.name);
58 if (existing == null) { 67 if (existing == null) {
59 modifications.add(new Difference(null, element.declarationSite)); 68 modifications.add(new Difference(null, element.declarationSite));
60 } else { 69 } else {
61 potentiallyChanged.add(new Difference(existing, element.declarationSite)); 70 potentiallyChanged.add(new Difference(existing, element.declarationSite));
62 } 71 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 beforeToken = beforeToken.next; 109 beforeToken = beforeToken.next;
101 afterToken = afterToken.next; 110 afterToken = afterToken.next;
102 beforeKind = beforeToken.kind; 111 beforeKind = beforeToken.kind;
103 afterKind = afterToken.kind; 112 afterKind = afterToken.kind;
104 } 113 }
105 return beforeKind != afterKind; 114 return beforeKind != afterKind;
106 } 115 }
107 print("$before isn't a PartialElement"); 116 print("$before isn't a PartialElement");
108 return true; 117 return true;
109 } 118 }
OLDNEW
« no previous file with comments | « no previous file | dart/pkg/dart2js_incremental/lib/library_updater.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698