| 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 '../closure.dart' show BoxLocal; | 9 import '../closure.dart' show BoxLocal; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 assert(checkFamily(cls)); | 240 assert(checkFamily(cls)); |
| 241 ClassData data = _classData[cls.classIndex]; | 241 ClassData data = _classData[cls.classIndex]; |
| 242 _ensureSupertypes(cls, data); | 242 _ensureSupertypes(cls, data); |
| 243 return data.supertype; | 243 return data.supertype; |
| 244 } | 244 } |
| 245 | 245 |
| 246 void _ensureThisAndRawType(ClassEntity cls, ClassData data) { | 246 void _ensureThisAndRawType(ClassEntity cls, ClassData data) { |
| 247 assert(checkFamily(cls)); | 247 assert(checkFamily(cls)); |
| 248 if (data.thisType == null) { | 248 if (data.thisType == null) { |
| 249 ir.Class node = data.cls; | 249 ir.Class node = data.cls; |
| 250 // TODO(johnniwinther): Add the type argument to the list literal when we | |
| 251 // no longer use resolution types. | |
| 252 if (node.typeParameters.isEmpty) { | 250 if (node.typeParameters.isEmpty) { |
| 253 data.thisType = | 251 data.thisType = |
| 254 data.rawType = new InterfaceType(cls, const <DartType>[]); | 252 data.rawType = new InterfaceType(cls, const <DartType>[]); |
| 255 } else { | 253 } else { |
| 256 data.thisType = new InterfaceType( | 254 data.thisType = new InterfaceType( |
| 257 cls, | 255 cls, |
| 258 new List<DartType>.generate(node.typeParameters.length, | 256 new List<DartType>.generate(node.typeParameters.length, |
| 259 (int index) { | 257 (int index) { |
| 260 return new TypeVariableType( | 258 return new TypeVariableType( |
| 261 _getTypeVariable(node.typeParameters[index])); | 259 _getTypeVariable(node.typeParameters[index])); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 386 |
| 389 @override | 387 @override |
| 390 FieldEntity getField(ir.Field node) => _getField(node); | 388 FieldEntity getField(ir.Field node) => _getField(node); |
| 391 | 389 |
| 392 FieldEntity _getField(ir.Field node); | 390 FieldEntity _getField(ir.Field node); |
| 393 | 391 |
| 394 @override | 392 @override |
| 395 DartType getDartType(ir.DartType type) => _typeConverter.convert(type); | 393 DartType getDartType(ir.DartType type) => _typeConverter.convert(type); |
| 396 | 394 |
| 397 List<DartType> getDartTypes(List<ir.DartType> types) { | 395 List<DartType> getDartTypes(List<ir.DartType> types) { |
| 398 // TODO(johnniwinther): Add the type argument to the list literal when we | |
| 399 // no longer use resolution types. | |
| 400 List<DartType> list = <DartType>[]; | 396 List<DartType> list = <DartType>[]; |
| 401 types.forEach((ir.DartType type) { | 397 types.forEach((ir.DartType type) { |
| 402 list.add(getDartType(type)); | 398 list.add(getDartType(type)); |
| 403 }); | 399 }); |
| 404 return list; | 400 return list; |
| 405 } | 401 } |
| 406 | 402 |
| 407 @override | 403 @override |
| 408 InterfaceType getInterfaceType(ir.InterfaceType type) => | 404 InterfaceType getInterfaceType(ir.InterfaceType type) => |
| 409 _typeConverter.convert(type); | 405 _typeConverter.convert(type); |
| (...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 /// | 2123 /// |
| 2128 /// These names are not used in generated code, just as element name. | 2124 /// These names are not used in generated code, just as element name. |
| 2129 String _getClosureVariableName(String name, int id) { | 2125 String _getClosureVariableName(String name, int id) { |
| 2130 return "_captured_${name}_$id"; | 2126 return "_captured_${name}_$id"; |
| 2131 } | 2127 } |
| 2132 | 2128 |
| 2133 String getDeferredUri(ir.LibraryDependency node) { | 2129 String getDeferredUri(ir.LibraryDependency node) { |
| 2134 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri'); | 2130 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri'); |
| 2135 } | 2131 } |
| 2136 } | 2132 } |
| OLD | NEW |