Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: pkg/code_transformers/lib/src/resolver_impl.dart

Issue 233673003: Deal better with missing sources in code_transformers and polymer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/polymer/lib/src/build/script_compactor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library code_transformer.src.resolver_impl; 5 library code_transformer.src.resolver_impl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:analyzer/analyzer.dart' show parseCompilationUnit; 8 import 'package:analyzer/analyzer.dart' show parseCompilationUnit;
9 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; 9 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
10 import 'package:analyzer/src/generated/constant.dart' show ConstantEvaluator, 10 import 'package:analyzer/src/generated/constant.dart' show ConstantEvaluator,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 for (var unreachable in unreachableAssets) { 152 for (var unreachable in unreachableAssets) {
153 changeSet.removedSource(unreachable); 153 changeSet.removedSource(unreachable);
154 unreachable.updateContents(null); 154 unreachable.updateContents(null);
155 sources.remove(unreachable.assetId); 155 sources.remove(unreachable.assetId);
156 } 156 }
157 157
158 // Update the analyzer context with the latest sources 158 // Update the analyzer context with the latest sources
159 _context.applyChanges(changeSet); 159 _context.applyChanges(changeSet);
160 // Force resolve each entry point (the getter will ensure the library is 160 // Force resolve each entry point (the getter will ensure the library is
161 // computed first). 161 // computed first).
162 _entryLibraries = entryPoints 162 _entryLibraries = entryPoints.map((id) {
163 .map((id) => _context.computeLibraryElement(sources[id])).toList(); 163 var source = sources[id];
164 if (source == null) return null;
165 return _context.computeLibraryElement(source);
166 }).toList();
164 }); 167 });
165 } 168 }
166 169
167 Iterable<LibraryElement> get libraries { 170 Iterable<LibraryElement> get libraries {
168 if (_libraries == null) { 171 if (_libraries == null) {
169 // Note: we don't use `lib.visibleLibraries` because that excludes the 172 // Note: we don't use `lib.visibleLibraries` because that excludes the
170 // exports seen in the entry libraries. 173 // exports seen in the entry libraries.
171 _libraries = new Set<LibraryElement>(); 174 _libraries = new Set<LibraryElement>();
172 _entryLibraries.forEach(_collectLibraries); 175 _entryLibraries.forEach(_collectLibraries);
173 } 176 }
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 626
624 void apply(ChangeSet changeSet) { 627 void apply(ChangeSet changeSet) {
625 if (!source.updateContents(content)) return; 628 if (!source.updateContents(content)) return;
626 if (source._revision == 1 && source._contents != null) { 629 if (source._revision == 1 && source._contents != null) {
627 changeSet.addedSource(source); 630 changeSet.addedSource(source);
628 } else { 631 } else {
629 changeSet.changedSource(source); 632 changeSet.changedSource(source);
630 } 633 }
631 } 634 }
632 } 635 }
OLDNEW
« no previous file with comments | « no previous file | pkg/polymer/lib/src/build/script_compactor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698