| 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 engine.resolver_test; | 5 library engine.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 12233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12244 LibraryElement library = resolve(source); | 12244 LibraryElement library = resolve(source); |
| 12245 assertNoErrors(source); | 12245 assertNoErrors(source); |
| 12246 CompilationUnit unit = resolveCompilationUnit(source, library); | 12246 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 12247 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; | 12247 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; |
| 12248 BlockFunctionBody body = | 12248 BlockFunctionBody body = |
| 12249 function.functionExpression.body as BlockFunctionBody; | 12249 function.functionExpression.body as BlockFunctionBody; |
| 12250 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 12250 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 12251 ReturnStatement statement = | 12251 ReturnStatement statement = |
| 12252 (ifStatement.thenStatement as Block).statements[0] as ReturnStatement; | 12252 (ifStatement.thenStatement as Block).statements[0] as ReturnStatement; |
| 12253 MethodInvocation invocation = statement.expression as MethodInvocation; | 12253 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 12254 expect(invocation.methodName.propagatedElement, isNotNull); | 12254 expect(invocation.methodName.staticElement, isNotNull); |
| 12255 expect(invocation.methodName.propagatedElement, isNull); |
| 12255 } | 12256 } |
| 12256 | 12257 |
| 12257 void test_is_while() { | 12258 void test_is_while() { |
| 12258 Source source = addSource(r''' | 12259 Source source = addSource(r''' |
| 12259 class A {} | 12260 class A {} |
| 12260 A f(var p) { | 12261 A f(var p) { |
| 12261 while (p is A) { | 12262 while (p is A) { |
| 12262 return p; | 12263 return p; |
| 12263 } | 12264 } |
| 12264 return p; | 12265 return p; |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13461 // check propagated type | 13462 // check propagated type |
| 13462 FunctionType propagatedType = node.propagatedType as FunctionType; | 13463 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13463 expect(propagatedType.returnType, test.typeProvider.stringType); | 13464 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13464 } on AnalysisException catch (e, stackTrace) { | 13465 } on AnalysisException catch (e, stackTrace) { |
| 13465 thrownException[0] = new CaughtException(e, stackTrace); | 13466 thrownException[0] = new CaughtException(e, stackTrace); |
| 13466 } | 13467 } |
| 13467 } | 13468 } |
| 13468 return null; | 13469 return null; |
| 13469 } | 13470 } |
| 13470 } | 13471 } |
| OLD | NEW |