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.backend_strategy; | 5 library dart2js.kernel.backend_strategy; |
6 | 6 |
7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
8 | 8 |
9 import '../backend_strategy.dart'; | 9 import '../backend_strategy.dart'; |
10 import '../closure.dart'; | 10 import '../closure.dart'; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 sb.write(')'); | 307 sb.write(')'); |
308 return sb.toString(); | 308 return sb.toString(); |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 /// TODO(johnniwinther,efortuna): Implement this. | 312 /// TODO(johnniwinther,efortuna): Implement this. |
313 class KernelClosureClassMaps implements ClosureClassMaps<ir.Node> { | 313 class KernelClosureClassMaps implements ClosureClassMaps<ir.Node> { |
314 const KernelClosureClassMaps(); | 314 const KernelClosureClassMaps(); |
315 | 315 |
316 @override | 316 @override |
317 ClosureClassMap getLocalFunctionMap(Local localFunction) { | |
318 return new ClosureClassMap(null, null, null, null); | |
319 } | |
320 | |
321 @override | |
322 ClosureClassMap getMemberMap(MemberEntity member) { | |
323 ThisLocal thisLocal; | |
324 if (member.isInstanceMember) { | |
325 thisLocal = new ThisLocal(member); | |
326 } | |
327 return new ClosureClassMap(null, null, null, thisLocal); | |
328 } | |
329 | |
330 @override | |
331 ClosureAnalysisInfo getClosureAnalysisInfo(ir.Node node) { | 317 ClosureAnalysisInfo getClosureAnalysisInfo(ir.Node node) { |
332 return const ClosureAnalysisInfo(); | 318 return const ClosureAnalysisInfo(); |
333 } | 319 } |
334 | 320 |
335 @override | 321 @override |
336 LoopClosureRepresentationInfo getClosureRepresentationInfoForLoop( | 322 LoopClosureRepresentationInfo getClosureRepresentationInfoForLoop( |
337 ir.Node loopNode) { | 323 ir.Node loopNode) { |
338 return const LoopClosureRepresentationInfo(); | 324 return const LoopClosureRepresentationInfo(); |
339 } | 325 } |
| 326 |
| 327 @override |
| 328 ClosureRepresentationInfo getClosureRepresentationInfo(Entity entity) { |
| 329 if (entity is MemberEntity) { |
| 330 ThisLocal thisLocal; |
| 331 if (entity.isInstanceMember) { |
| 332 thisLocal = new ThisLocal(entity); |
| 333 } |
| 334 return new ClosureClassMap(null, null, null, thisLocal); |
| 335 } |
| 336 return const ClosureRepresentationInfo(); |
| 337 } |
340 } | 338 } |
341 | 339 |
342 class KernelSorter implements Sorter { | 340 class KernelSorter implements Sorter { |
343 final KernelToElementMapImpl elementMap; | 341 final KernelToElementMapImpl elementMap; |
344 | 342 |
345 KernelSorter(this.elementMap); | 343 KernelSorter(this.elementMap); |
346 | 344 |
347 int _compareLibraries(LibraryEntity a, LibraryEntity b) { | 345 int _compareLibraries(LibraryEntity a, LibraryEntity b) { |
348 return utils.compareLibrariesUris(a.canonicalUri, b.canonicalUri); | 346 return utils.compareLibrariesUris(a.canonicalUri, b.canonicalUri); |
349 } | 347 } |
(...skipping 29 matching lines...) Expand all Loading... |
379 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { | 377 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { |
380 return classes.toList() | 378 return classes.toList() |
381 ..sort((ClassEntity a, ClassEntity b) { | 379 ..sort((ClassEntity a, ClassEntity b) { |
382 int r = _compareLibraries(a.library, b.library); | 380 int r = _compareLibraries(a.library, b.library); |
383 if (r != 0) return r; | 381 if (r != 0) return r; |
384 return _compareNodes( | 382 return _compareNodes( |
385 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); | 383 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); |
386 }); | 384 }); |
387 } | 385 } |
388 } | 386 } |
OLD | NEW |