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

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

Issue 14050010: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.test_support; 4 library engine.test_support;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:uri'; 7 import 'dart:uri';
8 import 'package:analyzer_experimental/src/generated/java_core.dart'; 8 import 'package:analyzer_experimental/src/generated/java_core.dart';
9 import 'package:analyzer_experimental/src/generated/java_engine.dart'; 9 import 'package:analyzer_experimental/src/generated/java_engine.dart';
10 import 'package:analyzer_experimental/src/generated/java_junit.dart'; 10 import 'package:analyzer_experimental/src/generated/java_junit.dart';
(...skipping 27 matching lines...) Expand all
38 */ 38 */
39 Map<Source, LineInfo> _lineInfoMap = new Map<Source, LineInfo>(); 39 Map<Source, LineInfo> _lineInfoMap = new Map<Source, LineInfo>();
40 /** 40 /**
41 * An empty array of errors used when no errors are expected. 41 * An empty array of errors used when no errors are expected.
42 */ 42 */
43 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); 43 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0);
44 /** 44 /**
45 * Initialize a newly created error listener to collect errors. 45 * Initialize a newly created error listener to collect errors.
46 */ 46 */
47 GatheringErrorListener() : super() { 47 GatheringErrorListener() : super() {
48 _jtd_constructor_347_impl(); 48 _jtd_constructor_349_impl();
49 } 49 }
50 _jtd_constructor_347_impl() { 50 _jtd_constructor_349_impl() {
51 } 51 }
52 /** 52 /**
53 * Initialize a newly created error listener to collect errors. 53 * Initialize a newly created error listener to collect errors.
54 */ 54 */
55 GatheringErrorListener.con1(String rawSource2) { 55 GatheringErrorListener.con1(String rawSource2) {
56 _jtd_constructor_348_impl(rawSource2); 56 _jtd_constructor_350_impl(rawSource2);
57 } 57 }
58 _jtd_constructor_348_impl(String rawSource2) { 58 _jtd_constructor_350_impl(String rawSource2) {
59 this._rawSource = rawSource2; 59 this._rawSource = rawSource2;
60 this._markedSource = rawSource2; 60 this._markedSource = rawSource2;
61 } 61 }
62 /** 62 /**
63 * Assert that the number of errors that have been gathered matches the number of errors that are 63 * Assert that the number of errors that have been gathered matches the number of errors that are
64 * given and that they have the expected error codes and locations. The order in which the errors 64 * given and that they have the expected error codes and locations. The order in which the errors
65 * were gathered is ignored. 65 * were gathered is ignored.
66 * @param errorCodes the errors that should have been gathered 66 * @param errorCodes the errors that should have been gathered
67 * @throws AssertionFailedError if a different number of errors have been gath ered than were 67 * @throws AssertionFailedError if a different number of errors have been gath ered than were
68 * expected or if they do not have the same codes and locations 68 * expected or if they do not have the same codes and locations
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 */ 252 */
253 void setLineInfo2(Source source, LineInfo lineInfo) { 253 void setLineInfo2(Source source, LineInfo lineInfo) {
254 _lineInfoMap[source] = lineInfo; 254 _lineInfoMap[source] = lineInfo;
255 } 255 }
256 /** 256 /**
257 * Return {@code true} if the two errors are equivalent. 257 * Return {@code true} if the two errors are equivalent.
258 * @param firstError the first error being compared 258 * @param firstError the first error being compared
259 * @param secondError the second error being compared 259 * @param secondError the second error being compared
260 * @return {@code true} if the two errors are equivalent 260 * @return {@code true} if the two errors are equivalent
261 */ 261 */
262 bool equals(AnalysisError firstError, AnalysisError secondError) => identical( firstError.errorCode, secondError.errorCode) && firstError.offset == secondError .offset && firstError.length == secondError.length && equals3(firstError.source, secondError.source); 262 bool equals3(AnalysisError firstError, AnalysisError secondError) => identical (firstError.errorCode, secondError.errorCode) && firstError.offset == secondErro r.offset && firstError.length == secondError.length && equals4(firstError.source , secondError.source);
263 /** 263 /**
264 * Return {@code true} if the two sources are equivalent. 264 * Return {@code true} if the two sources are equivalent.
265 * @param firstSource the first source being compared 265 * @param firstSource the first source being compared
266 * @param secondSource the second source being compared 266 * @param secondSource the second source being compared
267 * @return {@code true} if the two sources are equivalent 267 * @return {@code true} if the two sources are equivalent
268 */ 268 */
269 bool equals3(Source firstSource, Source secondSource) { 269 bool equals4(Source firstSource, Source secondSource) {
270 if (firstSource == null) { 270 if (firstSource == null) {
271 return secondSource == null; 271 return secondSource == null;
272 } else if (secondSource == null) { 272 } else if (secondSource == null) {
273 return false; 273 return false;
274 } 274 }
275 return firstSource == secondSource; 275 return firstSource == secondSource;
276 } 276 }
277 /** 277 /**
278 * Assert that the number of errors that have been gathered matches the number of errors that are 278 * Assert that the number of errors that have been gathered matches the number of errors that are
279 * given and that they have the expected error codes. The order in which the e rrors were gathered 279 * given and that they have the expected error codes. The order in which the e rrors were gathered
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 } 318 }
319 /** 319 /**
320 * Search through the given list of errors for an error that is equal to the t arget error. If one 320 * Search through the given list of errors for an error that is equal to the t arget error. If one
321 * is found, remove it from the list and return {@code true}, otherwise return {@code false}without modifying the list. 321 * is found, remove it from the list and return {@code true}, otherwise return {@code false}without modifying the list.
322 * @param errors the errors through which we are searching 322 * @param errors the errors through which we are searching
323 * @param targetError the error being searched for 323 * @param targetError the error being searched for
324 * @return {@code true} if the error is found and removed from the list 324 * @return {@code true} if the error is found and removed from the list
325 */ 325 */
326 bool foundAndRemoved(List<AnalysisError> errors, AnalysisError targetError) { 326 bool foundAndRemoved(List<AnalysisError> errors, AnalysisError targetError) {
327 for (AnalysisError error in errors) { 327 for (AnalysisError error in errors) {
328 if (equals(error, targetError)) { 328 if (equals3(error, targetError)) {
329 errors.remove(error); 329 errors.remove(error);
330 return true; 330 return true;
331 } 331 }
332 } 332 }
333 return true; 333 return true;
334 } 334 }
335 } 335 }
336 /** 336 /**
337 * The class {@code EngineTestCase} defines utility methods for making assertion s. 337 * The class {@code EngineTestCase} defines utility methods for making assertion s.
338 */ 338 */
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 665 }
666 Source resolve(String uri) { 666 Source resolve(String uri) {
667 throw new UnsupportedOperationException(); 667 throw new UnsupportedOperationException();
668 } 668 }
669 Source resolveRelative(Uri uri) { 669 Source resolveRelative(Uri uri) {
670 throw new UnsupportedOperationException(); 670 throw new UnsupportedOperationException();
671 } 671 }
672 } 672 }
673 673
674 /** 674 /**
675 * Wrapper around [Function] which should be called with [target] and [arguments ]. 675 * Wrapper around [Function] which should be called with "target" and "arguments ".
676 */ 676 */
677 class MethodTrampoline { 677 class MethodTrampoline {
678 int parameterCount; 678 int parameterCount;
679 Function trampoline; 679 Function trampoline;
680 MethodTrampoline(this.parameterCount, this.trampoline); 680 MethodTrampoline(this.parameterCount, this.trampoline);
681 Object invoke(target, List arguments) { 681 Object invoke(target, List arguments) {
682 if (arguments.length != parameterCount) { 682 if (arguments.length != parameterCount) {
683 throw new IllegalArgumentException("${arguments.length} != $parameterCount "); 683 throw new IllegalArgumentException("${arguments.length} != $parameterCount ");
684 } 684 }
685 switch (parameterCount) { 685 switch (parameterCount) {
686 case 0: 686 case 0:
687 return trampoline(target); 687 return trampoline(target);
688 case 1: 688 case 1:
689 return trampoline(target, arguments[0]); 689 return trampoline(target, arguments[0]);
690 case 2: 690 case 2:
691 return trampoline(target, arguments[0], arguments[1]); 691 return trampoline(target, arguments[0], arguments[1]);
692 case 3: 692 case 3:
693 return trampoline(target, arguments[0], arguments[1], arguments[2]); 693 return trampoline(target, arguments[0], arguments[1], arguments[2]);
694 case 4: 694 case 4:
695 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]); 695 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]);
696 default: 696 default:
697 throw new IllegalArgumentException("Not implemented for > 4 arguments"); 697 throw new IllegalArgumentException("Not implemented for > 4 arguments");
698 } 698 }
699 } 699 }
700 } 700 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698