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

Side by Side Diff: pkg/analyzer/test/generated/test_support.dart

Issue 1572073003: Don't log stack trace for a bad package URL in a source file. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.test.generated.test_support; 5 library analyzer.test.generated.test_support;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 /** 417 /**
418 * Return `true` if the two errors are equivalent. 418 * Return `true` if the two errors are equivalent.
419 * 419 *
420 * @param firstError the first error being compared 420 * @param firstError the first error being compared
421 * @param secondError the second error being compared 421 * @param secondError the second error being compared
422 * @return `true` if the two errors are equivalent 422 * @return `true` if the two errors are equivalent
423 */ 423 */
424 bool _equalErrors(AnalysisError firstError, AnalysisError secondError) => 424 bool _equalErrors(AnalysisError firstError, AnalysisError secondError) =>
425 identical(firstError.errorCode, secondError.errorCode) && 425 identical(firstError.errorCode, secondError.errorCode) &&
426 firstError.offset == secondError.offset && 426 firstError.offset == secondError.offset &&
427 firstError.length == secondError.length && 427 firstError.length == secondError.length &&
428 _equalSources(firstError.source, secondError.source); 428 _equalSources(firstError.source, secondError.source);
429 429
430 /** 430 /**
431 * Return `true` if the two sources are equivalent. 431 * Return `true` if the two sources are equivalent.
432 * 432 *
433 * @param firstSource the first source being compared 433 * @param firstSource the first source being compared
434 * @param secondSource the second source being compared 434 * @param secondSource the second source being compared
435 * @return `true` if the two sources are equivalent 435 * @return `true` if the two sources are equivalent
436 */ 436 */
437 bool _equalSources(Source firstSource, Source secondSource) { 437 bool _equalSources(Source firstSource, Source secondSource) {
438 if (firstSource == null) { 438 if (firstSource == null) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 return false; 530 return false;
531 } 531 }
532 } 532 }
533 533
534 /** 534 /**
535 * Instances of the class [TestLogger] implement a logger that can be used by 535 * Instances of the class [TestLogger] implement a logger that can be used by
536 * tests. 536 * tests.
537 */ 537 */
538 class TestLogger implements Logger { 538 class TestLogger implements Logger {
539 /** 539 /**
540 * The number of error messages that were logged. 540 * All logged messages.
541 */ 541 */
542 int errorCount = 0; 542 List<String> log = [];
543
544 /**
545 * The number of informational messages that were logged.
546 */
547 int infoCount = 0;
548 543
549 @override 544 @override
550 void logError(String message, [CaughtException exception]) { 545 void logError(String message, [CaughtException exception]) {
551 errorCount++; 546 log.add("error: $message");
552 } 547 }
553 548
554 @override 549 @override
555 void logInformation(String message, [CaughtException exception]) { 550 void logInformation(String message, [CaughtException exception]) {
556 infoCount++; 551 log.add("info: $message");
557 } 552 }
558 } 553 }
559 554
560 class TestSource extends Source { 555 class TestSource extends Source {
561 String _name; 556 String _name;
562 String _contents; 557 String _contents;
563 int _modificationStamp = 0; 558 int _modificationStamp = 0;
564 bool exists2 = true; 559 bool exists2 = true;
565 560
566 /** 561 /**
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 if (other is TestSource) { 661 if (other is TestSource) {
667 return other.uri == uri; 662 return other.uri == uri;
668 } 663 }
669 return false; 664 return false;
670 } 665 }
671 666
672 Uri resolveRelativeUri(Uri uri) { 667 Uri resolveRelativeUri(Uri uri) {
673 return this.uri.resolveUri(uri); 668 return this.uri.resolveUri(uri);
674 } 669 }
675 } 670 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698