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

Side by Side Diff: pkg/compiler/lib/src/kernel/world_builder.dart

Issue 2804993002: Extract ResolutionWorldBuilderBase from ElementResolutionWorldBuilder (Closed)
Patch Set: Fix. 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.kernel.world_builder; 5 library dart2js.kernel.world_builder;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/backend_api.dart'; 10 import '../common/backend_api.dart';
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return member != null ? getConstructor(member) : null; 152 return member != null ? getConstructor(member) : null;
153 } 153 }
154 154
155 KClass _getClass(ir.Class node, [KClassEnv classEnv]) { 155 KClass _getClass(ir.Class node, [KClassEnv classEnv]) {
156 return _classMap.putIfAbsent(node, () { 156 return _classMap.putIfAbsent(node, () {
157 KLibrary library = _getLibrary(node.enclosingLibrary); 157 KLibrary library = _getLibrary(node.enclosingLibrary);
158 if (classEnv == null) { 158 if (classEnv == null) {
159 classEnv = _libraryEnvs[library.libraryIndex].lookupClass(node.name); 159 classEnv = _libraryEnvs[library.libraryIndex].lookupClass(node.name);
160 } 160 }
161 _classEnvs.add(classEnv); 161 _classEnvs.add(classEnv);
162 return new KClass(library, _classMap.length, node.name); 162 return new KClass(library, _classMap.length, node.name,
163 isAbstract: node.isAbstract);
163 }); 164 });
164 } 165 }
165 166
166 KTypeVariable _getTypeVariable(ir.TypeParameter node) { 167 KTypeVariable _getTypeVariable(ir.TypeParameter node) {
167 return _typeVariableMap.putIfAbsent(node, () { 168 return _typeVariableMap.putIfAbsent(node, () {
168 if (node.parent is ir.Class) { 169 if (node.parent is ir.Class) {
169 ir.Class cls = node.parent; 170 ir.Class cls = node.parent;
170 int index = cls.typeParameters.indexOf(node); 171 int index = cls.typeParameters.indexOf(node);
171 return new KTypeVariable(_getClass(cls), node.name, index); 172 return new KTypeVariable(_getClass(cls), node.name, index);
172 } 173 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 } 596 }
596 return member; 597 return member;
597 } 598 }
598 599
599 @override 600 @override
600 ClassEntity getSuperClass(ClassEntity cls) { 601 ClassEntity getSuperClass(ClassEntity cls) {
601 throw new UnimplementedError('KernelElementEnvironment.getSuperClass'); 602 throw new UnimplementedError('KernelElementEnvironment.getSuperClass');
602 } 603 }
603 604
604 @override 605 @override
606 void forEachSupertype(ClassEntity cls, void f(InterfaceType supertype)) {
607 throw new UnimplementedError('KernelElementEnvironment.forEachSupertype');
608 }
609
610 @override
605 void forEachMixin(ClassEntity cls, void f(ClassEntity mixin)) { 611 void forEachMixin(ClassEntity cls, void f(ClassEntity mixin)) {
606 throw new UnimplementedError('KernelElementEnvironment.forEachMixin'); 612 throw new UnimplementedError('KernelElementEnvironment.forEachMixin');
607 } 613 }
608 614
609 @override 615 @override
610 void forEachClassMember( 616 void forEachClassMember(
611 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)) { 617 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)) {
612 throw new UnimplementedError( 618 throw new UnimplementedError(
613 'KernelElementEnvironment.forEachInstanceMember'); 619 'KernelElementEnvironment.forEachInstanceMember');
614 } 620 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 } 892 }
887 893
888 InterfaceType getMixinTypeForClass(KClass cls) { 894 InterfaceType getMixinTypeForClass(KClass cls) {
889 KClassEnv env = builder._classEnvs[cls.classIndex]; 895 KClassEnv env = builder._classEnvs[cls.classIndex];
890 ir.Supertype mixedInType = env.cls.mixedInType; 896 ir.Supertype mixedInType = env.cls.mixedInType;
891 if (mixedInType == null) return null; 897 if (mixedInType == null) return null;
892 return builder.createInterfaceType( 898 return builder.createInterfaceType(
893 mixedInType.classNode, mixedInType.typeArguments); 899 mixedInType.classNode, mixedInType.typeArguments);
894 } 900 }
895 } 901 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/elements.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698