Chromium Code Reviews| Index: dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| index 419f5214d443bf1ee8ae8ddb4c0e4a9c19e77495..87e729467a09f6bce94643e276444514b407aaa6 100644 |
| --- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| +++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| @@ -75,7 +75,6 @@ class JavaScriptBackend extends Backend { |
| HType mutableArrayType; |
| HType fixedArrayType; |
| HType extendableArrayType; |
| - |
| // TODO(9577): Make it so that these are not needed when there are no native |
| // classes. |
| @@ -156,6 +155,14 @@ class JavaScriptBackend extends Backend { |
| final RuntimeTypes rti; |
| + /// Holds the method "disableTreeShaking" in js_mirrors when |
| + /// dart:mirrors has been loaded. |
| + FunctionElement disableTreeShakingMarker; |
| + |
| + /// Holds the method "preserveNames" in js_mirrors when |
| + /// dart:mirrors has been loaded. |
| + FunctionElement preserveNamesMarker; |
| + |
| JavaScriptBackend(Compiler compiler, bool generateSourceMap, bool disableEval) |
| : namer = determineNamer(compiler), |
| usedInterceptors = new Set<Selector>(), |
| @@ -1114,4 +1121,19 @@ class JavaScriptBackend extends Backend { |
| ClassElement get typeImplementation => typeLiteralClass; |
| ClassElement get boolImplementation => jsBoolClass; |
| ClassElement get nullImplementation => jsNullClass; |
| + |
| + void enableMirrors() { |
| + LibraryElement library = compiler.libraries['dart:_js_mirrors']; |
| + disableTreeShakingMarker = |
| + library.find(const SourceString('disableTreeShaking')); |
| + preserveNamesMarker = |
| + library.find(const SourceString('preserveNames')); |
| + } |
| + |
| + void registerStaticUse(Element element, Enqueuer enqueuer) { |
| + if (element == disableTreeShakingMarker) { |
| + enqueuer.enqueueEverything(); |
| + } else if (element == preserveNamesMarker) { |
| + } |
|
Johnni Winther
2013/06/13 07:08:29
Something missing in this block?
ahe
2013/06/14 12:00:22
Yes. I'll fill in more stuff in future CLs.
|
| + } |
| } |