| 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; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 return false; | 211 return false; |
| 212 } | 212 } |
| 213 | 213 |
| 214 /// Called to register that [element] is statically known to be used. Any | 214 /// Called to register that [element] is statically known to be used. Any |
| 215 /// backend specific [WorldImpact] of this is returned. | 215 /// backend specific [WorldImpact] of this is returned. |
| 216 WorldImpact registerUsedElement(MemberElement element, | 216 WorldImpact registerUsedElement(MemberElement element, |
| 217 {bool forResolution}) => | 217 {bool forResolution}) => |
| 218 const WorldImpact(); | 218 const WorldImpact(); |
| 219 | 219 |
| 220 /// This method is called immediately after the [LibraryElement] [library] has | |
| 221 /// been created. | |
| 222 void onLibraryCreated(LibraryElement library) {} | |
| 223 | |
| 224 /// This method is called immediately after the [library] and its parts have | 220 /// This method is called immediately after the [library] and its parts have |
| 225 /// been scanned. | 221 /// been scanned. |
| 226 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { | 222 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { |
| 227 // TODO(johnniwinther): Move this to [JavaScriptBackend]. | 223 // TODO(johnniwinther): Move this to [JavaScriptBackend]. |
| 228 if (!compiler.serialization.isDeserialized(library)) { | 224 if (!compiler.serialization.isDeserialized(library)) { |
| 229 if (canLibraryUseNative(library)) { | 225 if (canLibraryUseNative(library)) { |
| 230 library.forEachLocalMember((Element element) { | 226 library.forEachLocalMember((Element element) { |
| 231 if (element.isClass) { | 227 if (element.isClass) { |
| 232 checkNativeAnnotation(compiler, element); | 228 checkNativeAnnotation(compiler, element); |
| 233 } | 229 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 /// Called when the compiler starts running the codegen enqueuer. The | 308 /// Called when the compiler starts running the codegen enqueuer. The |
| 313 /// [WorldImpact] of enabled backend features is returned. | 309 /// [WorldImpact] of enabled backend features is returned. |
| 314 WorldImpact onCodegenStart(ClosedWorld closedWorld) => const WorldImpact(); | 310 WorldImpact onCodegenStart(ClosedWorld closedWorld) => const WorldImpact(); |
| 315 | 311 |
| 316 /// Called when code generation has been completed. | 312 /// Called when code generation has been completed. |
| 317 void onCodegenEnd() {} | 313 void onCodegenEnd() {} |
| 318 | 314 |
| 319 // Does this element belong in the output | 315 // Does this element belong in the output |
| 320 bool shouldOutput(Element element) => true; | 316 bool shouldOutput(Element element) => true; |
| 321 | 317 |
| 322 FunctionElement helperForBadMain() => null; | 318 MethodElement helperForBadMain() => null; |
| 323 | 319 |
| 324 FunctionElement helperForMissingMain() => null; | 320 MethodElement helperForMissingMain() => null; |
| 325 | 321 |
| 326 FunctionElement helperForMainArity() => null; | 322 MethodElement helperForMainArity() => null; |
| 327 | 323 |
| 328 /// Computes the [WorldImpact] of calling [mainMethod] as the entry point. | 324 /// Computes the [WorldImpact] of calling [mainMethod] as the entry point. |
| 329 WorldImpact computeMainImpact(MethodElement mainMethod, | 325 WorldImpact computeMainImpact(MethodElement mainMethod, |
| 330 {bool forResolution}) => | 326 {bool forResolution}) => |
| 331 const WorldImpact(); | 327 const WorldImpact(); |
| 332 | 328 |
| 333 /// Returns the location of the patch-file associated with [libraryName] | 329 /// Returns the location of the patch-file associated with [libraryName] |
| 334 /// resolved from [plaformConfigUri]. | 330 /// resolved from [plaformConfigUri]. |
| 335 /// | 331 /// |
| 336 /// Returns null if there is none. | 332 /// Returns null if there is none. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 /// Returns `true` if [cls] is an intercepted class. | 504 /// Returns `true` if [cls] is an intercepted class. |
| 509 // TODO(johnniwinther): Rename this to `isInterceptedClass`. | 505 // TODO(johnniwinther): Rename this to `isInterceptedClass`. |
| 510 bool isInterceptorClass(ClassEntity cls); | 506 bool isInterceptorClass(ClassEntity cls); |
| 511 | 507 |
| 512 /// Returns `true` if [cls] is a native class. | 508 /// Returns `true` if [cls] is a native class. |
| 513 bool isNativeClass(ClassEntity element); | 509 bool isNativeClass(ClassEntity element); |
| 514 | 510 |
| 515 /// Returns `true` if [element] is a native member of a native class. | 511 /// Returns `true` if [element] is a native member of a native class. |
| 516 bool isNativeMember(MemberEntity element); | 512 bool isNativeMember(MemberEntity element); |
| 517 } | 513 } |
| OLD | NEW |