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 library analyzer.test.generated.all_the_rest_test; | 5 library analyzer.test.generated.all_the_rest_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/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 3944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3955 return; | 3955 return; |
3956 if (1 < 2) { | 3956 if (1 < 2) { |
3957 break x; | 3957 break x; |
3958 } | 3958 } |
3959 } | 3959 } |
3960 } | 3960 } |
3961 '''); | 3961 '''); |
3962 _assertNthStatementExits(source, 0); | 3962 _assertNthStatementExits(source, 0); |
3963 } | 3963 } |
3964 | 3964 |
| 3965 void test_yieldStatement_plain() { |
| 3966 Source source = addSource(r''' |
| 3967 void f() sync* { |
| 3968 yield 1; |
| 3969 } |
| 3970 '''); |
| 3971 _assertNthStatementDoesNotExit(source, 0); |
| 3972 } |
| 3973 |
| 3974 void test_yieldStatement_throw() { |
| 3975 Source source = addSource(r''' |
| 3976 void f() sync* { |
| 3977 yield throw ''; |
| 3978 } |
| 3979 '''); |
| 3980 _assertNthStatementExits(source, 0); |
| 3981 } |
| 3982 |
| 3983 void test_yieldStatement_star_plain() { |
| 3984 Source source = addSource(r''' |
| 3985 void f() sync* { |
| 3986 yield* 1; |
| 3987 } |
| 3988 '''); |
| 3989 _assertNthStatementDoesNotExit(source, 0); |
| 3990 } |
| 3991 |
| 3992 void test_yieldStatement_star_throw() { |
| 3993 Source source = addSource(r''' |
| 3994 void f() sync* { |
| 3995 yield* throw ''; |
| 3996 } |
| 3997 '''); |
| 3998 _assertNthStatementExits(source, 0); |
| 3999 } |
| 4000 |
3965 void _assertHasReturn(bool expectedResult, Source source, int n) { | 4001 void _assertHasReturn(bool expectedResult, Source source, int n) { |
3966 LibraryElement element = resolve2(source); | 4002 LibraryElement element = resolve2(source); |
3967 CompilationUnit unit = resolveCompilationUnit(source, element); | 4003 CompilationUnit unit = resolveCompilationUnit(source, element); |
3968 FunctionDeclaration function = unit.declarations.last; | 4004 FunctionDeclaration function = unit.declarations.last; |
3969 BlockFunctionBody body = function.functionExpression.body; | 4005 BlockFunctionBody body = function.functionExpression.body; |
3970 Statement statement = body.block.statements[n]; | 4006 Statement statement = body.block.statements[n]; |
3971 expect(ExitDetector.exits(statement), expectedResult); | 4007 expect(ExitDetector.exits(statement), expectedResult); |
3972 } | 4008 } |
3973 | 4009 |
3974 // Assert that the [n]th statement in the last function declaration of | 4010 // Assert that the [n]th statement in the last function declaration of |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); | 4391 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); |
4356 expect(UriKind.fromEncoding(0x58), same(null)); | 4392 expect(UriKind.fromEncoding(0x58), same(null)); |
4357 } | 4393 } |
4358 | 4394 |
4359 void test_getEncoding() { | 4395 void test_getEncoding() { |
4360 expect(UriKind.DART_URI.encoding, 0x64); | 4396 expect(UriKind.DART_URI.encoding, 0x64); |
4361 expect(UriKind.FILE_URI.encoding, 0x66); | 4397 expect(UriKind.FILE_URI.encoding, 0x66); |
4362 expect(UriKind.PACKAGE_URI.encoding, 0x70); | 4398 expect(UriKind.PACKAGE_URI.encoding, 0x70); |
4363 } | 4399 } |
4364 } | 4400 } |
OLD | NEW |