| 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 library analyzer.src.summary.summary_sdk; | 5 library analyzer.src.summary.summary_sdk; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; | 9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; |
| 10 import 'package:analyzer/src/context/context.dart'; | 10 import 'package:analyzer/src/context/context.dart'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 bool compute(CacheEntry entry, ResultDescriptor result) { | 43 bool compute(CacheEntry entry, ResultDescriptor result) { |
| 44 if (result == TYPE_PROVIDER) { | 44 if (result == TYPE_PROVIDER) { |
| 45 entry.setValue(result, typeProvider, TargetedResult.EMPTY_LIST); | 45 entry.setValue(result, typeProvider, TargetedResult.EMPTY_LIST); |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 AnalysisTarget target = entry.target; | 48 AnalysisTarget target = entry.target; |
| 49 // Only SDK sources after this point. | 49 // Only SDK sources after this point. |
| 50 if (target.source == null || !target.source.isInSystemLibrary) { | 50 if (target.source == null || !target.source.isInSystemLibrary) { |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 // print('SummarySdkAnalysisContext: $result of $target'); | |
| 54 // Constant expressions are always resolved in summaries. | 53 // Constant expressions are always resolved in summaries. |
| 55 if (result == CONSTANT_EXPRESSION_RESOLVED && | 54 if (result == CONSTANT_EXPRESSION_RESOLVED && |
| 56 target is ConstantEvaluationTarget) { | 55 target is ConstantEvaluationTarget) { |
| 57 entry.setValue(result, true, TargetedResult.EMPTY_LIST); | 56 entry.setValue(result, true, TargetedResult.EMPTY_LIST); |
| 58 return true; | 57 return true; |
| 59 } | 58 } |
| 60 if (target is Source) { | 59 if (target is Source) { |
| 61 if (result == LIBRARY_ELEMENT1 || | 60 if (result == LIBRARY_ELEMENT1 || |
| 62 result == LIBRARY_ELEMENT2 || | 61 result == LIBRARY_ELEMENT2 || |
| 63 result == LIBRARY_ELEMENT3 || | 62 result == LIBRARY_ELEMENT3 || |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 if (kind != null) { | 83 if (kind != null) { |
| 85 entry.setValue(result, kind, TargetedResult.EMPTY_LIST); | 84 entry.setValue(result, kind, TargetedResult.EMPTY_LIST); |
| 86 return true; | 85 return true; |
| 87 } | 86 } |
| 88 return false; | 87 return false; |
| 89 } else { | 88 } else { |
| 90 // throw new UnimplementedError('$result of $target'); | 89 // throw new UnimplementedError('$result of $target'); |
| 91 } | 90 } |
| 92 } | 91 } |
| 93 if (target is LibrarySpecificUnit) { | 92 if (target is LibrarySpecificUnit) { |
| 93 if (target.library == null || !target.library.isInSystemLibrary) { |
| 94 return false; |
| 95 } |
| 94 if (result == COMPILATION_UNIT_ELEMENT) { | 96 if (result == COMPILATION_UNIT_ELEMENT) { |
| 95 String uri1 = target.library.uri.toString(); | 97 String libraryUri = target.library.uri.toString(); |
| 96 String uri2 = target.unit.uri.toString(); | 98 String unitUri = target.unit.uri.toString(); |
| 97 CompilationUnitElement unit = resynthesizer | 99 CompilationUnitElement unit = resynthesizer.getElement( |
| 98 .getElement(new ElementLocationImpl.con3(<String>[uri1, uri2])); | 100 new ElementLocationImpl.con3(<String>[libraryUri, unitUri])); |
| 99 if (unit != null) { | 101 if (unit != null) { |
| 100 entry.setValue(result, unit, TargetedResult.EMPTY_LIST); | 102 entry.setValue(result, unit, TargetedResult.EMPTY_LIST); |
| 101 return true; | 103 return true; |
| 102 } | 104 } |
| 103 } | 105 } |
| 104 } | 106 } |
| 105 return false; | 107 return false; |
| 106 } | 108 } |
| 107 | 109 |
| 108 void _buildAsyncLibrary() { | 110 void _buildAsyncLibrary() { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 * throw a [StateError] if there is no class with the given name. | 406 * throw a [StateError] if there is no class with the given name. |
| 405 */ | 407 */ |
| 406 InterfaceType _getType(LibraryElement library, String name) { | 408 InterfaceType _getType(LibraryElement library, String name) { |
| 407 Element element = library.getType(name); | 409 Element element = library.getType(name); |
| 408 if (element == null) { | 410 if (element == null) { |
| 409 throw new StateError("No definition of type $name"); | 411 throw new StateError("No definition of type $name"); |
| 410 } | 412 } |
| 411 return (element as ClassElement).type; | 413 return (element as ClassElement).type; |
| 412 } | 414 } |
| 413 } | 415 } |
| OLD | NEW |