| 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.js_model.strategy; | 5 library dart2js.js_model.strategy; |
| 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 ClosureConversionTask; | 9 import '../closure.dart' show ClosureConversionTask; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 liveInstanceMembers, | 380 liveInstanceMembers, |
| 381 assignedInstanceMembers, | 381 assignedInstanceMembers, |
| 382 allTypedefs, | 382 allTypedefs, |
| 383 mixinUses, | 383 mixinUses, |
| 384 typesImplementedBySubclasses, | 384 typesImplementedBySubclasses, |
| 385 classHierarchyNodes, | 385 classHierarchyNodes, |
| 386 classSets); | 386 classSets); |
| 387 | 387 |
| 388 /// Construct a closure class and set up the necessary class inference | 388 /// Construct a closure class and set up the necessary class inference |
| 389 /// hierarchy. | 389 /// hierarchy. |
| 390 KernelClosureClass buildClosureClass(String name, JLibrary enclosingLibrary, | 390 KernelClosureClass buildClosureClass( |
| 391 KernelScopeInfo info, ir.Location location, KernelToLocalsMap localsMap) { | 391 MemberEntity member, |
| 392 ir.FunctionNode originalClosureFunctionNode, |
| 393 JLibrary enclosingLibrary, |
| 394 KernelScopeInfo info, |
| 395 ir.Location location, |
| 396 KernelToLocalsMap localsMap) { |
| 392 ClassEntity superclass = commonElements.closureClass; | 397 ClassEntity superclass = commonElements.closureClass; |
| 393 | 398 |
| 394 KernelClosureClass cls = elementMap.constructClosureClass( | 399 KernelClosureClass cls = elementMap.constructClosureClass( |
| 395 name, | 400 member, |
| 401 originalClosureFunctionNode, |
| 396 enclosingLibrary, | 402 enclosingLibrary, |
| 397 info, | 403 info, |
| 398 location, | 404 location, |
| 399 localsMap, | 405 localsMap, |
| 400 new InterfaceType(superclass, const [])); | 406 new InterfaceType(superclass, const [])); |
| 401 | 407 |
| 402 // Tell the hierarchy that this is the super class. then we can use | 408 // Tell the hierarchy that this is the super class. then we can use |
| 403 // .getSupertypes(class) | 409 // .getSupertypes(class) |
| 404 ClassHierarchyNode parentNode = getClassHierarchyNode(superclass); | 410 ClassHierarchyNode parentNode = getClassHierarchyNode(superclass); |
| 405 ClassHierarchyNode node = new ClassHierarchyNode( | 411 ClassHierarchyNode node = new ClassHierarchyNode( |
| 406 parentNode, cls, getHierarchyDepth(superclass) + 1); | 412 parentNode, cls, getHierarchyDepth(superclass) + 1); |
| 407 addClassHierarchyNode(cls, node); | 413 addClassHierarchyNode(cls, node); |
| 408 for (InterfaceType type in getOrderedTypeSet(superclass).types) { | 414 for (InterfaceType type in getOrderedTypeSet(superclass).types) { |
| 409 // TODO(efortuna): assert that the FunctionClass is in this ordered set. | 415 // TODO(efortuna): assert that the FunctionClass is in this ordered set. |
| 410 // If not, we need to explicitly add node as a subtype of FunctionClass. | 416 // If not, we need to explicitly add node as a subtype of FunctionClass. |
| 411 ClassSet subtypeSet = getClassSet(type.element); | 417 ClassSet subtypeSet = getClassSet(type.element); |
| 412 subtypeSet.addSubtype(node); | 418 subtypeSet.addSubtype(node); |
| 413 } | 419 } |
| 414 addClassSet(cls, new ClassSet(node)); | 420 addClassSet(cls, new ClassSet(node)); |
| 415 node.isDirectlyInstantiated = true; | 421 node.isDirectlyInstantiated = true; |
| 416 | 422 |
| 417 return cls; | 423 return cls; |
| 418 } | 424 } |
| 419 | 425 |
| 420 @override | 426 @override |
| 421 void registerClosureClass(ClassEntity cls) { | 427 void registerClosureClass(ClassEntity cls) { |
| 422 throw new UnsupportedError('JsClosedWorld.registerClosureClass'); | 428 throw new UnsupportedError('JsClosedWorld.registerClosureClass'); |
| 423 } | 429 } |
| 424 } | 430 } |
| OLD | NEW |