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'; |
| 11 import '../common.dart'; |
11 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 12 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
12 import '../common/tasks.dart'; | 13 import '../common/tasks.dart'; |
13 import '../compiler.dart'; | 14 import '../compiler.dart'; |
14 import '../elements/entities.dart'; | 15 import '../elements/entities.dart'; |
15 import '../elements/entity_utils.dart' as utils; | 16 import '../elements/entity_utils.dart' as utils; |
16 import '../enqueue.dart'; | 17 import '../enqueue.dart'; |
17 import '../io/source_information.dart'; | 18 import '../io/source_information.dart'; |
18 import '../js/js_source_mapping.dart'; | 19 import '../js/js_source_mapping.dart'; |
19 import '../js_backend/backend.dart'; | 20 import '../js_backend/backend.dart'; |
20 import '../js_backend/native_data.dart'; | 21 import '../js_backend/native_data.dart'; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 @override | 113 @override |
113 SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend, | 114 SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend, |
114 SourceInformationStrategy sourceInformationStrategy) { | 115 SourceInformationStrategy sourceInformationStrategy) { |
115 return new KernelSsaBuilder( | 116 return new KernelSsaBuilder( |
116 task, backend.compiler, elementMap, _globalLocalsMap); | 117 task, backend.compiler, elementMap, _globalLocalsMap); |
117 } | 118 } |
118 | 119 |
119 @override | 120 @override |
120 SourceInformationStrategy get sourceInformationStrategy => | 121 SourceInformationStrategy get sourceInformationStrategy => |
121 const JavaScriptSourceInformationStrategy(); | 122 const JavaScriptSourceInformationStrategy(); |
| 123 |
| 124 @override |
| 125 SourceSpan spanFromSpannable(Spannable spannable, Entity currentElement) { |
| 126 KernelFrontEndStrategy frontendStrategy = _compiler.frontendStrategy; |
| 127 KernelToElementMapImpl elementMap = frontendStrategy.elementMap; |
| 128 return elementMap.getSourceSpan(spannable, currentElement); |
| 129 } |
122 } | 130 } |
123 | 131 |
124 class KernelCodegenWorkItemBuilder implements WorkItemBuilder { | 132 class KernelCodegenWorkItemBuilder implements WorkItemBuilder { |
125 final JavaScriptBackend _backend; | 133 final JavaScriptBackend _backend; |
126 final ClosedWorld _closedWorld; | 134 final ClosedWorld _closedWorld; |
127 | 135 |
128 KernelCodegenWorkItemBuilder(this._backend, this._closedWorld); | 136 KernelCodegenWorkItemBuilder(this._backend, this._closedWorld); |
129 | 137 |
130 CompilerOptions get _options => _backend.compiler.options; | 138 CompilerOptions get _options => _backend.compiler.options; |
131 | 139 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { | 325 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { |
318 return classes.toList() | 326 return classes.toList() |
319 ..sort((ClassEntity a, ClassEntity b) { | 327 ..sort((ClassEntity a, ClassEntity b) { |
320 int r = _compareLibraries(a.library, b.library); | 328 int r = _compareLibraries(a.library, b.library); |
321 if (r != 0) return r; | 329 if (r != 0) return r; |
322 return _compareNodes( | 330 return _compareNodes( |
323 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); | 331 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); |
324 }); | 332 }); |
325 } | 333 } |
326 } | 334 } |
OLD | NEW |