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

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

Issue 476583003: Allow dart2dart to output one file per library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address floitsch's comments Created 6 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 | « sdk/lib/_internal/compiler/implementation/tree/unparser.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 library dart2js.util; 5 library dart2js.util;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'util_implementation.dart'; 8 import 'util_implementation.dart';
9 import 'characters.dart'; 9 import 'characters.dart';
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 int longestCommonPrefixLength(List a, List b) { 188 int longestCommonPrefixLength(List a, List b) {
189 int index = 0; 189 int index = 0;
190 for ( ; index < a.length && index < b.length; index++) { 190 for ( ; index < a.length && index < b.length; index++) {
191 if (a[index] != b[index]) { 191 if (a[index] != b[index]) {
192 break; 192 break;
193 } 193 }
194 } 194 }
195 return index; 195 return index;
196 } 196 }
197
198 /// Returns [suggestedName] if it is not in [usedNames]. Otherwise concatenates
199 /// the smallest number that makes it not appear in [usedNames].
200 ///
201 /// Adds the result to [usedNames].
202 String makeUnique(String suggestedName, Set<String> usedNames) {
203 String result = suggestedName;
204 if (usedNames.contains(suggestedName)) {
205 int counter = 0;
206 while (usedNames.contains(result)) {
207 counter++;
208 result = "$suggestedName$counter";
209 }
210 }
211 usedNames.add(result);
212 return result;
213 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/tree/unparser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698