OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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.backend_api; | 5 library dart2js.backend_api; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/codegen.dart' show CodegenImpact; | 10 import '../common/codegen.dart' show CodegenImpact; |
11 import '../common/resolution.dart' show ResolutionImpact, Frontend, Target; | 11 import '../common/resolution.dart' show ResolutionImpact, Frontend, Target; |
12 import '../compile_time_constants.dart' | 12 import '../compile_time_constants.dart' |
13 show BackendConstantEnvironment, ConstantCompilerTask; | 13 show BackendConstantEnvironment, ConstantCompilerTask; |
14 import '../compiler.dart' show Compiler; | 14 import '../compiler.dart' show Compiler; |
15 import '../constants/constant_system.dart' show ConstantSystem; | 15 import '../constants/constant_system.dart' show ConstantSystem; |
16 import '../constants/expressions.dart' show ConstantExpression; | 16 import '../constants/expressions.dart' show ConstantExpression; |
17 import '../constants/values.dart' show ConstantValue; | 17 import '../constants/values.dart' show ConstantValue; |
18 import '../dart_types.dart' show DartType, InterfaceType; | 18 import '../dart_types.dart' show DartType, InterfaceType; |
19 import '../elements/elements.dart' | 19 import '../elements/elements.dart' |
20 show ClassElement, Element, FunctionElement, MethodElement, LibraryElement; | 20 show ClassElement, Element, FunctionElement, MethodElement, LibraryElement; |
| 21 import '../elements/entities.dart'; |
21 import '../enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer; | 22 import '../enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer; |
22 import '../io/code_output.dart' show CodeBuffer; | 23 import '../io/code_output.dart' show CodeBuffer; |
23 import '../io/source_information.dart' show SourceInformationStrategy; | 24 import '../io/source_information.dart' show SourceInformationStrategy; |
24 import '../js_backend/backend_helpers.dart' as js_backend show BackendHelpers; | 25 import '../js_backend/backend_helpers.dart' as js_backend show BackendHelpers; |
25 import '../js_backend/js_backend.dart' as js_backend; | 26 import '../js_backend/js_backend.dart' as js_backend; |
26 import '../library_loader.dart' show LibraryLoader, LoadedLibraries; | 27 import '../library_loader.dart' show LibraryLoader, LoadedLibraries; |
27 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; | 28 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; |
28 import '../patch_parser.dart' | 29 import '../patch_parser.dart' |
29 show checkNativeAnnotation, checkJsInteropAnnotation; | 30 show checkNativeAnnotation, checkJsInteropAnnotation; |
30 import '../serialization/serialization.dart' | 31 import '../serialization/serialization.dart' |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 Uri canonicalUri = library.canonicalUri; | 216 Uri canonicalUri = library.canonicalUri; |
216 if (canonicalUri == js_backend.BackendHelpers.DART_JS_HELPER || | 217 if (canonicalUri == js_backend.BackendHelpers.DART_JS_HELPER || |
217 canonicalUri == js_backend.BackendHelpers.DART_INTERCEPTORS) { | 218 canonicalUri == js_backend.BackendHelpers.DART_INTERCEPTORS) { |
218 return true; | 219 return true; |
219 } | 220 } |
220 return false; | 221 return false; |
221 } | 222 } |
222 | 223 |
223 /// Called to register that [element] is statically known to be used. Any | 224 /// Called to register that [element] is statically known to be used. Any |
224 /// backend specific [WorldImpact] of this is returned. | 225 /// backend specific [WorldImpact] of this is returned. |
225 WorldImpact registerStaticUse(Element element, {bool forResolution}) => | 226 WorldImpact registerUsedElement(Element element, {bool forResolution}) => |
226 const WorldImpact(); | 227 const WorldImpact(); |
227 | 228 |
228 /// This method is called immediately after the [LibraryElement] [library] has | 229 /// This method is called immediately after the [LibraryElement] [library] has |
229 /// been created. | 230 /// been created. |
230 void onLibraryCreated(LibraryElement library) {} | 231 void onLibraryCreated(LibraryElement library) {} |
231 | 232 |
232 /// This method is called immediately after the [library] and its parts have | 233 /// This method is called immediately after the [library] and its parts have |
233 /// been scanned. | 234 /// been scanned. |
234 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { | 235 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { |
235 // TODO(johnniwinther): Move this to [JavaScriptBackend]. | 236 // TODO(johnniwinther): Move this to [JavaScriptBackend]. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 /// | 299 /// |
299 /// A return value of [:true:] indicates that [recentClasses] has been | 300 /// A return value of [:true:] indicates that [recentClasses] has been |
300 /// processed and its elements do not need to be seen in the next round. When | 301 /// processed and its elements do not need to be seen in the next round. When |
301 /// [:false:] is returned, [onQueueEmpty] will be called again once the | 302 /// [:false:] is returned, [onQueueEmpty] will be called again once the |
302 /// resolution queue has drained and [recentClasses] will be a superset of the | 303 /// resolution queue has drained and [recentClasses] will be a superset of the |
303 /// current value. | 304 /// current value. |
304 /// | 305 /// |
305 /// There is no guarantee that a class is only present once in | 306 /// There is no guarantee that a class is only present once in |
306 /// [recentClasses], but every class seen by the [enqueuer] will be present in | 307 /// [recentClasses], but every class seen by the [enqueuer] will be present in |
307 /// [recentClasses] at least once. | 308 /// [recentClasses] at least once. |
308 bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) { | 309 bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) { |
309 return true; | 310 return true; |
310 } | 311 } |
311 | 312 |
312 /// Called after the queue is closed. [onQueueEmpty] may be called multiple | 313 /// Called after the queue is closed. [onQueueEmpty] may be called multiple |
313 /// times, but [onQueueClosed] is only called once. | 314 /// times, but [onQueueClosed] is only called once. |
314 void onQueueClosed() {} | 315 void onQueueClosed() {} |
315 | 316 |
316 /// Called when the compiler starts running the codegen enqueuer. | 317 /// Called when the compiler starts running the codegen enqueuer. |
317 void onCodegenStart() {} | 318 void onCodegenStart() {} |
318 | 319 |
319 /// Called after [element] has been resolved. | |
320 void onElementResolved(Element element) {} | |
321 | |
322 // Does this element belong in the output | 320 // Does this element belong in the output |
323 bool shouldOutput(Element element) => true; | 321 bool shouldOutput(Element element) => true; |
324 | 322 |
325 FunctionElement helperForBadMain() => null; | 323 FunctionElement helperForBadMain() => null; |
326 | 324 |
327 FunctionElement helperForMissingMain() => null; | 325 FunctionElement helperForMissingMain() => null; |
328 | 326 |
329 FunctionElement helperForMainArity() => null; | 327 FunctionElement helperForMainArity() => null; |
330 | 328 |
331 void forgetElement(Element element) {} | 329 void forgetElement(Element element) {} |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 ClassElement get typeImplementation; | 412 ClassElement get typeImplementation; |
415 ClassElement get boolImplementation; | 413 ClassElement get boolImplementation; |
416 ClassElement get nullImplementation; | 414 ClassElement get nullImplementation; |
417 ClassElement get uint32Implementation; | 415 ClassElement get uint32Implementation; |
418 ClassElement get uint31Implementation; | 416 ClassElement get uint31Implementation; |
419 ClassElement get positiveIntImplementation; | 417 ClassElement get positiveIntImplementation; |
420 ClassElement get syncStarIterableImplementation; | 418 ClassElement get syncStarIterableImplementation; |
421 ClassElement get asyncFutureImplementation; | 419 ClassElement get asyncFutureImplementation; |
422 ClassElement get asyncStarStreamImplementation; | 420 ClassElement get asyncStarStreamImplementation; |
423 } | 421 } |
OLD | NEW |