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

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

Issue 2317113005: Remove StringUtils from java_core. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_core.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) 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/ast/ast.dart' show AstNode, SimpleIdentifier; 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier;
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 */ 453 */
454 void _fail(List<AnalysisError> expectedErrors) { 454 void _fail(List<AnalysisError> expectedErrors) {
455 StringBuffer buffer = new StringBuffer(); 455 StringBuffer buffer = new StringBuffer();
456 buffer.write("Expected "); 456 buffer.write("Expected ");
457 buffer.write(expectedErrors.length); 457 buffer.write(expectedErrors.length);
458 buffer.write(" errors:"); 458 buffer.write(" errors:");
459 for (AnalysisError error in expectedErrors) { 459 for (AnalysisError error in expectedErrors) {
460 Source source = error.source; 460 Source source = error.source;
461 LineInfo lineInfo = _lineInfoMap[source]; 461 LineInfo lineInfo = _lineInfoMap[source];
462 buffer.writeln(); 462 buffer.writeln();
463 String sourceName = source == null ? '' : source.shortName;
463 if (lineInfo == null) { 464 if (lineInfo == null) {
464 int offset = error.offset; 465 int offset = error.offset;
465 StringUtils.printf(buffer, " %s %s (%d..%d)", [ 466 buffer.write(' $sourceName ${error.errorCode} '
466 source == null ? "" : source.shortName, 467 '($offset..${offset + error.length})');
467 error.errorCode,
468 offset,
469 offset + error.length
470 ]);
471 } else { 468 } else {
472 LineInfo_Location location = lineInfo.getLocation(error.offset); 469 LineInfo_Location location = lineInfo.getLocation(error.offset);
473 StringUtils.printf(buffer, " %s %s (%d, %d/%d)", [ 470 int lineNumber = location.lineNumber;
474 source == null ? "" : source.shortName, 471 int columnNumber = location.columnNumber;
475 error.errorCode, 472 buffer.write(' $sourceName ${error.errorCode} '
476 location.lineNumber, 473 '($lineNumber, $columnNumber/${error.length})');
477 location.columnNumber,
478 error.length
479 ]);
480 } 474 }
481 } 475 }
482 buffer.writeln(); 476 buffer.writeln();
483 buffer.write("found "); 477 buffer.write("found ");
484 buffer.write(_errors.length); 478 buffer.write(_errors.length);
485 buffer.write(" errors:"); 479 buffer.write(" errors:");
486 for (AnalysisError error in _errors) { 480 for (AnalysisError error in _errors) {
487 Source source = error.source; 481 Source source = error.source;
488 LineInfo lineInfo = _lineInfoMap[source]; 482 LineInfo lineInfo = _lineInfoMap[source];
489 buffer.writeln(); 483 buffer.writeln();
484 String sourceName = source == null ? '' : source.shortName;
490 if (lineInfo == null) { 485 if (lineInfo == null) {
491 int offset = error.offset; 486 int offset = error.offset;
492 StringUtils.printf(buffer, " %s %s (%d..%d): %s", [ 487 buffer.write(' $sourceName ${error.errorCode} '
493 source == null ? "" : source.shortName, 488 '($offset..${offset + error.length}): ${error.message}');
494 error.errorCode,
495 offset,
496 offset + error.length,
497 error.message
498 ]);
499 } else { 489 } else {
500 LineInfo_Location location = lineInfo.getLocation(error.offset); 490 LineInfo_Location location = lineInfo.getLocation(error.offset);
501 StringUtils.printf(buffer, " %s %s (%d, %d/%d): %s", [ 491 int lineNumber = location.lineNumber;
502 source == null ? "" : source.shortName, 492 int columnNumber = location.columnNumber;
503 error.errorCode, 493 buffer.write(' $sourceName ${error.errorCode} '
504 location.lineNumber, 494 '($lineNumber, $columnNumber/${error.length}): ${error.message}');
505 location.columnNumber,
506 error.length,
507 error.message
508 ]);
509 } 495 }
510 } 496 }
511 fail(buffer.toString()); 497 fail(buffer.toString());
512 } 498 }
513 499
514 /** 500 /**
515 * Search through the given list of errors for an error that is equal to the t arget error. If one 501 * Search through the given list of errors for an error that is equal to the t arget error. If one
516 * is found, remove it from the list and return `true`, otherwise return `fals e` 502 * is found, remove it from the list and return `true`, otherwise return `fals e`
517 * without modifying the list. 503 * without modifying the list.
518 * 504 *
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 return UriKind.FILE_URI; 637 return UriKind.FILE_URI;
652 } 638 }
653 639
654 bool operator ==(Object other) { 640 bool operator ==(Object other) {
655 if (other is TestSource) { 641 if (other is TestSource) {
656 return other.uri == uri; 642 return other.uri == uri;
657 } 643 }
658 return false; 644 return false;
659 } 645 }
660 } 646 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_core.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698