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

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

Issue 1897713002: Make analyzer more strong mode compliant (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/task/model.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.resolver_test_case; 5 library analyzer.test.generated.resolver_test_case;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/visitor.dart'; 8 import 'package:analyzer/dart/ast/visitor.dart';
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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 /** 749 /**
750 * Looks up the identifier with [name] and validates that its type type 750 * Looks up the identifier with [name] and validates that its type type
751 * stringifies to [type] and that its generics match the given stringified 751 * stringifies to [type] and that its generics match the given stringified
752 * output. 752 * output.
753 */ 753 */
754 expectFunctionType(String name, String type, 754 expectFunctionType(String name, String type,
755 {String elementTypeParams: '[]', 755 {String elementTypeParams: '[]',
756 String typeParams: '[]', 756 String typeParams: '[]',
757 String typeArgs: '[]', 757 String typeArgs: '[]',
758 String typeFormals: '[]'}) { 758 String typeFormals: '[]'}) {
759 typeParameters(Element element) {
760 if (element is ExecutableElement) {
761 return element.typeParameters;
762 } else if (element is ParameterElement) {
763 return element.typeParameters;
764 }
765 fail('Wrong element type: ${element.runtimeType}');
766 }
759 SimpleIdentifier identifier = findIdentifier(name); 767 SimpleIdentifier identifier = findIdentifier(name);
760 // Element is either ExecutableElement or ParameterElement. 768 // Element is either ExecutableElement or ParameterElement.
761 var element = identifier.staticElement; 769 Element element = identifier.staticElement;
762 FunctionTypeImpl functionType = identifier.staticType; 770 FunctionTypeImpl functionType = identifier.staticType;
763 expect(functionType.toString(), type); 771 expect(functionType.toString(), type);
764 expect(element.typeParameters.toString(), elementTypeParams); 772 expect(typeParameters(element).toString(), elementTypeParams);
765 expect(functionType.typeParameters.toString(), typeParams); 773 expect(functionType.typeParameters.toString(), typeParams);
766 expect(functionType.typeArguments.toString(), typeArgs); 774 expect(functionType.typeArguments.toString(), typeArgs);
767 expect(functionType.typeFormals.toString(), typeFormals); 775 expect(functionType.typeFormals.toString(), typeFormals);
768 } 776 }
769 777
770 /** 778 /**
771 * Looks up the identifier with [name] and validates its static [type]. 779 * Looks up the identifier with [name] and validates its static [type].
772 * 780 *
773 * If [type] is a string, validates that the identifier's static type 781 * If [type] is a string, validates that the identifier's static type
774 * stringifies to that text. Otherwise, [type] is used directly a [Matcher] 782 * stringifies to that text. Otherwise, [type] is used directly a [Matcher]
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 * text. Otherwise, [expected] is used directly a [Matcher] to match the type. 837 * text. Otherwise, [expected] is used directly a [Matcher] to match the type.
830 */ 838 */
831 _expectType(DartType type, expected) { 839 _expectType(DartType type, expected) {
832 if (expected is String) { 840 if (expected is String) {
833 expect(type.toString(), expected); 841 expect(type.toString(), expected);
834 } else { 842 } else {
835 expect(type, expected); 843 expect(type, expected);
836 } 844 }
837 } 845 }
838 } 846 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/task/model.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698