| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
| 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.md file. | |
| 4 | |
| 5 library fletchc.incremental_backend; | |
| 6 | |
| 7 import 'package:compiler/src/elements/elements.dart' show | |
| 8 Element, | |
| 9 FieldElement, | |
| 10 FunctionElement; | |
| 11 | |
| 12 import 'fletch_system.dart' show | |
| 13 FletchSystem; | |
| 14 | |
| 15 import 'src/fletch_system_builder.dart' show | |
| 16 FletchSystemBuilder; | |
| 17 | |
| 18 import 'src/fletch_context.dart' show | |
| 19 FletchContext; | |
| 20 | |
| 21 // TODO(ahe): Move this to dart2js upstream when it's stabilized | |
| 22 abstract class IncrementalBackend { | |
| 23 | |
| 24 /// Remove [element] from the compilation result. Called after resolution and | |
| 25 /// codegen phase. | |
| 26 /// | |
| 27 /// This is different from [Backend.forgetElement] which is about preparing | |
| 28 /// for a new round of resolution and codegen. `forgetElement` is called | |
| 29 /// before processing the work queue, this method is called after and the old | |
| 30 /// version of [element] should be removed. | |
| 31 void removeFunction(FunctionElement element); | |
| 32 | |
| 33 /// Remove [element] from the compilation result. Called after resolution and | |
| 34 /// codegen phase. | |
| 35 /// | |
| 36 /// See [removeFunction] for how this compares to `forgetElement`. | |
| 37 void removeField(FieldElement element); | |
| 38 | |
| 39 /// Register that [element] is now part of the compilation. This happens | |
| 40 /// during the codegen phase. | |
| 41 // TODO(ahe): We should probably remove this API, I believe it is an artifact | |
| 42 // of the incremental compiler not enqueuing fields. | |
| 43 void newElement(Element element); | |
| 44 | |
| 45 /// Update references to [element] in [users]. | |
| 46 // TODO(ahe): Computing [users] is expensive, and may not be necessary in | |
| 47 // dart2js. Move to IncrementalFletchBackend or add a bool to say if the call | |
| 48 // is needed. | |
| 49 void replaceFunctionUsageElement(Element element, List<Element> users); | |
| 50 } | |
| 51 | |
| 52 abstract class IncrementalFletchBackend implements IncrementalBackend { | |
| 53 FletchSystemBuilder get systemBuilder; | |
| 54 | |
| 55 void newSystemBuilder(FletchSystem predecessorSystem); | |
| 56 | |
| 57 /// In Fletch, assembleProgram is incremental. In dart2js it isn't. | |
| 58 int assembleProgram(); | |
| 59 } | |
| OLD | NEW |