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

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

Issue 2554113003: Implement 'Import Library' Quick Fix for project libraries using TopLevelDeclarationInSource. (Closed)
Patch Set: Created 4 years 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) 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:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement; 10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement;
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 if (filesToCheck.isEmpty) { 1461 if (filesToCheck.isEmpty) {
1462 completer.complete(libraryDeclarations); 1462 completer.complete(libraryDeclarations);
1463 return true; 1463 return true;
1464 } 1464 }
1465 1465
1466 // Check the next file. 1466 // Check the next file.
1467 String path = filesToCheck.removeLast(); 1467 String path = filesToCheck.removeLast();
1468 if (checkedFiles.add(path)) { 1468 if (checkedFiles.add(path)) {
1469 FileState file = driver._fsState.getFileForPath(path); 1469 FileState file = driver._fsState.getFileForPath(path);
1470 if (!file.isPart) { 1470 if (!file.isPart) {
1471 TopLevelDeclaration declaration = 1471 bool isExported = false;
1472 file.exportedTopLevelDeclarations[name]; 1472 TopLevelDeclaration declaration = file.topLevelDeclarations[name];
1473 if (declaration == null) {
1474 declaration = file.exportedTopLevelDeclarations[name];
1475 isExported = true;
1476 }
1473 if (declaration != null) { 1477 if (declaration != null) {
1474 libraryDeclarations 1478 libraryDeclarations.add(new TopLevelDeclarationInSource(
1475 .add(new TopLevelDeclarationInSource(file.source, declaration)); 1479 file.source, declaration, isExported));
1476 } 1480 }
1477 } 1481 }
1478 } 1482 }
1479 1483
1480 // We're not done yet. 1484 // We're not done yet.
1481 return false; 1485 return false;
1482 } 1486 }
1483 } 1487 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698