OLD | NEW |
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 /// Encapsulates how to invoke the analyzer resolver and overrides how it | 5 /// Encapsulates how to invoke the analyzer resolver and overrides how it |
6 /// computes types on expressions to use our restricted set of types. | 6 /// computes types on expressions to use our restricted set of types. |
7 library ddc.src.checker.resolver; | 7 library dev_compiler.src.checker.resolver; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
11 import 'package:analyzer/src/generated/element.dart'; | 11 import 'package:analyzer/src/generated/element.dart'; |
12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
13 import 'package:analyzer/src/generated/error.dart'; | 13 import 'package:analyzer/src/generated/error.dart'; |
14 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; | 14 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; |
15 import 'package:analyzer/src/generated/resolver.dart'; | 15 import 'package:analyzer/src/generated/resolver.dart'; |
16 import 'package:analyzer/src/generated/static_type_analyzer.dart'; | 16 import 'package:analyzer/src/generated/static_type_analyzer.dart'; |
17 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 17 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
18 import 'package:analyzer/src/generated/source.dart' show DartUriResolver; | 18 import 'package:analyzer/src/generated/source.dart' show DartUriResolver; |
19 import 'package:analyzer/src/generated/source.dart' show Source; | 19 import 'package:analyzer/src/generated/source.dart' show Source; |
20 import 'package:analyzer/src/generated/source_io.dart'; | 20 import 'package:analyzer/src/generated/source_io.dart'; |
21 import 'package:logging/logging.dart' as logger; | 21 import 'package:logging/logging.dart' as logger; |
22 | 22 |
23 import 'package:dev_compiler/src/options.dart'; | 23 import 'package:dev_compiler/src/options.dart'; |
24 import 'package:dev_compiler/src/report.dart'; | 24 import 'package:dev_compiler/src/report.dart'; |
25 import 'package:dev_compiler/src/utils.dart'; | 25 import 'package:dev_compiler/src/utils.dart'; |
26 import 'dart_sdk.dart'; | 26 import 'dart_sdk.dart'; |
27 import 'multi_package_resolver.dart'; | 27 import 'multi_package_resolver.dart'; |
28 | 28 |
29 final _log = new logger.Logger('ddc.src.resolver'); | 29 final _log = new logger.Logger('dev_compiler.src.resolver'); |
30 | 30 |
31 /// Encapsulates a resolver from the analyzer package. | 31 /// Encapsulates a resolver from the analyzer package. |
32 class TypeResolver { | 32 class TypeResolver { |
33 final InternalAnalysisContext context; | 33 final InternalAnalysisContext context; |
34 | 34 |
35 final Map<Uri, Source> _sources = <Uri, Source>{}; | 35 final Map<Uri, Source> _sources = <Uri, Source>{}; |
36 | 36 |
37 TypeResolver(DartUriResolver sdkResolver, ResolverOptions options, | 37 TypeResolver(DartUriResolver sdkResolver, ResolverOptions options, |
38 {List otherResolvers}) | 38 {List otherResolvers}) |
39 : context = _initContext(options) { | 39 : context = _initContext(options) { |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 element.returnType.isDynamic && | 438 element.returnType.isDynamic && |
439 node.returnType == null) { | 439 node.returnType == null) { |
440 var type = searchTypeFor(element.enclosingElement.type, element); | 440 var type = searchTypeFor(element.enclosingElement.type, element); |
441 if (type != null && !type.returnType.isDynamic) { | 441 if (type != null && !type.returnType.isDynamic) { |
442 element.returnType = type.returnType; | 442 element.returnType = type.returnType; |
443 } | 443 } |
444 } | 444 } |
445 return res; | 445 return res; |
446 } | 446 } |
447 } | 447 } |
OLD | NEW |