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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 2809523002: Issue 29288. Resynthesize Import/Export/PartElement for every directive. (Closed)
Patch Set: Created 3 years, 8 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 5862 matching lines...) Expand 10 before | Expand all | Expand 10 after
5873 List<UnlinkedExportPublic> unlinkedPublicExports = 5873 List<UnlinkedExportPublic> unlinkedPublicExports =
5874 _unlinkedDefiningUnit.publicNamespace.exports; 5874 _unlinkedDefiningUnit.publicNamespace.exports;
5875 assert( 5875 assert(
5876 _unlinkedDefiningUnit.exports.length == unlinkedPublicExports.length); 5876 _unlinkedDefiningUnit.exports.length == unlinkedPublicExports.length);
5877 int length = unlinkedNonPublicExports.length; 5877 int length = unlinkedNonPublicExports.length;
5878 if (length != 0) { 5878 if (length != 0) {
5879 List<ExportElement> exports = new List<ExportElement>(); 5879 List<ExportElement> exports = new List<ExportElement>();
5880 for (int i = 0; i < length; i++) { 5880 for (int i = 0; i < length; i++) {
5881 UnlinkedExportPublic serializedExportPublic = 5881 UnlinkedExportPublic serializedExportPublic =
5882 unlinkedPublicExports[i]; 5882 unlinkedPublicExports[i];
5883 LibraryElement exportedLibrary = resynthesizerContext 5883 UnlinkedExportNonPublic serializedExportNonPublic =
5884 .buildExportedLibrary(serializedExportPublic.uri); 5884 unlinkedNonPublicExports[i];
5885 if (exportedLibrary != null) { 5885 ExportElementImpl exportElement = new ExportElementImpl.forSerialized(
5886 UnlinkedExportNonPublic serializedExportNonPublic = 5886 serializedExportPublic, serializedExportNonPublic, library);
5887 unlinkedNonPublicExports[i]; 5887 exports.add(exportElement);
5888 ExportElementImpl exportElement =
5889 new ExportElementImpl.forSerialized(
5890 serializedExportPublic, serializedExportNonPublic, library);
5891 exports.add(exportElement);
5892 }
5893 } 5888 }
5894 _exports = exports; 5889 _exports = exports;
5895 } else { 5890 } else {
5896 _exports = const <ExportElement>[]; 5891 _exports = const <ExportElement>[];
5897 } 5892 }
5898 } 5893 }
5899 return _exports ?? const <ExportElement>[]; 5894 return _exports ?? const <ExportElement>[];
5900 } 5895 }
5901 5896
5902 /** 5897 /**
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5963 @override 5958 @override
5964 List<ImportElement> get imports { 5959 List<ImportElement> get imports {
5965 if (_unlinkedDefiningUnit != null && _imports == null) { 5960 if (_unlinkedDefiningUnit != null && _imports == null) {
5966 List<UnlinkedImport> unlinkedImports = _unlinkedDefiningUnit.imports; 5961 List<UnlinkedImport> unlinkedImports = _unlinkedDefiningUnit.imports;
5967 int length = unlinkedImports.length; 5962 int length = unlinkedImports.length;
5968 if (length != 0) { 5963 if (length != 0) {
5969 List<ImportElement> imports = new List<ImportElement>(); 5964 List<ImportElement> imports = new List<ImportElement>();
5970 LinkedLibrary linkedLibrary = resynthesizerContext.linkedLibrary; 5965 LinkedLibrary linkedLibrary = resynthesizerContext.linkedLibrary;
5971 for (int i = 0; i < length; i++) { 5966 for (int i = 0; i < length; i++) {
5972 int dependency = linkedLibrary.importDependencies[i]; 5967 int dependency = linkedLibrary.importDependencies[i];
5973 LibraryElement importedLibrary = 5968 ImportElementImpl importElement = new ImportElementImpl.forSerialized(
5974 resynthesizerContext.buildImportedLibrary(dependency); 5969 unlinkedImports[i], dependency, library);
5975 if (importedLibrary != null) { 5970 imports.add(importElement);
5976 ImportElementImpl importElement =
5977 new ImportElementImpl.forSerialized(
5978 unlinkedImports[i], dependency, library);
5979 imports.add(importElement);
5980 }
5981 } 5971 }
5982 _imports = imports; 5972 _imports = imports;
5983 } else { 5973 } else {
5984 _imports = const <ImportElement>[]; 5974 _imports = const <ImportElement>[];
5985 } 5975 }
5986 } 5976 }
5987 return _imports ?? ImportElement.EMPTY_LIST; 5977 return _imports ?? ImportElement.EMPTY_LIST;
5988 } 5978 }
5989 5979
5990 /** 5980 /**
(...skipping 3103 matching lines...) Expand 10 before | Expand all | Expand 10 after
9094 9084
9095 @override 9085 @override
9096 void visitElement(Element element) { 9086 void visitElement(Element element) {
9097 int offset = element.nameOffset; 9087 int offset = element.nameOffset;
9098 if (offset != -1) { 9088 if (offset != -1) {
9099 map[offset] = element; 9089 map[offset] = element;
9100 } 9090 }
9101 super.visitElement(element); 9091 super.visitElement(element);
9102 } 9092 }
9103 } 9093 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698