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 09487fcc2056e0449f6d899c43c790508bcfb368..ff2e37f3e25dd500832596cbba5796a1d5d39f5e 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; |
@@ -317,7 +331,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 |
@@ -331,8 +345,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) { |
@@ -391,18 +408,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); |
} |
} |
@@ -416,10 +433,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); |
} |
}); |
} |
@@ -639,7 +657,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"); |
@@ -767,7 +785,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'"); |
} |
@@ -775,7 +793,7 @@ class LibraryUpdater extends FletchFeatures { |
if (node.body != null) { |
last = node.body.getBeginToken(); |
} |
- if (before.isErroneous || |
+ if (before.isMalformed || |
ahe
2015/11/17 16:44:08
What does isMalformed mean?
sigurdm
2015/11/19 14:33:46
It's basically a rename of what was before isErron
|
compiler.elementsWithCompileTimeErrors.contains(before) || |
isTokenBetween(diffToken, after.beginToken, last)) { |
removeFunction(before); |
@@ -805,7 +823,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'"); |
} |
@@ -922,12 +940,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); |
@@ -1196,7 +1214,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; |
} |
} |
@@ -1217,7 +1235,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; |
} |
} |
@@ -1241,7 +1259,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; |
} |
} |
@@ -1271,7 +1289,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; |