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

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

Issue 2223113002: Add line starts into unlinked units. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweaks Created 4 years, 4 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
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;
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';
28 import 'package:analyzer_cli/src/analyzer_impl.dart'; 29 import 'package:analyzer_cli/src/analyzer_impl.dart';
29 import 'package:analyzer_cli/src/driver.dart'; 30 import 'package:analyzer_cli/src/driver.dart';
30 import 'package:analyzer_cli/src/error_formatter.dart'; 31 import 'package:analyzer_cli/src/error_formatter.dart';
31 import 'package:analyzer_cli/src/options.dart'; 32 import 'package:analyzer_cli/src/options.dart';
32 import 'package:bazel_worker/bazel_worker.dart'; 33 import 'package:bazel_worker/bazel_worker.dart';
33 34
34 /** 35 /**
35 * Persistent Bazel worker. 36 * Persistent Bazel worker.
36 */ 37 */
37 class AnalyzerWorkerLoop extends SyncWorkerLoop { 38 class AnalyzerWorkerLoop extends SyncWorkerLoop {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Parse the source and serialize its AST. 352 // Parse the source and serialize its AST.
352 Uri uri = Uri.parse(absoluteUri); 353 Uri uri = Uri.parse(absoluteUri);
353 Source source = context.sourceFactory.forUri2(uri); 354 Source source = context.sourceFactory.forUri2(uri);
354 if (!source.exists()) { 355 if (!source.exists()) {
355 // TODO(paulberry): we should report a warning/error because DDC 356 // TODO(paulberry): we should report a warning/error because DDC
356 // compilations are unlikely to work. 357 // compilations are unlikely to work.
357 return null; 358 return null;
358 } 359 }
359 return uriToUnit.putIfAbsent(uri, () { 360 return uriToUnit.putIfAbsent(uri, () {
360 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); 361 CompilationUnit unit = context.computeResult(source, PARSED_UNIT);
361 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit); 362 LineInfo lineInfo = context.computeResult(source, LINE_INFO);
363 UnlinkedUnitBuilder unlinkedUnit =
364 serializeAstUnlinked(unit, lineInfo.lineStarts);
362 assembler.addUnlinkedUnit(source, unlinkedUnit); 365 assembler.addUnlinkedUnit(source, unlinkedUnit);
363 return unlinkedUnit; 366 return unlinkedUnit;
364 }); 367 });
365 } 368 }
366 369
367 Map<String, LinkedLibraryBuilder> linkResult = 370 Map<String, LinkedLibraryBuilder> linkResult =
368 link(sourceUris, _getDependency, _getUnit, options.strongMode); 371 link(sourceUris, _getDependency, _getUnit, options.strongMode);
369 linkResult.forEach(assembler.addLinkedLibrary); 372 linkResult.forEach(assembler.addLinkedLibrary);
370 } 373 }
371 374
(...skipping 12 matching lines...) Expand all
384 'Illegal input file (must be "\$uri|\$path"): $sourceFile'); 387 'Illegal input file (must be "\$uri|\$path"): $sourceFile');
385 return null; 388 return null;
386 } 389 }
387 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex)); 390 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex));
388 String path = sourceFile.substring(pipeIndex + 1); 391 String path = sourceFile.substring(pipeIndex + 1);
389 uriToFileMap[uri] = new JavaFile(path); 392 uriToFileMap[uri] = new JavaFile(path);
390 } 393 }
391 return uriToFileMap; 394 return uriToFileMap;
392 } 395 }
393 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698