Chromium Code Reviews| 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, ThisLocal; | 9 import '../closure.dart' show BoxLocal, ThisLocal; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 _getTypeVariable(node.typeParameters[index])); | 246 _getTypeVariable(node.typeParameters[index])); |
| 247 })); | 247 })); |
| 248 data.rawType = new InterfaceType( | 248 data.rawType = new InterfaceType( |
| 249 cls, | 249 cls, |
| 250 new List<DartType>.filled( | 250 new List<DartType>.filled( |
| 251 node.typeParameters.length, const DynamicType())); | 251 node.typeParameters.length, const DynamicType())); |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 List<DartType> getTypeVariables(ir.Class cls) { | |
| 257 return cls.typeParameters | |
| 258 .map((ir.TypeParameter type) => getDartType(type.bound)); | |
|
Johnni Winther
2017/09/04 06:59:56
This is not the correct implementation.
class C<T
Emily Fortuna
2017/09/05 17:13:31
Done.
| |
| 259 } | |
| 260 | |
| 256 TypeVariableEntity getTypeVariable(ir.TypeParameter node) => | 261 TypeVariableEntity getTypeVariable(ir.TypeParameter node) => |
| 257 _getTypeVariable(node); | 262 _getTypeVariable(node); |
| 258 | 263 |
| 259 TypeVariableEntity _getTypeVariable(ir.TypeParameter node); | 264 TypeVariableEntity _getTypeVariable(ir.TypeParameter node); |
| 260 | 265 |
| 261 void _ensureSupertypes(ClassEntity cls, ClassData data) { | 266 void _ensureSupertypes(ClassEntity cls, ClassData data) { |
| 262 assert(checkFamily(cls)); | 267 assert(checkFamily(cls)); |
| 263 if (data.orderedTypeSet == null) { | 268 if (data.orderedTypeSet == null) { |
| 264 _ensureThisAndRawType(cls, data); | 269 _ensureThisAndRawType(cls, data); |
| 265 | 270 |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1267 @override | 1272 @override |
| 1268 FunctionType getFunctionType(FunctionEntity function) { | 1273 FunctionType getFunctionType(FunctionEntity function) { |
| 1269 return elementMap._getFunctionType(function); | 1274 return elementMap._getFunctionType(function); |
| 1270 } | 1275 } |
| 1271 | 1276 |
| 1272 @override | 1277 @override |
| 1273 DartType getFieldType(FieldEntity field) { | 1278 DartType getFieldType(FieldEntity field) { |
| 1274 return elementMap._getFieldType(field); | 1279 return elementMap._getFieldType(field); |
| 1275 } | 1280 } |
| 1276 | 1281 |
| 1282 List<DartType> getTypeVariables(ClassEntity cls) { | |
| 1283 ir.Class irClass = elementMap._classes.getEnv(cls).cls; | |
| 1284 // Not all entities have corresponding ir.Nodes, but those that do not are | |
| 1285 // synthetic elements like closure classes, which don't have specialized | |
| 1286 // type variables. | |
| 1287 return irClass == null | |
| 1288 ? const <DartType>[] | |
| 1289 : elementMap.getTypeVariables(irClass); | |
|
Johnni Winther
2017/09/04 06:59:56
This method can be implemented using the current i
Emily Fortuna
2017/09/05 17:13:31
Done.
| |
| 1290 } | |
| 1291 | |
| 1277 @override | 1292 @override |
| 1278 FunctionType getLocalFunctionType(covariant KLocalFunction function) { | 1293 FunctionType getLocalFunctionType(covariant KLocalFunction function) { |
| 1279 return function.functionType; | 1294 return function.functionType; |
| 1280 } | 1295 } |
| 1281 | 1296 |
| 1282 @override | 1297 @override |
| 1283 ConstantExpression getFieldConstant(FieldEntity field) { | 1298 ConstantExpression getFieldConstant(FieldEntity field) { |
| 1284 return elementMap._getFieldConstantExpression(field); | 1299 return elementMap._getFieldConstantExpression(field); |
| 1285 } | 1300 } |
| 1286 | 1301 |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2342 /// | 2357 /// |
| 2343 /// These names are not used in generated code, just as element name. | 2358 /// These names are not used in generated code, just as element name. |
| 2344 String _getClosureVariableName(String name, int id) { | 2359 String _getClosureVariableName(String name, int id) { |
| 2345 return "_captured_${name}_$id"; | 2360 return "_captured_${name}_$id"; |
| 2346 } | 2361 } |
| 2347 | 2362 |
| 2348 String getDeferredUri(ir.LibraryDependency node) { | 2363 String getDeferredUri(ir.LibraryDependency node) { |
| 2349 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri'); | 2364 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri'); |
| 2350 } | 2365 } |
| 2351 } | 2366 } |
| OLD | NEW |