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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart

Issue 177963002: Use List instead of Link in the type system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and some algorithmic bugs fixed. Created 6 years, 9 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) 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 part of dart_backend; 5 part of dart_backend;
6 6
7 Comparator get _compareNodes => 7 Comparator get _compareNodes =>
8 compareBy((n) => n.getBeginToken().charOffset); 8 compareBy((n) => n.getBeginToken().charOffset);
9 9
10 typedef String _Renamer(Renamable renamable); 10 typedef String _Renamer(Renamable renamable);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 f(element, map[element]); 85 f(element, map[element]);
86 } 86 }
87 } 87 }
88 88
89 String renameType(DartType type, Function renameElement) { 89 String renameType(DartType type, Function renameElement) {
90 // TODO(smok): Do not rename type if it is in platform library or 90 // TODO(smok): Do not rename type if it is in platform library or
91 // js-helpers. 91 // js-helpers.
92 StringBuffer result = new StringBuffer(renameElement(type.element)); 92 StringBuffer result = new StringBuffer(renameElement(type.element));
93 if (type is GenericType && !type.treatAsRaw) { 93 if (type is GenericType && !type.treatAsRaw) {
94 result.write('<'); 94 result.write('<');
95 Link<DartType> argumentsLink = type.typeArguments; 95 List<DartType> arguments = type.typeArguments;
96 result.write(renameType(argumentsLink.head, renameElement)); 96 result.write(renameType(arguments.first, renameElement));
97 for (Link<DartType> link = argumentsLink.tail; !link.isEmpty; 97 for (int index = 1; index < arguments.length; index++) {
98 link = link.tail) {
99 result.write(','); 98 result.write(',');
100 result.write(renameType(link.head, renameElement)); 99 result.write(renameType(arguments[index], renameElement));
101 } 100 }
102 result.write('>'); 101 result.write('>');
103 } 102 }
104 return result.toString(); 103 return result.toString();
105 } 104 }
106 105
107 String renameConstructor(Element element, ConstructorPlaceholder placeholder, 106 String renameConstructor(Element element, ConstructorPlaceholder placeholder,
108 Function renameString, Function renameElement) { 107 Function renameString, Function renameElement) {
109 assert(element.isConstructor()); 108 assert(element.isConstructor());
110 StringBuffer result = new StringBuffer(); 109 StringBuffer result = new StringBuffer();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 MinifyingGenerator(); 353 MinifyingGenerator();
355 354
356 String generate(bool isForbidden(String name)) { 355 String generate(bool isForbidden(String name)) {
357 String result; 356 String result;
358 do { 357 do {
359 result = generateMiniId(index++); 358 result = generateMiniId(index++);
360 } while (isForbidden(result)); 359 } while (isForbidden(result));
361 return result; 360 return result;
362 } 361 }
363 } 362 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698