OLD | NEW |
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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.test_support; | 8 library engine.test_support; |
9 | 9 |
10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
11 import 'package:analyzer/src/generated/java_junit.dart'; | 11 import 'package:analyzer/src/generated/java_junit.dart'; |
12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
13 import 'package:analyzer/src/generated/error.dart'; | 13 import 'package:analyzer/src/generated/error.dart'; |
14 import 'package:analyzer/src/generated/scanner.dart'; | 14 import 'package:analyzer/src/generated/scanner.dart'; |
15 import 'package:analyzer/src/generated/ast.dart' show ASTNode, NodeLocator; | 15 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; |
16 import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodE
lement, PropertyAccessorElement; | 16 import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodE
lement, PropertyAccessorElement; |
17 import 'package:analyzer/src/generated/engine.dart'; | 17 import 'package:analyzer/src/generated/engine.dart'; |
18 import 'package:unittest/unittest.dart' as _ut; | 18 import 'package:unittest/unittest.dart' as _ut; |
19 | 19 |
20 /** | 20 /** |
21 * Instances of the class `GatheringErrorListener` implement an error listener t
hat collects | 21 * Instances of the class `GatheringErrorListener` implement an error listener t
hat collects |
22 * all of the errors passed to it for later examination. | 22 * all of the errors passed to it for later examination. |
23 */ | 23 */ |
24 class GatheringErrorListener implements AnalysisErrorListener { | 24 class GatheringErrorListener implements AnalysisErrorListener { |
25 /** | 25 /** |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 */ | 715 */ |
716 static String createSource(List<String> lines) { | 716 static String createSource(List<String> lines) { |
717 PrintStringWriter writer = new PrintStringWriter(); | 717 PrintStringWriter writer = new PrintStringWriter(); |
718 for (String line in lines) { | 718 for (String line in lines) { |
719 writer.println(line); | 719 writer.println(line); |
720 } | 720 } |
721 return writer.toString(); | 721 return writer.toString(); |
722 } | 722 } |
723 | 723 |
724 /** | 724 /** |
725 * @return the [ASTNode] with requested type at offset of the "prefix". | 725 * @return the [AstNode] with requested type at offset of the "prefix". |
726 */ | 726 */ |
727 static ASTNode findNode(ASTNode root, String code, String prefix, Type clazz)
{ | 727 static AstNode findNode(AstNode root, String code, String prefix, Type clazz)
{ |
728 int offset = code.indexOf(prefix); | 728 int offset = code.indexOf(prefix); |
729 if (offset == -1) { | 729 if (offset == -1) { |
730 throw new IllegalArgumentException("Not found '${prefix}'."); | 730 throw new IllegalArgumentException("Not found '${prefix}'."); |
731 } | 731 } |
732 ASTNode node = new NodeLocator.con1(offset).searchWithin(root); | 732 AstNode node = new NodeLocator.con1(offset).searchWithin(root); |
733 return node.getAncestor(clazz); | 733 return node.getAncestor(clazz); |
734 } | 734 } |
735 | 735 |
736 static void assertContains2(List<Object> array, List<bool> found, Object eleme
nt) { | 736 static void assertContains2(List<Object> array, List<bool> found, Object eleme
nt) { |
737 if (element == null) { | 737 if (element == null) { |
738 for (int i = 0; i < array.length; i++) { | 738 for (int i = 0; i < array.length; i++) { |
739 if (!found[i]) { | 739 if (!found[i]) { |
740 if (array[i] == null) { | 740 if (array[i] == null) { |
741 found[i] = true; | 741 found[i] = true; |
742 return; | 742 return; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 return trampoline(target, arguments[0], arguments[1]); | 889 return trampoline(target, arguments[0], arguments[1]); |
890 case 3: | 890 case 3: |
891 return trampoline(target, arguments[0], arguments[1], arguments[2]); | 891 return trampoline(target, arguments[0], arguments[1], arguments[2]); |
892 case 4: | 892 case 4: |
893 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); | 893 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); |
894 default: | 894 default: |
895 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | 895 throw new IllegalArgumentException("Not implemented for > 4 arguments"); |
896 } | 896 } |
897 } | 897 } |
898 } | 898 } |
OLD | NEW |