| Index: pkg/fletchc/lib/incremental/library_updater.dart
|
| diff --git a/pkg/fletchc/lib/incremental/library_updater.dart b/pkg/fletchc/lib/incremental/library_updater.dart
|
| index c9291edd65dbbe65eb05fff290489f61bdbc0eb3..e151a5eee9d733514179323cc24abc7fb0bd5aad 100644
|
| --- a/pkg/fletchc/lib/incremental/library_updater.dart
|
| +++ b/pkg/fletchc/lib/incremental/library_updater.dart
|
| @@ -13,10 +13,16 @@ import 'package:compiler/compiler_new.dart' show
|
|
|
| import 'package:compiler/compiler.dart' as api;
|
|
|
| -import 'package:compiler/src/dart2jslib.dart' show
|
| - Compiler,
|
| - EnqueueTask,
|
| - MessageKind,
|
| +import 'package:compiler/src/compiler.dart' show
|
| + Compiler;
|
| +
|
| +import 'package:compiler/src/enqueue.dart' show
|
| + EnqueueTask;
|
| +
|
| +import 'package:compiler/src/diagnostics/messages.dart' show
|
| + MessageKind;
|
| +
|
| +import 'package:compiler/src/script.dart' show
|
| Script;
|
|
|
| import 'package:compiler/src/elements/elements.dart' show
|
| @@ -31,17 +37,29 @@ import 'package:compiler/src/elements/elements.dart' show
|
| ScopeContainerElement,
|
| TypeDeclarationElement;
|
|
|
| -import 'package:compiler/src/scanner/scannerlib.dart' show
|
| - EOF_TOKEN,
|
| - Listener,
|
| - NodeListener,
|
| - Parser,
|
| +import 'package:compiler/src/tokens/token_constants.dart' show
|
| + EOF_TOKEN;
|
| +
|
| +import 'package:compiler/src/tokens/token.dart' show
|
| + Token;
|
| +
|
| +import 'package:compiler/src/parser/partial_elements.dart' show
|
| PartialClassElement,
|
| PartialElement,
|
| PartialFieldList,
|
| - PartialFunctionElement,
|
| - Scanner,
|
| - Token;
|
| + PartialFunctionElement;
|
| +
|
| +import 'package:compiler/src/scanner/scanner.dart' show
|
| + Scanner;
|
| +
|
| +import 'package:compiler/src/parser/parser.dart' show
|
| + Parser;
|
| +
|
| +import 'package:compiler/src/parser/listener.dart' show
|
| + Listener;
|
| +
|
| +import 'package:compiler/src/parser/node_listener.dart' show
|
| + NodeListener;
|
|
|
| import 'package:compiler/src/io/source_file.dart' show
|
| CachingUtf8BytesSourceFile,
|
| @@ -92,10 +110,6 @@ import 'package:compiler/src/elements/modelx.dart' show
|
| FieldElementX,
|
| LibraryElementX;
|
|
|
| -import 'package:compiler/src/universe/universe.dart' show
|
| - Selector,
|
| - UniverseSelector;
|
| -
|
| import 'package:compiler/src/constants/values.dart' show
|
| ConstantValue;
|
|
|
| @@ -331,7 +345,7 @@ class LibraryUpdater extends FletchFeatures {
|
| });
|
| }
|
|
|
| - Future<bool> _haveTagsChanged(LibraryElement library) {
|
| + Future<bool> _haveTagsChanged(LibraryElementX library) {
|
| Script before = library.entryCompilationUnit.script;
|
| if (!_context._uriHasUpdate(before.resourceUri)) {
|
| // The entry compilation unit hasn't been updated. So the tags aren't
|
| @@ -345,8 +359,11 @@ class LibraryUpdater extends FletchFeatures {
|
| _entryUnitTokens[library] = token;
|
| // Using two parsers to only create the nodes we want ([LibraryTag]).
|
| Parser parser = new Parser(new Listener());
|
| + Element entryCompilationUnit = library.entryCompilationUnit;
|
| NodeListener listener = new NodeListener(
|
| - compiler, library.entryCompilationUnit);
|
| + compiler.resolution.parsing
|
| + .getScannerOptionsFor(entryCompilationUnit),
|
| + compiler.reporter, entryCompilationUnit);
|
| Parser nodeParser = new Parser(listener);
|
| Iterator<LibraryTag> tags = library.tags.iterator;
|
| while (token.kind != EOF_TOKEN) {
|
| @@ -405,18 +422,18 @@ class LibraryUpdater extends FletchFeatures {
|
| TagState tagState = new TagState();
|
| for (LibraryTag tag in newLibrary.tags) {
|
| if (tag.isImport) {
|
| - tagState.checkTag(TagState.IMPORT_OR_EXPORT, tag, compiler);
|
| + tagState.checkTag(TagState.IMPORT_OR_EXPORT, tag, compiler.reporter);
|
| } else if (tag.isExport) {
|
| - tagState.checkTag(TagState.IMPORT_OR_EXPORT, tag, compiler);
|
| + tagState.checkTag(TagState.IMPORT_OR_EXPORT, tag, compiler.reporter);
|
| } else if (tag.isLibraryName) {
|
| - tagState.checkTag(TagState.LIBRARY, tag, compiler);
|
| + tagState.checkTag(TagState.LIBRARY, tag, compiler.reporter);
|
| if (newLibrary.libraryTag == null) {
|
| // Use the first if there are multiple (which is reported as an
|
| // error in [TagState.checkTag]).
|
| newLibrary.libraryTag = tag;
|
| }
|
| } else if (tag.isPart) {
|
| - tagState.checkTag(TagState.PART, tag, compiler);
|
| + tagState.checkTag(TagState.PART, tag, compiler.reporter);
|
| }
|
| }
|
|
|
| @@ -430,10 +447,11 @@ class LibraryUpdater extends FletchFeatures {
|
| // TODO(ahe): Copied from library_loader.
|
| CompilationUnitElement newUnit =
|
| new CompilationUnitElementX(script, newLibrary);
|
| - compiler.withCurrentElement(newUnit, () {
|
| + compiler.reporter.withCurrentElement(newUnit, () {
|
| compiler.scanner.scan(newUnit);
|
| if (unit.partTag == null) {
|
| - compiler.reportError(unit, MessageKind.MISSING_PART_OF_TAG);
|
| + compiler.reporter
|
| + .reportErrorMessage(unit, MessageKind.MISSING_PART_OF_TAG);
|
| }
|
| });
|
| }
|
| @@ -653,7 +671,7 @@ class LibraryUpdater extends FletchFeatures {
|
| if (element is TypeDeclarationElement) {
|
| if (!element.isResolved) {
|
| if (element is PartialClassElement) {
|
| - ClassNode node = element.parseNode(compiler).asClassNode();
|
| + ClassNode node = element.parseNode(compiler.parsing).asClassNode();
|
| if (node == null) {
|
| cannotReuse(
|
| element, "Class body isn't a ClassNode on $element");
|
| @@ -760,11 +778,10 @@ class LibraryUpdater extends FletchFeatures {
|
|
|
| ClassElement cls = container;
|
|
|
| - if (!compiler.world.isInstantiated(cls.declaration)) {
|
| - // dart2js currently only maintain subclasses for classes that are
|
| - // instantiated.
|
| + if (!cls.declaration.isResolved) {
|
| + // TODO(ahe): This test fails otherwise: experimental/add_static_field.
|
| throw new IncrementalCompilationFailed(
|
| - "Unable to compute subclasses of ${cls.declaration}");
|
| + "Unresolved class ${cls.declaration}");
|
| }
|
| var externalSubtypes =
|
| compiler.world.subclassesOf(cls).where((e) => e.library != library);
|
| @@ -781,7 +798,7 @@ class LibraryUpdater extends FletchFeatures {
|
| PartialFunctionElement before,
|
| PartialFunctionElement after) {
|
| FunctionExpression node =
|
| - after.parseNode(compiler).asFunctionExpression();
|
| + after.parseNode(compiler.parsing).asFunctionExpression();
|
| if (node == null) {
|
| return cannotReuse(after, "Not a function expression: '$node'");
|
| }
|
| @@ -789,7 +806,7 @@ class LibraryUpdater extends FletchFeatures {
|
| if (node.body != null) {
|
| last = node.body.getBeginToken();
|
| }
|
| - if (before.isErroneous ||
|
| + if (before.isMalformed ||
|
| compiler.elementsWithCompileTimeErrors.contains(before) ||
|
| isTokenBetween(diffToken, after.beginToken, last)) {
|
| removeFunction(before);
|
| @@ -819,7 +836,7 @@ class LibraryUpdater extends FletchFeatures {
|
| Token diffToken,
|
| PartialClassElement before,
|
| PartialClassElement after) {
|
| - ClassNode node = after.parseNode(compiler).asClassNode();
|
| + ClassNode node = after.parseNode(compiler.parsing).asClassNode();
|
| if (node == null) {
|
| return cannotReuse(after, "Not a ClassNode: '$node'");
|
| }
|
| @@ -936,12 +953,12 @@ class LibraryUpdater extends FletchFeatures {
|
| enqueuer.resolution.addToWorkList(element);
|
| } else {
|
| ClassElement cls = element;
|
| - cls.ensureResolved(compiler);
|
| + cls.ensureResolved(compiler.resolution);
|
|
|
| // We've told the enqueuer to forget this class, now tell it that it's
|
| // in use again. TODO(ahe): We only need to do this if [cls] was
|
| // already instantiated.
|
| - enqueuer.codegen.registerInstantiatedType(cls.rawType, null);
|
| + enqueuer.codegen.registerInstantiatedType(cls.rawType);
|
| }
|
| }
|
| compiler.processQueue(enqueuer.resolution, null);
|
| @@ -1210,7 +1227,7 @@ class AddedFunctionUpdate extends Update with FletchFeatures {
|
| enclosing = enclosing.compilationUnit;
|
| }
|
| PartialFunctionElement copy = element.copyWithEnclosing(enclosing);
|
| - container.addMember(copy, compiler);
|
| + container.addMember(copy, compiler.reporter);
|
| return copy;
|
| }
|
| }
|
| @@ -1231,7 +1248,7 @@ class AddedClassUpdate extends Update with FletchFeatures {
|
| // TODO(ahe): Reuse compilation unit of element instead?
|
| CompilationUnitElementX compilationUnit = library.compilationUnit;
|
| PartialClassElement copy = element.copyWithEnclosing(compilationUnit);
|
| - compilationUnit.addMember(copy, compiler);
|
| + compilationUnit.addMember(copy, compiler.reporter);
|
| return copy;
|
| }
|
| }
|
| @@ -1255,7 +1272,7 @@ class AddedFieldUpdate extends Update with FletchFeatures {
|
| enclosing = enclosing.compilationUnit;
|
| }
|
| FieldElementX copy = element.copyWithEnclosing(enclosing);
|
| - container.addMember(copy, compiler);
|
| + container.addMember(copy, compiler.reporter);
|
| return copy;
|
| }
|
| }
|
| @@ -1285,7 +1302,6 @@ class ClassUpdate extends Update with FletchFeatures {
|
| void reuseElement() {
|
| before.supertype = null;
|
| before.interfaces = null;
|
| - before.nativeTagInfo = null;
|
| before.supertypeLoadState = STATE_NOT_STARTED;
|
| before.resolutionState = STATE_NOT_STARTED;
|
| before.isProxy = false;
|
|
|