| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |