| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 dart2js.resolution_strategy; | 5 library dart2js.resolution_strategy; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common_elements.dart'; | 8 import '../common_elements.dart'; |
| 9 import '../common/resolution.dart'; | 9 import '../common/resolution.dart'; |
| 10 import '../common/tasks.dart'; | 10 import '../common/tasks.dart'; |
| 11 import '../compiler.dart'; | 11 import '../compiler.dart'; |
| 12 import '../elements/elements.dart'; | 12 import '../elements/elements.dart'; |
| 13 import '../elements/entities.dart'; | 13 import '../elements/entities.dart'; |
| 14 import '../elements/resolution_types.dart'; | 14 import '../elements/resolution_types.dart'; |
| 15 import '../environment.dart'; | 15 import '../environment.dart'; |
| 16 import '../frontend_strategy.dart'; | 16 import '../frontend_strategy.dart'; |
| 17 import '../js_backend/native_data.dart'; |
| 17 import '../library_loader.dart'; | 18 import '../library_loader.dart'; |
| 18 import '../native/resolver.dart'; | 19 import '../native/resolver.dart'; |
| 19 import '../js_backend/native_data.dart'; | |
| 20 import '../serialization/task.dart'; | 20 import '../serialization/task.dart'; |
| 21 import '../patch_parser.dart'; | 21 import '../patch_parser.dart'; |
| 22 import '../resolved_uri_translator.dart'; | 22 import '../resolved_uri_translator.dart'; |
| 23 import '../universe/call_structure.dart'; | 23 import '../universe/call_structure.dart'; |
| 24 | 24 |
| 25 /// [FrontendStrategy] that loads '.dart' files and creates a resolved element | 25 /// [FrontendStrategy] that loads '.dart' files and creates a resolved element |
| 26 /// model using the resolver. | 26 /// model using the resolver. |
| 27 class ResolutionFrontEndStrategy implements FrontEndStrategy { | 27 class ResolutionFrontEndStrategy implements FrontEndStrategy { |
| 28 final Compiler _compiler; | 28 final Compiler _compiler; |
| 29 final ElementEnvironment elementEnvironment; | 29 final ElementEnvironment elementEnvironment; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 deserializer, | 49 deserializer, |
| 50 patchResolverFunc, | 50 patchResolverFunc, |
| 51 patchParser, | 51 patchParser, |
| 52 environment, | 52 environment, |
| 53 reporter, | 53 reporter, |
| 54 measurer); | 54 measurer); |
| 55 } | 55 } |
| 56 | 56 |
| 57 AnnotationProcessor get annotationProcesser => | 57 AnnotationProcessor get annotationProcesser => |
| 58 _annotationProcessor ??= new _ElementAnnotationProcessor(_compiler); | 58 _annotationProcessor ??= new _ElementAnnotationProcessor(_compiler); |
| 59 |
| 60 @override |
| 61 NativeClassFinder createNativeClassResolver(NativeBasicData nativeBasicData) { |
| 62 return new ResolutionNativeClassFinder( |
| 63 _compiler.resolution, |
| 64 _compiler.reporter, |
| 65 elementEnvironment, |
| 66 _compiler.commonElements, |
| 67 nativeBasicData); |
| 68 } |
| 59 } | 69 } |
| 60 | 70 |
| 61 /// An element environment base on a [Compiler]. | 71 /// An element environment base on a [Compiler]. |
| 62 class _CompilerElementEnvironment implements ElementEnvironment { | 72 class _CompilerElementEnvironment implements ElementEnvironment { |
| 63 final Compiler _compiler; | 73 final Compiler _compiler; |
| 64 | 74 |
| 65 _CompilerElementEnvironment(this._compiler); | 75 _CompilerElementEnvironment(this._compiler); |
| 66 | 76 |
| 67 LibraryProvider get _libraryProvider => _compiler.libraryLoader; | 77 LibraryProvider get _libraryProvider => _compiler.libraryLoader; |
| 68 Resolution get _resolution => _compiler.resolution; | 78 Resolution get _resolution => _compiler.resolution; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 ClassElement cls, void f(ClassElement declarer, MemberElement member)) { | 164 ClassElement cls, void f(ClassElement declarer, MemberElement member)) { |
| 155 cls.ensureResolved(_resolution); | 165 cls.ensureResolved(_resolution); |
| 156 cls.forEachMember((ClassElement declarer, MemberElement member) { | 166 cls.forEachMember((ClassElement declarer, MemberElement member) { |
| 157 if (member.isSynthesized) return; | 167 if (member.isSynthesized) return; |
| 158 if (member.isMalformed) return; | 168 if (member.isMalformed) return; |
| 159 f(declarer, member); | 169 f(declarer, member); |
| 160 }, includeSuperAndInjectedMembers: true); | 170 }, includeSuperAndInjectedMembers: true); |
| 161 } | 171 } |
| 162 | 172 |
| 163 @override | 173 @override |
| 164 ClassEntity getSuperClass(ClassElement cls) => cls.superclass; | 174 ClassEntity getSuperClass(ClassElement cls) { |
| 175 cls.ensureResolved(_resolution); |
| 176 return cls.superclass; |
| 177 } |
| 165 | 178 |
| 166 @override | 179 @override |
| 167 void forEachSupertype( | 180 void forEachSupertype( |
| 168 ClassElement cls, void f(ResolutionInterfaceType supertype)) { | 181 ClassElement cls, void f(ResolutionInterfaceType supertype)) { |
| 169 cls.allSupertypes | 182 cls.allSupertypes |
| 170 .forEach((ResolutionInterfaceType supertype) => f(supertype)); | 183 .forEach((ResolutionInterfaceType supertype) => f(supertype)); |
| 171 } | 184 } |
| 172 | 185 |
| 173 @override | 186 @override |
| 174 void forEachMixin(ClassElement cls, void f(ClassElement mixin)) { | 187 void forEachMixin(ClassElement cls, void f(ClassElement mixin)) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 library.forEachLocalMember((Element element) { | 329 library.forEachLocalMember((Element element) { |
| 317 if (element.isClass) { | 330 if (element.isClass) { |
| 318 ClassElement cls = element; | 331 ClassElement cls = element; |
| 319 if (checkJsInteropAnnotation(element)) { | 332 if (checkJsInteropAnnotation(element)) { |
| 320 nativeBasicDataBuilder.markAsJsInteropClass(cls); | 333 nativeBasicDataBuilder.markAsJsInteropClass(cls); |
| 321 } | 334 } |
| 322 } | 335 } |
| 323 }); | 336 }); |
| 324 } | 337 } |
| 325 } | 338 } |
| OLD | NEW |