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 28 matching lines...) Expand all Loading... |
39 /// Backend strategy that uses the kernel elements as the backend model. | 39 /// Backend strategy that uses the kernel elements as the backend model. |
40 // TODO(johnniwinther): Replace this with a strategy based on the J-element | 40 // TODO(johnniwinther): Replace this with a strategy based on the J-element |
41 // model. | 41 // model. |
42 class KernelBackendStrategy implements BackendStrategy { | 42 class KernelBackendStrategy implements BackendStrategy { |
43 final Compiler _compiler; | 43 final Compiler _compiler; |
44 Sorter _sorter; | 44 Sorter _sorter; |
45 | 45 |
46 KernelBackendStrategy(this._compiler); | 46 KernelBackendStrategy(this._compiler); |
47 | 47 |
48 @override | 48 @override |
49 ClosedWorldRefiner createClosedWorldRefiner(KernelClosedWorld closedWorld) { | 49 ClosedWorldRefiner createClosedWorldRefiner( |
| 50 covariant KernelClosedWorld closedWorld) { |
50 return closedWorld; | 51 return closedWorld; |
51 } | 52 } |
52 | 53 |
53 @override | 54 @override |
54 Sorter get sorter { | 55 Sorter get sorter { |
55 if (_sorter == null) { | 56 if (_sorter == null) { |
56 KernelFrontEndStrategy frontendStrategy = _compiler.frontendStrategy; | 57 KernelFrontEndStrategy frontendStrategy = _compiler.frontendStrategy; |
57 _sorter = new KernelSorter(frontendStrategy.elementMap); | 58 _sorter = new KernelSorter(frontendStrategy.elementMap); |
58 } | 59 } |
59 return _sorter; | 60 return _sorter; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { | 404 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { |
404 return classes.toList() | 405 return classes.toList() |
405 ..sort((ClassEntity a, ClassEntity b) { | 406 ..sort((ClassEntity a, ClassEntity b) { |
406 int r = _compareLibraries(a.library, b.library); | 407 int r = _compareLibraries(a.library, b.library); |
407 if (r != 0) return r; | 408 if (r != 0) return r; |
408 return _compareNodes( | 409 return _compareNodes( |
409 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); | 410 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); |
410 }); | 411 }); |
411 } | 412 } |
412 } | 413 } |
OLD | NEW |