| Index: dart/pkg/dart2js_incremental/lib/library_updater.dart
|
| diff --git a/dart/pkg/dart2js_incremental/lib/library_updater.dart b/dart/pkg/dart2js_incremental/lib/library_updater.dart
|
| index 4de26e37bdc4a0e4b811a2d7d44e31b233429c12..bf4dffd0328b7c5ba608caf06dc94f8bd4f9b960 100644
|
| --- a/dart/pkg/dart2js_incremental/lib/library_updater.dart
|
| +++ b/dart/pkg/dart2js_incremental/lib/library_updater.dart
|
| @@ -228,6 +228,9 @@ class LibraryUpdater extends JsFeatures {
|
| if (element is PartialFunctionElement) {
|
| addFunction(element, container);
|
| return true;
|
| + } else if (element is PartialClassElement) {
|
| + addClass(element, container);
|
| + return true;
|
| }
|
| return cannotReuse(element, "Added element that isn't a function.");
|
| }
|
| @@ -240,6 +243,14 @@ class LibraryUpdater extends JsFeatures {
|
| updates.add(new AddedFunctionUpdate(compiler, element, container));
|
| }
|
|
|
| + void addClass(
|
| + PartialClassElement element,
|
| + LibraryElementX library) {
|
| + invalidateScopesAffectedBy(element, library);
|
| +
|
| + updates.add(new AddedClassUpdate(compiler, element, library));
|
| + }
|
| +
|
| bool canReuseRemovedElement(PartialElement element) {
|
| if (element is PartialFunctionElement) {
|
| removeFunction(element);
|
| @@ -417,14 +428,18 @@ class LibraryUpdater extends JsFeatures {
|
| compiler.progress.reset();
|
| }
|
| for (Element element in updatedElements) {
|
| - compiler.enqueuer.resolution.addToWorkList(element);
|
| + if (!element.isClass) {
|
| + compiler.enqueuer.resolution.addToWorkList(element);
|
| + }
|
| }
|
| compiler.processQueue(compiler.enqueuer.resolution, null);
|
|
|
| compiler.phase = Compiler.PHASE_DONE_RESOLVING;
|
|
|
| for (Element element in updatedElements) {
|
| - compiler.enqueuer.codegen.addToWorkList(element);
|
| + if (!element.isClass) {
|
| + compiler.enqueuer.codegen.addToWorkList(element);
|
| + }
|
| }
|
| compiler.processQueue(compiler.enqueuer.codegen, null);
|
|
|
| @@ -651,6 +666,9 @@ class RemovedFunctionUpdate extends Update with JsFeatures, ReuseFunction {
|
| }
|
|
|
| void removeFromEnclosing() {
|
| + // TODO(ahe): Need to recompute duplicated elements logic again. Simplest
|
| + // solution is probably to remove all elements from enclosing scope and add
|
| + // them back.
|
| PartialClassElement cls = element.enclosingClass;
|
| if (cls == null) {
|
| removeFromLibrary(element.library);
|
| @@ -720,12 +738,12 @@ class AddedFunctionUpdate extends Update with JsFeatures {
|
|
|
| PartialFunctionElement get before => null;
|
|
|
| - PartialElement get after => element;
|
| + PartialFunctionElement get after => element;
|
|
|
| PartialFunctionElement apply() {
|
| Element enclosing = container;
|
| if (enclosing.isLibrary) {
|
| - // TODO(ahe): Reuse compilation unit instead?
|
| + // TODO(ahe): Reuse compilation unit of element instead?
|
| enclosing = enclosing.compilationUnit;
|
| }
|
| PartialFunctionElement copy = element.copyWithEnclosing(enclosing);
|
| @@ -734,6 +752,27 @@ class AddedFunctionUpdate extends Update with JsFeatures {
|
| }
|
| }
|
|
|
| +class AddedClassUpdate extends Update with JsFeatures {
|
| + final PartialClassElement element;
|
| +
|
| + final LibraryElementX library;
|
| +
|
| + AddedClassUpdate(Compiler compiler, this.element, this.library)
|
| + : super(compiler);
|
| +
|
| + PartialClassElement get before => null;
|
| +
|
| + PartialClassElement get after => element;
|
| +
|
| + PartialFunctionElement apply() {
|
| + // TODO(ahe): Reuse compilation unit of element instead?
|
| + CompilationUnitElementX compilationUnit = library.compilationUnit;
|
| + PartialClassElement copy = element.copyWithEnclosing(compilationUnit);
|
| + compilationUnit.addMember(copy, compiler);
|
| + return copy;
|
| + }
|
| +}
|
| +
|
| /// Returns all qualified names in [element] with less than four identifiers. A
|
| /// qualified name is an identifier followed by a sequence of dots and
|
| /// identifiers, for example, "x", and "x.y.z". But not "x.y.z.w" ("w" is the
|
|
|