Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution_strategy.dart

Issue 2836993003: Handle instantiation of native classes in closed_world2_test (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 NativeClassResolver createNativeClassResolver(
62 NativeBasicData nativeBasicData) {
63 return new ResolutionNativeClassResolver(
64 _compiler.resolution,
65 _compiler.reporter,
66 elementEnvironment,
67 _compiler.commonElements,
68 nativeBasicData);
69 }
59 } 70 }
60 71
61 /// An element environment base on a [Compiler]. 72 /// An element environment base on a [Compiler].
62 class _CompilerElementEnvironment implements ElementEnvironment { 73 class _CompilerElementEnvironment implements ElementEnvironment {
63 final Compiler _compiler; 74 final Compiler _compiler;
64 75
65 _CompilerElementEnvironment(this._compiler); 76 _CompilerElementEnvironment(this._compiler);
66 77
67 LibraryProvider get _libraryProvider => _compiler.libraryLoader; 78 LibraryProvider get _libraryProvider => _compiler.libraryLoader;
68 Resolution get _resolution => _compiler.resolution; 79 Resolution get _resolution => _compiler.resolution;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ClassElement cls, void f(ClassElement declarer, MemberElement member)) { 165 ClassElement cls, void f(ClassElement declarer, MemberElement member)) {
155 cls.ensureResolved(_resolution); 166 cls.ensureResolved(_resolution);
156 cls.forEachMember((ClassElement declarer, MemberElement member) { 167 cls.forEachMember((ClassElement declarer, MemberElement member) {
157 if (member.isSynthesized) return; 168 if (member.isSynthesized) return;
158 if (member.isMalformed) return; 169 if (member.isMalformed) return;
159 f(declarer, member); 170 f(declarer, member);
160 }, includeSuperAndInjectedMembers: true); 171 }, includeSuperAndInjectedMembers: true);
161 } 172 }
162 173
163 @override 174 @override
164 ClassEntity getSuperClass(ClassElement cls) => cls.superclass; 175 ClassEntity getSuperClass(ClassElement cls) {
176 cls.ensureResolved(_resolution);
177 return cls.superclass;
178 }
165 179
166 @override 180 @override
167 void forEachSupertype( 181 void forEachSupertype(
168 ClassElement cls, void f(ResolutionInterfaceType supertype)) { 182 ClassElement cls, void f(ResolutionInterfaceType supertype)) {
169 cls.allSupertypes 183 cls.allSupertypes
170 .forEach((ResolutionInterfaceType supertype) => f(supertype)); 184 .forEach((ResolutionInterfaceType supertype) => f(supertype));
171 } 185 }
172 186
173 @override 187 @override
174 void forEachMixin(ClassElement cls, void f(ClassElement mixin)) { 188 void forEachMixin(ClassElement cls, void f(ClassElement mixin)) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 library.forEachLocalMember((Element element) { 330 library.forEachLocalMember((Element element) {
317 if (element.isClass) { 331 if (element.isClass) {
318 ClassElement cls = element; 332 ClassElement cls = element;
319 if (checkJsInteropAnnotation(element)) { 333 if (checkJsInteropAnnotation(element)) {
320 nativeBasicDataBuilder.markAsJsInteropClass(cls); 334 nativeBasicDataBuilder.markAsJsInteropClass(cls);
321 } 335 }
322 } 336 }
323 }); 337 });
324 } 338 }
325 } 339 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698