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/context/context.dart' as newContext; | 9 import 'package:analyzer/src/context/context.dart' as newContext; |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
(...skipping 9149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9160 void test_localVariable_types_invoked() { | 9160 void test_localVariable_types_invoked() { |
9161 Source source = addSource(r''' | 9161 Source source = addSource(r''' |
9162 const A = null; | 9162 const A = null; |
9163 main() { | 9163 main() { |
9164 var myVar = (int p) => 'foo'; | 9164 var myVar = (int p) => 'foo'; |
9165 myVar(42); | 9165 myVar(42); |
9166 }'''); | 9166 }'''); |
9167 LibraryElement library = resolve(source); | 9167 LibraryElement library = resolve(source); |
9168 expect(library, isNotNull); | 9168 expect(library, isNotNull); |
9169 CompilationUnit unit = | 9169 CompilationUnit unit = |
9170 analysisContext.getResolvedCompilationUnit(source, library); | 9170 analysisContext.resolveCompilationUnit(source, library); |
9171 expect(unit, isNotNull); | 9171 expect(unit, isNotNull); |
9172 List<bool> found = [false]; | 9172 List<bool> found = [false]; |
9173 List<CaughtException> thrownException = new List<CaughtException>(1); | 9173 List<CaughtException> thrownException = new List<CaughtException>(1); |
9174 unit.accept(new _SimpleResolverTest_localVariable_types_invoked( | 9174 unit.accept(new _SimpleResolverTest_localVariable_types_invoked( |
9175 this, found, thrownException)); | 9175 this, found, thrownException)); |
9176 if (thrownException[0] != null) { | 9176 if (thrownException[0] != null) { |
9177 throw new AnalysisException( | 9177 throw new AnalysisException( |
9178 "Exception", new CaughtException(thrownException[0], null)); | 9178 "Exception", new CaughtException(thrownException[0], null)); |
9179 } | 9179 } |
9180 expect(found[0], isTrue); | 9180 expect(found[0], isTrue); |
(...skipping 4694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13875 // check propagated type | 13875 // check propagated type |
13876 FunctionType propagatedType = node.propagatedType as FunctionType; | 13876 FunctionType propagatedType = node.propagatedType as FunctionType; |
13877 expect(propagatedType.returnType, test.typeProvider.stringType); | 13877 expect(propagatedType.returnType, test.typeProvider.stringType); |
13878 } on AnalysisException catch (e, stackTrace) { | 13878 } on AnalysisException catch (e, stackTrace) { |
13879 thrownException[0] = new CaughtException(e, stackTrace); | 13879 thrownException[0] = new CaughtException(e, stackTrace); |
13880 } | 13880 } |
13881 } | 13881 } |
13882 return null; | 13882 return null; |
13883 } | 13883 } |
13884 } | 13884 } |
OLD | NEW |