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

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/optype_test.dart

Issue 2034713004: improve completions in closures and switch statements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge 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/analysis_server/test/services/completion/dart/keyword_contributor_test.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 test.services.completion.contributor.dart.optype; 5 library test.services.completion.contributor.dart.optype;
6 6
7 import 'package:analysis_server/src/protocol_server.dart'; 7 import 'package:analysis_server/src/protocol_server.dart';
8 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart'; 8 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart';
9 import 'package:analysis_server/src/services/completion/dart/optype.dart'; 9 import 'package:analysis_server/src/services/completion/dart/optype.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 addTestSource('void main() {int.parse("16", ^)}', resolved: true); 135 addTestSource('void main() {int.parse("16", ^)}', resolved: true);
136 assertOpType(namedArgs: true); 136 assertOpType(namedArgs: true);
137 } 137 }
138 138
139 test_AsExpression() { 139 test_AsExpression() {
140 // SimpleIdentifier TypeName AsExpression 140 // SimpleIdentifier TypeName AsExpression
141 addTestSource('class A {var b; X _c; foo() {var a; (a as ^).foo();}'); 141 addTestSource('class A {var b; X _c; foo() {var a; (a as ^).foo();}');
142 assertOpType(typeNames: true); 142 assertOpType(typeNames: true);
143 } 143 }
144 144
145 test_AsIdentifier() {
146 addTestSource('class A {var asdf; foo() {as^}');
147 assertOpType(returnValue: true, typeNames: true, voidReturn: true);
148 }
149
150 test_AsIdentifier2() {
151 addTestSource('class A {var asdf; foo() {A as^}');
152 assertOpType();
153 }
154
145 test_Assert() { 155 test_Assert() {
146 addTestSource('main() {assert(^)}'); 156 addTestSource('main() {assert(^)}');
147 assertOpType(returnValue: true, typeNames: true); 157 assertOpType(returnValue: true, typeNames: true);
148 } 158 }
149 159
150 test_AssignmentExpression_name() { 160 test_AssignmentExpression_name() {
151 // SimpleIdentifier VariableDeclaration VariableDeclarationList 161 // SimpleIdentifier VariableDeclaration VariableDeclarationList
152 // VariableDeclarationStatement Block 162 // VariableDeclarationStatement Block
153 addTestSource('class A {} main() {int a; int ^b = 1;}'); 163 addTestSource('class A {} main() {int a; int ^b = 1;}');
154 assertOpType(varNames: true); 164 assertOpType(varNames: true);
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 addTestSource('main() {switch(k) {^}}'); 1362 addTestSource('main() {switch(k) {^}}');
1353 assertOpType(); 1363 assertOpType();
1354 } 1364 }
1355 1365
1356 test_SwitchStatement_body_end() { 1366 test_SwitchStatement_body_end() {
1357 // Token('}') SwitchStatement Block 1367 // Token('}') SwitchStatement Block
1358 addTestSource('main() {switch(k) {case 1:^}}'); 1368 addTestSource('main() {switch(k) {case 1:^}}');
1359 assertOpType(returnValue: true, typeNames: true, voidReturn: true); 1369 assertOpType(returnValue: true, typeNames: true, voidReturn: true);
1360 } 1370 }
1361 1371
1372 test_SwitchStatement_body_end2() {
1373 addTestSource('main() {switch(k) {case 1:as^}}');
1374 assertOpType(returnValue: true, typeNames: true, voidReturn: true);
1375 }
1376
1362 test_SwitchStatement_expression1() { 1377 test_SwitchStatement_expression1() {
1363 // SimpleIdentifier SwitchStatement Block 1378 // SimpleIdentifier SwitchStatement Block
1364 addTestSource('main() {switch(^k) {case 1:{}}}'); 1379 addTestSource('main() {switch(^k) {case 1:{}}}');
1365 assertOpType(returnValue: true, typeNames: true); 1380 assertOpType(returnValue: true, typeNames: true);
1366 } 1381 }
1367 1382
1368 test_SwitchStatement_expression2() { 1383 test_SwitchStatement_expression2() {
1369 // SimpleIdentifier SwitchStatement Block 1384 // SimpleIdentifier SwitchStatement Block
1370 addTestSource('main() {switch(k^) {case 1:{}}}'); 1385 addTestSource('main() {switch(k^) {case 1:{}}}');
1371 assertOpType(returnValue: true, typeNames: true); 1386 assertOpType(returnValue: true, typeNames: true);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 bool get isInSystemLibrary => false; 1567 bool get isInSystemLibrary => false;
1553 1568
1554 @override 1569 @override
1555 String get shortName => fullName; 1570 String get shortName => fullName;
1556 1571
1557 @override 1572 @override
1558 Source get source => this; 1573 Source get source => this;
1559 1574
1560 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 1575 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
1561 } 1576 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698