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

Side by Side Diff: pkg/analyzer_cli/lib/src/build_mode.dart

Issue 1966443002: Handle missing sources properly when building AST-based summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 analyzer_cli.src.build_mode; 5 library analyzer_cli.src.build_mode;
6 6
7 import 'dart:core' hide Resource; 7 import 'dart:core' hide Resource;
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit; 10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Maybe an input package contains the source. 317 // Maybe an input package contains the source.
318 { 318 {
319 UnlinkedUnit unlinkedUnit = summaryDataStore.unlinkedMap[absoluteUri]; 319 UnlinkedUnit unlinkedUnit = summaryDataStore.unlinkedMap[absoluteUri];
320 if (unlinkedUnit != null) { 320 if (unlinkedUnit != null) {
321 return unlinkedUnit; 321 return unlinkedUnit;
322 } 322 }
323 } 323 }
324 // Parse the source and serialize its AST. 324 // Parse the source and serialize its AST.
325 Uri uri = Uri.parse(absoluteUri); 325 Uri uri = Uri.parse(absoluteUri);
326 Source source = context.sourceFactory.forUri2(uri); 326 Source source = context.sourceFactory.forUri2(uri);
327 if (!source.exists()) {
328 // TODO(paulberry): we should report a warning/error because DDC
329 // compilations are unlikely to work.
330 return null;
331 }
327 return uriToUnit.putIfAbsent(uri, () { 332 return uriToUnit.putIfAbsent(uri, () {
328 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); 333 CompilationUnit unit = context.computeResult(source, PARSED_UNIT);
329 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit); 334 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit);
330 assembler.addUnlinkedUnit(source, unlinkedUnit); 335 assembler.addUnlinkedUnit(source, unlinkedUnit);
331 return unlinkedUnit; 336 return unlinkedUnit;
332 }); 337 });
333 } 338 }
334 339
335 Map<String, LinkedLibraryBuilder> linkResult = 340 Map<String, LinkedLibraryBuilder> linkResult =
336 link(sourceUris, _getDependency, _getUnit, options.strongMode); 341 link(sourceUris, _getDependency, _getUnit, options.strongMode);
(...skipping 15 matching lines...) Expand all
352 'Illegal input file (must be "\$uri|\$path"): $sourceFile'); 357 'Illegal input file (must be "\$uri|\$path"): $sourceFile');
353 return null; 358 return null;
354 } 359 }
355 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex)); 360 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex));
356 String path = sourceFile.substring(pipeIndex + 1); 361 String path = sourceFile.substring(pipeIndex + 1);
357 uriToFileMap[uri] = new JavaFile(path); 362 uriToFileMap[uri] = new JavaFile(path);
358 } 363 }
359 return uriToFileMap; 364 return uriToFileMap;
360 } 365 }
361 } 366 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698