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

Side by Side Diff: pkg/compiler/lib/src/mirrors_used.dart

Issue 2632643002: Remove LibraryEntity.libraryName (Closed)
Patch Set: Replace libraryOrScriptName with name Created 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.mirrors_used; 5 library dart2js.mirrors_used;
6 6
7 import 'common/tasks.dart' show CompilerTask; 7 import 'common/tasks.dart' show CompilerTask;
8 import 'common.dart'; 8 import 'common.dart';
9 import 'compile_time_constants.dart' show ConstantCompiler; 9 import 'compile_time_constants.dart' show ConstantCompiler;
10 import 'compiler.dart' show Compiler; 10 import 'compiler.dart' show Compiler;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 for (var entry in list) { 449 for (var entry in list) {
450 if (entry is ResolutionDartType) { 450 if (entry is ResolutionDartType) {
451 ResolutionDartType type = entry; 451 ResolutionDartType type = entry;
452 result.add(type.element); 452 result.add(type.element);
453 } else { 453 } else {
454 String string = entry; 454 String string = entry;
455 LibraryElement libraryCandiate; 455 LibraryElement libraryCandiate;
456 String libraryNameCandiate; 456 String libraryNameCandiate;
457 for (LibraryElement l in compiler.libraryLoader.libraries) { 457 for (LibraryElement l in compiler.libraryLoader.libraries) {
458 if (l.hasLibraryName) { 458 if (l.hasLibraryName) {
459 String libraryName = l.libraryOrScriptName; 459 String libraryName = l.libraryName;
Siggi Cherem (dart-lang) 2017/02/07 23:31:53 should this one be .name too?
Johnni Winther 2017/02/08 10:27:10 No. It is a deliberate dependency on the actual li
460 if (string == libraryName) { 460 if (string == libraryName) {
461 // Found an exact match. 461 // Found an exact match.
462 libraryCandiate = l; 462 libraryCandiate = l;
463 libraryNameCandiate = libraryName; 463 libraryNameCandiate = libraryName;
464 break; 464 break;
465 } else if (string.startsWith('$libraryName.')) { 465 } else if (string.startsWith('$libraryName.')) {
466 if (libraryNameCandiate == null || 466 if (libraryNameCandiate == null ||
467 libraryNameCandiate.length < libraryName.length) { 467 libraryNameCandiate.length < libraryName.length) {
468 // Found a better candiate 468 // Found a better candiate
469 libraryCandiate = l; 469 libraryCandiate = l;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 Element resolveLocalExpression(Element element, List<String> identifiers) { 507 Element resolveLocalExpression(Element element, List<String> identifiers) {
508 Element current = element; 508 Element current = element;
509 for (String identifier in identifiers) { 509 for (String identifier in identifiers) {
510 Element e = findLocalMemberIn(current, identifier); 510 Element e = findLocalMemberIn(current, identifier);
511 if (e == null) { 511 if (e == null) {
512 if (current.isLibrary) { 512 if (current.isLibrary) {
513 LibraryElement library = current; 513 LibraryElement library = current;
514 reporter.reportHintMessage( 514 reporter.reportHintMessage(
515 spannable, 515 spannable,
516 MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY, 516 MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY,
517 {'name': identifiers[0], 'library': library.libraryOrScriptName}); 517 {'name': identifiers[0], 'library': library.name});
518 } else { 518 } else {
519 reporter.reportHintMessage( 519 reporter.reportHintMessage(
520 spannable, 520 spannable,
521 MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT, 521 MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT,
522 {'name': identifier, 'element': current.name}); 522 {'name': identifier, 'element': current.name});
523 } 523 }
524 return current; 524 return current;
525 } 525 }
526 current = e; 526 current = e;
527 } 527 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 // @MirrorsUsed(targets: fisk) 566 // @MirrorsUsed(targets: fisk)
567 // ^^^^ 567 // ^^^^
568 // 568 //
569 // Instead of saying 'fisk' should pretty print the problematic constant 569 // Instead of saying 'fisk' should pretty print the problematic constant
570 // value. 570 // value.
571 return spannable; 571 return spannable;
572 } 572 }
573 return node; 573 return node;
574 } 574 }
575 } 575 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698