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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2445193003: Fix for LibraryDirective annotations while applying resynthesized element model. (Closed)
Patch Set: Created 4 years, 1 month 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 | pkg/analyzer/lib/src/generated/declaration_resolver.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 */ 319 */
320 void _addToStoreUnlinked( 320 void _addToStoreUnlinked(
321 SummaryDataStore store, String uri, UnlinkedUnit unlinked) { 321 SummaryDataStore store, String uri, UnlinkedUnit unlinked) {
322 store.unlinkedMap[uri] = unlinked; 322 store.unlinkedMap[uri] = unlinked;
323 } 323 }
324 324
325 /** 325 /**
326 * Compute the [AnalysisResult] for the [file]. 326 * Compute the [AnalysisResult] for the [file].
327 */ 327 */
328 AnalysisResult _computeAnalysisResult(_File file) { 328 AnalysisResult _computeAnalysisResult(_File file) {
329 // TODO(scheglov) Computing resolved unit fails for these units.
330 // pkg/analyzer/lib/plugin/embedded_resolver_provider.dart
331 // pkg/analyzer/lib/plugin/embedded_resolver_provider.dart
332 if (file.path.endsWith(
333 'pkg/analyzer/lib/plugin/embedded_resolver_provider.dart') ||
334 file.path.endsWith('pkg/analyzer/lib/source/embedder.dart') ||
335 file.path.endsWith('pkg/analyzer/lib/src/generated/ast.dart') ||
336 file.path.endsWith('pkg/analyzer/lib/src/generated/element.dart') ||
337 file.path
338 .endsWith('pkg/analyzer/lib/src/generated/element_handle.dart') ||
339 file.path.endsWith('pkg/analyzer/lib/src/generated/error.dart') ||
340 file.path.endsWith('pkg/analyzer/lib/src/generated/scanner.dart') ||
341 file.path.endsWith('pkg/analyzer/lib/src/generated/sdk_io.dart') ||
342 file.path.endsWith('pkg/analyzer/lib/src/generated/visitors.dart') ||
343 file.path.endsWith('pkg/analyzer/test/generated/constant_test.dart') ||
344 file.path.endsWith('pkg/analyzer/test/source/embedder_test.dart')) {
345 return new AnalysisResult(
346 file.path, file.uri, null, file.contentHash, null, []);
347 }
348
349 return _logger.run('Compute analysis result for $file', () { 329 return _logger.run('Compute analysis result for $file', () {
350 _LibraryContext libraryContext = _createLibraryContext(file); 330 _LibraryContext libraryContext = _createLibraryContext(file);
351 AnalysisContext analysisContext = _createAnalysisContext(libraryContext); 331 AnalysisContext analysisContext = _createAnalysisContext(libraryContext);
352 analysisContext.setContents(file.source, file.content); 332 analysisContext.setContents(file.source, file.content);
353 // TODO(scheglov) Add support for parts. 333 // TODO(scheglov) Add support for parts.
354 CompilationUnit resolvedUnit = 334 CompilationUnit resolvedUnit =
355 analysisContext.resolveCompilationUnit2(file.source, file.source); 335 analysisContext.resolveCompilationUnit2(file.source, file.source);
356 List<AnalysisError> errors = analysisContext.computeErrors(file.source); 336 List<AnalysisError> errors = analysisContext.computeErrors(file.source);
357 return new AnalysisResult(file.path, file.uri, file.content, 337 return new AnalysisResult(file.path, file.uri, file.content,
358 file.contentHash, resolvedUnit, errors); 338 file.contentHash, resolvedUnit, errors);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 file.uri.toString(), unlinkedUnit, key); 510 file.uri.toString(), unlinkedUnit, key);
531 List<int> bytes = assembler.assemble().toBuffer(); 511 List<int> bytes = assembler.assemble().toBuffer();
532 _byteStore.put(key, bytes); 512 _byteStore.put(key, bytes);
533 return new PackageBundle.fromBuffer(bytes); 513 return new PackageBundle.fromBuffer(bytes);
534 }); 514 });
535 } 515 }
536 516
537 /** 517 /**
538 * Verify the API signatures for the changed files, and decide which linked 518 * Verify the API signatures for the changed files, and decide which linked
539 * libraries should be invalidated, and files reanalyzed. 519 * libraries should be invalidated, and files reanalyzed.
540 *
541 * TODO(scheglov) I see that adding a local var changes (full) API signature.
542 */ 520 */
543 void _verifyUnlinkedSignatureOfChangedFiles() { 521 void _verifyUnlinkedSignatureOfChangedFiles() {
544 if (_filesToVerifyUnlinkedSignature.isEmpty) { 522 if (_filesToVerifyUnlinkedSignature.isEmpty) {
545 return; 523 return;
546 } 524 }
547 int numOfFiles = _filesToVerifyUnlinkedSignature.length; 525 int numOfFiles = _filesToVerifyUnlinkedSignature.length;
548 _logger.run('Verify API signatures of $numOfFiles files', () { 526 _logger.run('Verify API signatures of $numOfFiles files', () {
549 for (String path in _filesToVerifyUnlinkedSignature) { 527 for (String path in _filesToVerifyUnlinkedSignature) {
550 _File file = _fileForPath(path); 528 _File file = _fileForPath(path);
551 // Get the existing old API signature, maybe null. 529 // Get the existing old API signature, maybe null.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 } 952 }
975 } 953 }
976 for (UnlinkedExportPublic export in unit.publicNamespace.exports) { 954 for (UnlinkedExportPublic export in unit.publicNamespace.exports) {
977 referenced.exported.add(export.uri); 955 referenced.exported.add(export.uri);
978 } 956 }
979 return referenced; 957 return referenced;
980 } 958 }
981 959
982 _ReferencedUris._(); 960 _ReferencedUris._();
983 } 961 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/declaration_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698