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; |
11 import 'package:analyzer/dart/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
12 import 'package:analyzer/file_system/file_system.dart'; | 12 import 'package:analyzer/file_system/file_system.dart'; |
13 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
14 import 'package:analyzer/src/generated/error.dart'; | 14 import 'package:analyzer/src/generated/error.dart'; |
15 import 'package:analyzer/src/generated/java_io.dart'; | 15 import 'package:analyzer/src/generated/java_io.dart'; |
16 import 'package:analyzer/src/generated/sdk.dart'; | 16 import 'package:analyzer/src/generated/sdk.dart'; |
17 import 'package:analyzer/src/generated/sdk_io.dart'; | 17 import 'package:analyzer/src/generated/sdk_io.dart'; |
18 import 'package:analyzer/src/generated/source.dart'; | 18 import 'package:analyzer/src/generated/source.dart'; |
19 import 'package:analyzer/src/generated/source_io.dart'; | 19 import 'package:analyzer/src/generated/source_io.dart'; |
20 import 'package:analyzer/src/summary/format.dart'; | 20 import 'package:analyzer/src/summary/format.dart'; |
21 import 'package:analyzer/src/summary/idl.dart'; | 21 import 'package:analyzer/src/summary/idl.dart'; |
22 import 'package:analyzer/src/summary/link.dart'; | 22 import 'package:analyzer/src/summary/link.dart'; |
23 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 23 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
24 import 'package:analyzer/src/summary/summarize_ast.dart'; | 24 import 'package:analyzer/src/summary/summarize_ast.dart'; |
25 import 'package:analyzer/src/summary/summarize_elements.dart'; | 25 import 'package:analyzer/src/summary/summarize_elements.dart'; |
26 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; | 26 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; |
27 import 'package:analyzer/task/dart.dart'; | 27 import 'package:analyzer/task/dart.dart'; |
28 import 'package:analyzer/task/general.dart'; | |
29 import 'package:analyzer_cli/src/analyzer_impl.dart'; | 28 import 'package:analyzer_cli/src/analyzer_impl.dart'; |
30 import 'package:analyzer_cli/src/driver.dart'; | 29 import 'package:analyzer_cli/src/driver.dart'; |
31 import 'package:analyzer_cli/src/error_formatter.dart'; | 30 import 'package:analyzer_cli/src/error_formatter.dart'; |
32 import 'package:analyzer_cli/src/options.dart'; | 31 import 'package:analyzer_cli/src/options.dart'; |
33 import 'package:bazel_worker/bazel_worker.dart'; | 32 import 'package:bazel_worker/bazel_worker.dart'; |
34 | 33 |
35 /** | 34 /** |
36 * Persistent Bazel worker. | 35 * Persistent Bazel worker. |
37 */ | 36 */ |
38 class AnalyzerWorkerLoop extends SyncWorkerLoop { | 37 class AnalyzerWorkerLoop extends SyncWorkerLoop { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // Parse the source and serialize its AST. | 351 // Parse the source and serialize its AST. |
353 Uri uri = Uri.parse(absoluteUri); | 352 Uri uri = Uri.parse(absoluteUri); |
354 Source source = context.sourceFactory.forUri2(uri); | 353 Source source = context.sourceFactory.forUri2(uri); |
355 if (!source.exists()) { | 354 if (!source.exists()) { |
356 // TODO(paulberry): we should report a warning/error because DDC | 355 // TODO(paulberry): we should report a warning/error because DDC |
357 // compilations are unlikely to work. | 356 // compilations are unlikely to work. |
358 return null; | 357 return null; |
359 } | 358 } |
360 return uriToUnit.putIfAbsent(uri, () { | 359 return uriToUnit.putIfAbsent(uri, () { |
361 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); | 360 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); |
362 LineInfo lineInfo = context.computeResult(source, LINE_INFO); | 361 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit); |
363 UnlinkedUnitBuilder unlinkedUnit = | |
364 serializeAstUnlinked(unit, lineInfo.lineStarts); | |
365 assembler.addUnlinkedUnit(source, unlinkedUnit); | 362 assembler.addUnlinkedUnit(source, unlinkedUnit); |
366 return unlinkedUnit; | 363 return unlinkedUnit; |
367 }); | 364 }); |
368 } | 365 } |
369 | 366 |
370 Map<String, LinkedLibraryBuilder> linkResult = | 367 Map<String, LinkedLibraryBuilder> linkResult = |
371 link(sourceUris, _getDependency, _getUnit, options.strongMode); | 368 link(sourceUris, _getDependency, _getUnit, options.strongMode); |
372 linkResult.forEach(assembler.addLinkedLibrary); | 369 linkResult.forEach(assembler.addLinkedLibrary); |
373 } | 370 } |
374 | 371 |
(...skipping 12 matching lines...) Expand all Loading... |
387 'Illegal input file (must be "\$uri|\$path"): $sourceFile'); | 384 'Illegal input file (must be "\$uri|\$path"): $sourceFile'); |
388 return null; | 385 return null; |
389 } | 386 } |
390 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex)); | 387 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex)); |
391 String path = sourceFile.substring(pipeIndex + 1); | 388 String path = sourceFile.substring(pipeIndex + 1); |
392 uriToFileMap[uri] = new JavaFile(path); | 389 uriToFileMap[uri] = new JavaFile(path); |
393 } | 390 } |
394 return uriToFileMap; | 391 return uriToFileMap; |
395 } | 392 } |
396 } | 393 } |
OLD | NEW |