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

Side by Side Diff: dart/frog/world.dart

Issue 9361030: Fix for http://code.google.com/p/dart/issues/detail?id=1363: use the simplename for the key, not ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 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 /** The one true [World]. */ 5 /** The one true [World]. */
6 World world; 6 World world;
7 7
8 /** 8 /**
9 * Experimental phase to enable await, only set when using the 9 * Experimental phase to enable await, only set when using the
10 * await/awaitc.dart entrypoint. 10 * await/awaitc.dart entrypoint.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 int existingPri = existing.jsnamePriority; 271 int existingPri = existing.jsnamePriority;
272 int namedPri = named.jsnamePriority; 272 int namedPri = named.jsnamePriority;
273 if (existingPri > namedPri || namedPri == 0) { 273 if (existingPri > namedPri || namedPri == 0) {
274 // Either existing was higher priority, or they're both 0 so first one 274 // Either existing was higher priority, or they're both 0 so first one
275 // wins. 275 // wins.
276 _renameJavascriptTopName(named); 276 _renameJavascriptTopName(named);
277 } else if (namedPri > existingPri) { 277 } else if (namedPri > existingPri) {
278 // New one takes priority over existing 278 // New one takes priority over existing
279 _renameJavascriptTopName(existing); 279 _renameJavascriptTopName(existing);
280 } else { 280 } else {
281 final msg = 'conflicting JS name "$name" of same ' 281 final msg = 'conflicting JS name "$name" of same '
kasperl 2012/02/08 14:00:32 Only compute the msg in the case named.isNative.
ngeoffray 2012/02/08 16:34:01 Done.
282 + 'priority $existingPri: (already defined in) ' 282 + 'priority $existingPri: (already defined in) '
283 + '${existing.span.locationText} with priority $namedPri)'; 283 + '${existing.span.locationText} with priority $namedPri)';
284 if (named.isNative) { 284 if (named.isNative) {
285 // We trust that conflicting native names in builtin libraries are 285 // We trust that conflicting native names in builtin libraries are
286 // harmless. Most cases there are no conflicts, currently isolates 286 // harmless. Most cases there are no conflicts, currently isolates
287 // in coreimpl and dart:dom both define web workers to avoid adding a 287 // in coreimpl and dart:dom both define web workers to avoid adding a
288 // dependency from corelib to dart:dom. 288 // dependency from corelib to dart:dom.
289 world.info(msg, named.span, existing.span); 289 world.info(msg, named.span, existing.span);
290 } else { 290 } else {
291 // Conflicting name in corelib needs to be fixed. 291 // Conflicting js name in same library. This happens because
292 world.internalError(msg, named.span, existing.span); 292 // of two different type arguments with the same name but in
293 // different libraries.
294 _renameJavascriptTopName(existing);
293 } 295 }
294 } 296 }
295 } 297 }
296 298
297 /** Renames an [Element] that had a name conflict in the generated JS. */ 299 /** Renames an [Element] that had a name conflict in the generated JS. */
298 _renameJavascriptTopName(Element named) { 300 _renameJavascriptTopName(Element named) {
299 named._jsname = '${named.library.jsname}_${named.jsname}'; 301 named._jsname = '${named.library.jsname}_${named.jsname}';
300 final existing = _topNames[named.jsname]; 302 final existing = _topNames[named.jsname];
301 if (existing != null && existing != named) { 303 if (existing != null && existing != named) {
302 // If this happens it means the library name wasn't unique enough. 304 // If this happens it means the library name wasn't unique enough.
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 626
625 withTiming(String name, f()) { 627 withTiming(String name, f()) {
626 final sw = new Stopwatch(); 628 final sw = new Stopwatch();
627 sw.start(); 629 sw.start();
628 var result = f(); 630 var result = f();
629 sw.stop(); 631 sw.stop();
630 info('$name in ${sw.elapsedInMs()}msec'); 632 info('$name in ${sw.elapsedInMs()}msec');
631 return result; 633 return result;
632 } 634 }
633 } 635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698