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