| Index: pkg/compiler/lib/src/compiler.dart
|
| diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
|
| index 9b8031fac7574656d9c08af61f8f1e74412cb84c..92ea4dd36dbd64febbb31abfe8c4cf7d6c9f988b 100644
|
| --- a/pkg/compiler/lib/src/compiler.dart
|
| +++ b/pkg/compiler/lib/src/compiler.dart
|
| @@ -365,14 +365,14 @@ abstract class Compiler implements LibraryLoaderListener, IdGenerator {
|
| this,
|
| environment),
|
| parser = new ParserTask(this, parsing.parserOptions),
|
| - patchParser = new PatchParserTask(this, parsing.parserOptions),
|
| + patchParser = createPatchParserTask(),
|
| resolver = createResolverTask(),
|
| closureToClassMapper = new closureMapping.ClosureTask(this),
|
| checker = new TypeCheckerTask(this),
|
| typesTask = new ti.TypesTask(this),
|
| constants = backend.constantCompilerTask,
|
| deferredLoadTask = new DeferredLoadTask(this),
|
| - mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this),
|
| + mirrorUsageAnalyzerTask = createMirrorUsageAnalyzerTask(),
|
| enqueuer = backend.makeEnqueuer(),
|
| dumpInfoTask = new DumpInfoTask(this),
|
| reuseLibraryTask = new GenericTask('Reuse library', this),
|
| @@ -395,6 +395,14 @@ abstract class Compiler implements LibraryLoaderListener, IdGenerator {
|
| return new ResolverTask(this, backend.constantCompilerTask);
|
| }
|
|
|
| + PatchParserTask createPatchParserTask() {
|
| + return new PatchParserTask(this, parsing.parserOptions);
|
| + }
|
| +
|
| + MirrorUsageAnalyzerTask createMirrorUsageAnalyzerTask() {
|
| + return new MirrorUsageAnalyzerTask(this);
|
| + }
|
| +
|
| Universe get resolverWorld => enqueuer.resolution.universe;
|
| Universe get codegenWorld => enqueuer.codegen.universe;
|
|
|
| @@ -459,7 +467,9 @@ abstract class Compiler implements LibraryLoaderListener, IdGenerator {
|
| /// for [library].
|
| Future onLibraryScanned(LibraryElement library, LibraryLoader loader) {
|
| Uri uri = library.canonicalUri;
|
| - if (uri == Uris.dart_core) {
|
| + if (library.compilationUnit.script.isSynthesized) {
|
| + // Ignore.
|
| + } else if (uri == Uris.dart_core) {
|
| initializeCoreClasses();
|
| identicalFunction = coreLibrary.find('identical');
|
| } else if (uri == Uris.dart__internal) {
|
| @@ -1051,7 +1061,7 @@ abstract class Compiler implements LibraryLoaderListener, IdGenerator {
|
| }
|
|
|
| WorldImpact analyzeElement(Element element)
|
| - => selfTask.measureSubtask("Compiler.analyzeElement", () {
|
| + => selfTask.measureSubtaskElement("Compiler.analyzeElement", element, () {
|
| assert(invariant(
|
| element,
|
| element.impliesType ||
|
| @@ -1069,7 +1079,7 @@ abstract class Compiler implements LibraryLoaderListener, IdGenerator {
|
|
|
| WorldImpact analyze(ResolutionWorkItem work,
|
| ResolutionEnqueuer world)
|
| - => selfTask.measureSubtask("Compiler.analyze", () {
|
| + => selfTask.measureSubtaskElement("Compiler.analyze", work.element, () {
|
| assert(invariant(work.element, identical(world, enqueuer.resolution)));
|
| assert(invariant(work.element, !work.isAnalyzed,
|
| message: 'Element ${work.element} has already been analyzed'));
|
| @@ -1697,8 +1707,14 @@ class CompilerDiagnosticReporter extends DiagnosticReporter {
|
| if (astElement.hasNode) {
|
| Token from = astElement.node.getBeginToken();
|
| Token to = astElement.node.getEndToken();
|
| - if (astElement.metadata.isNotEmpty) {
|
| - from = astElement.metadata.first.beginToken;
|
| + for (MetadataAnnotation annotation in astElement.metadata) {
|
| + // For patched elements, metadata contains annotations from both
|
| + // origin and patch. Search for the first annotation from this
|
| + // element. For example, if origin class is @Deprecated.
|
| + if (annotation.annotatedElement == currentElement) {
|
| + from = annotation.beginToken;
|
| + break;
|
| + }
|
| }
|
| return validateToken(from, to);
|
| }
|
|
|