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

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

Issue 26291005: dart2js: The name of a library without a library declaration is the empty string. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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 'dart2jslib.dart' show 7 import 'dart2jslib.dart' show
8 Compiler, 8 Compiler,
9 CompilerTask, 9 CompilerTask,
10 Constant, 10 Constant,
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 for (var entry in list) { 479 for (var entry in list) {
480 if (entry is DartType) { 480 if (entry is DartType) {
481 DartType type = entry; 481 DartType type = entry;
482 result.add(type.element); 482 result.add(type.element);
483 } else { 483 } else {
484 String string = entry; 484 String string = entry;
485 LibraryElement libraryCandiate; 485 LibraryElement libraryCandiate;
486 String libraryNameCandiate; 486 String libraryNameCandiate;
487 for (LibraryElement l in compiler.libraries.values) { 487 for (LibraryElement l in compiler.libraries.values) {
488 if (l.hasLibraryName()) { 488 if (l.hasLibraryName()) {
489 String libraryName = l.getLibraryOrScriptName(); 489 String libraryName = l.getLibraryName();
490 if (string == libraryName) { 490 if (string == libraryName) {
491 // Found an exact match. 491 // Found an exact match.
492 libraryCandiate = l; 492 libraryCandiate = l;
493 libraryNameCandiate = libraryName; 493 libraryNameCandiate = libraryName;
494 break; 494 break;
495 } else if (string.startsWith('$libraryName.')) { 495 } else if (string.startsWith('$libraryName.')) {
496 if (libraryNameCandiate == null 496 if (libraryNameCandiate == null
497 || libraryNameCandiate.length < libraryName.length) { 497 || libraryNameCandiate.length < libraryName.length) {
498 // Found a better candiate 498 // Found a better candiate
499 libraryCandiate = l; 499 libraryCandiate = l;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 Element resolveLocalExpression(Element element, List<String> identifiers) { 537 Element resolveLocalExpression(Element element, List<String> identifiers) {
538 Element current = element; 538 Element current = element;
539 for (String identifier in identifiers) { 539 for (String identifier in identifiers) {
540 Element e = findLocalMemberIn(current, new SourceString(identifier)); 540 Element e = findLocalMemberIn(current, new SourceString(identifier));
541 if (e == null) { 541 if (e == null) {
542 if (current.isLibrary()) { 542 if (current.isLibrary()) {
543 LibraryElement library = current; 543 LibraryElement library = current;
544 compiler.reportHint( 544 compiler.reportHint(
545 spannable, MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY, 545 spannable, MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY,
546 {'name': identifiers[0], 546 {'name': identifiers[0],
547 'library': library.getLibraryOrScriptName()}); 547 'library': library.getLibraryName()});
548 } else { 548 } else {
549 compiler.reportHint( 549 compiler.reportHint(
550 spannable, MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT, 550 spannable, MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT,
551 {'name': identifier, 'element': current.name}); 551 {'name': identifier, 'element': current.name});
552 } 552 }
553 return current; 553 return current;
554 } 554 }
555 current = e; 555 current = e;
556 } 556 }
557 return current; 557 return current;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // @MirrorsUsed(targets: fisk) 590 // @MirrorsUsed(targets: fisk)
591 // ^^^^ 591 // ^^^^
592 // 592 //
593 // Instead of saying 'fisk' should pretty print the problematic constant 593 // Instead of saying 'fisk' should pretty print the problematic constant
594 // value. 594 // value.
595 return spannable; 595 return spannable;
596 } 596 }
597 return node; 597 return node;
598 } 598 }
599 } 599 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698