| 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.kernel.element_map; | 5 library dart2js.kernel.element_map; |
| 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/resolution.dart'; | 10 import '../common/resolution.dart'; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 ConstantEnvironment get constantEnvironment => _constantEnvironment; | 119 ConstantEnvironment get constantEnvironment => _constantEnvironment; |
| 120 | 120 |
| 121 DartTypes get types => _types; | 121 DartTypes get types => _types; |
| 122 | 122 |
| 123 @override | 123 @override |
| 124 native.BehaviorBuilder get nativeBehaviorBuilder => _nativeBehaviorBuilder; | 124 native.BehaviorBuilder get nativeBehaviorBuilder => _nativeBehaviorBuilder; |
| 125 | 125 |
| 126 LibraryEntity lookupLibrary(Uri uri) { | 126 LibraryEntity lookupLibrary(Uri uri) { |
| 127 _KLibraryEnv libraryEnv = _env.lookupLibrary(uri); | 127 _KLibraryEnv libraryEnv = _env.lookupLibrary(uri); |
| 128 if (libraryEnv == null) return null; |
| 128 return _getLibrary(libraryEnv.library, libraryEnv); | 129 return _getLibrary(libraryEnv.library, libraryEnv); |
| 129 } | 130 } |
| 130 | 131 |
| 131 KLibrary _getLibrary(ir.Library node, [_KLibraryEnv libraryEnv]) { | 132 KLibrary _getLibrary(ir.Library node, [_KLibraryEnv libraryEnv]) { |
| 132 return _libraryMap.putIfAbsent(node, () { | 133 return _libraryMap.putIfAbsent(node, () { |
| 133 Uri canonicalUri = node.importUri; | 134 Uri canonicalUri = node.importUri; |
| 134 _libraryEnvs.add(libraryEnv ?? _env.lookupLibrary(canonicalUri)); | 135 _libraryEnvs.add(libraryEnv ?? _env.lookupLibrary(canonicalUri)); |
| 135 String name = node.name; | 136 String name = node.name; |
| 136 if (name == null) { | 137 if (name == null) { |
| 137 // Use the file name as script name. | 138 // Use the file name as script name. |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 } | 1264 } |
| 1264 | 1265 |
| 1265 InterfaceType getMixinTypeForClass(KClass cls) { | 1266 InterfaceType getMixinTypeForClass(KClass cls) { |
| 1266 _KClassEnv env = builder._classEnvs[cls.classIndex]; | 1267 _KClassEnv env = builder._classEnvs[cls.classIndex]; |
| 1267 ir.Supertype mixedInType = env.cls.mixedInType; | 1268 ir.Supertype mixedInType = env.cls.mixedInType; |
| 1268 if (mixedInType == null) return null; | 1269 if (mixedInType == null) return null; |
| 1269 return builder.createInterfaceType( | 1270 return builder.createInterfaceType( |
| 1270 mixedInType.classNode, mixedInType.typeArguments); | 1271 mixedInType.classNode, mixedInType.typeArguments); |
| 1271 } | 1272 } |
| 1272 } | 1273 } |
| OLD | NEW |