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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 2068123003: Skip class method type parameters and formal parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/task/dart.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.src.task.dart_test; 5 library analyzer.test.src.task.dart_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 4024 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 ReferencedNames info = _computeReferencedNames(''' 4035 ReferencedNames info = _computeReferencedNames('''
4036 class U { 4036 class U {
4037 A get a => new B(); 4037 A get a => new B();
4038 } 4038 }
4039 '''); 4039 ''');
4040 expect(info.names, unorderedEquals(['A', 'B'])); 4040 expect(info.names, unorderedEquals(['A', 'B']));
4041 expect(info.userToDependsOn.keys, unorderedEquals(['U'])); 4041 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
4042 expect(info.userToDependsOn['U'], unorderedEquals(['A'])); 4042 expect(info.userToDependsOn['U'], unorderedEquals(['A']));
4043 } 4043 }
4044 4044
4045 test_referencedNames_class_members() {
4046 ReferencedNames info = _computeReferencedNames('''
4047 class U {
4048 int a;
4049 int get b;
4050 set c(_) {}
4051 m(D d) {
4052 a;
4053 b;
4054 c = 1;
4055 m();
4056 }
4057 }
4058 ''');
4059 expect(info.names, unorderedEquals(['int', 'D']));
4060 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
4061 expect(info.userToDependsOn['U'], unorderedEquals(['int', 'D']));
4062 }
4063
4064 test_referencedNames_class_members_dontHideQualified() {
4065 ReferencedNames info = _computeReferencedNames('''
4066 class U {
4067 int a;
4068 int get b;
4069 set c(_) {}
4070 m(D d) {
4071 d.a;
4072 d.b;
4073 d.c;
4074 }
4075 }
4076 ''');
4077 expect(info.names, unorderedEquals(['int', 'D', 'a', 'b', 'c']));
4078 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
4079 expect(info.userToDependsOn['U'], unorderedEquals(['int', 'D']));
4080 }
4081
4045 test_referencedNames_class_method() { 4082 test_referencedNames_class_method() {
4046 ReferencedNames info = _computeReferencedNames(''' 4083 ReferencedNames info = _computeReferencedNames('''
4047 class U { 4084 class U {
4048 A m(B p) { 4085 A m(B p) {
4049 C v = 0; 4086 C v = 0;
4050 } 4087 }
4051 } 4088 }
4052 '''); 4089 ''');
4053 expect(info.names, unorderedEquals(['A', 'B', 'C'])); 4090 expect(info.names, unorderedEquals(['A', 'B', 'C']));
4054 expect(info.userToDependsOn.keys, unorderedEquals(['U'])); 4091 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
4055 expect(info.userToDependsOn['U'], unorderedEquals(['A', 'B'])); 4092 expect(info.userToDependsOn['U'], unorderedEquals(['A', 'B']));
4056 } 4093 }
4057 4094
4095 test_referencedNames_class_method_localVariables() {
4096 ReferencedNames info = _computeReferencedNames('''
4097 class U {
4098 A m() {
4099 B b = null;
4100 b;
4101 {
4102 C c = null;
4103 b;
4104 c;
4105 }
4106 d;
4107 }
4108 }
4109 ''');
4110 expect(info.names, unorderedEquals(['A', 'B', 'C', 'd']));
4111 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
4112 expect(info.userToDependsOn['U'], unorderedEquals(['A']));
4113 }
4114
4115 test_referencedNames_class_method_parameters() {
4116 ReferencedNames info = _computeReferencedNames('''
4117 class U {
4118 m(A a) {
4119 a;
4120 b;
4121 }
4122 }
4123 ''');
4124 expect(info.names, unorderedEquals(['A', 'b']));
4125 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
4126 expect(info.userToDependsOn['U'], unorderedEquals(['A']));
4127 }
4128
4129 test_referencedNames_class_method_typeParameters() {
4130 ReferencedNames info = _computeReferencedNames('''
4131 class U {
4132 A m<T>(B b, T t) {
4133 C c = 0;
4134 }
4135 }
4136 ''');
4137 expect(info.names, unorderedEquals(['A', 'B', 'C']));
4138 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
4139 expect(info.userToDependsOn['U'], unorderedEquals(['A', 'B']));
4140 }
4141
4058 test_referencedNames_class_setter() { 4142 test_referencedNames_class_setter() {
4059 ReferencedNames info = _computeReferencedNames(''' 4143 ReferencedNames info = _computeReferencedNames('''
4060 class U { 4144 class U {
4061 set a(A a) { 4145 set a(A a) {
4062 B b = null; 4146 B b = null;
4063 } 4147 }
4064 } 4148 }
4065 '''); 4149 ''');
4066 expect(info.names, unorderedEquals(['A', 'B'])); 4150 expect(info.names, unorderedEquals(['A', 'B']));
4067 expect(info.userToDependsOn.keys, unorderedEquals(['U'])); 4151 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
5595 /** 5679 /**
5596 * Fill [errorListener] with [result] errors in the current [task]. 5680 * Fill [errorListener] with [result] errors in the current [task].
5597 */ 5681 */
5598 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 5682 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
5599 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; 5683 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>;
5600 expect(errors, isNotNull, reason: result.name); 5684 expect(errors, isNotNull, reason: result.name);
5601 errorListener = new GatheringErrorListener(); 5685 errorListener = new GatheringErrorListener();
5602 errorListener.addAll(errors); 5686 errorListener.addAll(errors);
5603 } 5687 }
5604 } 5688 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698