Skip to content

Commit

Permalink
Version 3.6.0-76.0.dev
Browse files Browse the repository at this point in the history
Merge 3761bc2 into dev
  • Loading branch information
Dart CI committed Jul 24, 2024
2 parents e53beb0 + 3761bc2 commit f4f9568
Show file tree
Hide file tree
Showing 11 changed files with 11,683 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,9 @@ Future<List<Fix>> computeFixes(DartFixContext context) async {
/// Registers each mapping of diagnostic -> list-of-producers with
/// [FixProcessor].
void registerBuiltInProducers() {
// This function can be called many times during test runs so these statements
// should not result in duplicate producers (i.e. they should only add to maps
// or sets or otherwise ensure producers that already exist are not added).
FixProcessor.lintMultiProducerMap.addAll(_builtInLintMultiProducers);
FixProcessor.lintProducerMap.addAll(_builtInLintProducers);
FixProcessor.nonLintMultiProducerMap.addAll(_builtInNonLintMultiProducers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class FixProcessor {
/// parsed results.
static final Map<String, List<ProducerGenerator>> parseLintProducerMap = {};

/// A list of generators that are used to create correction producers that
/// A set of generators that are used to create correction producers that
/// produce corrections that ignore diagnostics locally.
static final List<ProducerGenerator> ignoreProducerGenerators = [];
static final Set<ProducerGenerator> ignoreProducerGenerators = {};

final DartFixContext _fixContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import 'package:analyzer/dart/element/type_provider.dart';
import 'package:analyzer/dart/element/type_system.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/task/api/model.dart';
import 'package:pub_semver/pub_semver.dart';

abstract class BindPatternVariableElement2 implements PatternVariableElement2 {}
Expand Down Expand Up @@ -82,7 +81,7 @@ abstract class ConstructorFragment implements ExecutableFragment {
int? get periodOffset;
}

abstract class Element2 implements AnalysisTarget {
abstract class Element2 {
Element2? get baseElement;

List<Element2> get children2;
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4752,7 +4752,7 @@ class LibraryElementImpl extends LibraryOrAugmentationElementImpl

static List<PrefixElementImpl> buildPrefixesFromImports(
List<LibraryImportElementImpl> imports) {
var prefixes = HashSet<PrefixElementImpl>();
var prefixes = <PrefixElementImpl>{};
for (var element in imports) {
var prefix = element.prefix?.element;
if (prefix != null) {
Expand Down
15 changes: 13 additions & 2 deletions pkg/analyzer/lib/src/summary2/library_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1070,15 +1070,26 @@ class LibraryBuilder with MacroApplicationsContainer {
definingUnit.libraryExports = kind.libraryExports.map((state) {
return _buildExport(state);
}).toFixedList();
container.libraryExports = definingUnit.libraryExports;

// TODO(scheglov): Remove when only parts have exports.
container.libraryExports = kind.libraryExports.map((state) {
return _buildExport(state);
}).toFixedList();

definingUnit.libraryImports = kind.libraryImports.map((state) {
return _buildImport(
container: container,
state: state,
);
}).toFixedList();
container.libraryImports = definingUnit.libraryImports;

// TODO(scheglov): Remove when only parts have imports.
container.libraryImports = kind.libraryImports.map((state) {
return _buildImport(
container: container,
state: state,
);
}).toFixedList();

container.augmentationImports = kind.augmentationImports.map((state) {
return _buildAugmentationImport(
Expand Down
37 changes: 34 additions & 3 deletions pkg/analyzer/test/src/summary/element_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class _ElementWriter {
_elementPrinter = elementPrinter;

void writeLibraryElement(LibraryElementImpl e) {
expect(e.enclosingElement, isNull);

_sink.writelnWithIndent('library');
_sink.withIndent(() {
var name = e.name;
Expand Down Expand Up @@ -341,6 +343,7 @@ class _ElementWriter {

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
_writeDocumentation(e);
_writeMetadata(e);
_writeSinceSdkVersion(e);
Expand Down Expand Up @@ -449,6 +452,13 @@ class _ElementWriter {
}
}

void _writeEnclosingElement(ElementImpl e) {
_elementPrinter.writeNamedElement(
'enclosingElement',
e.enclosingElement,
);
}

void _writeExportedReferences(LibraryElementImpl e) {
var exportedReferences = e.exportedReferences.toList();
exportedReferences.sortBy((e) => e.reference.toString());
Expand All @@ -465,14 +475,15 @@ class _ElementWriter {
}
}

void _writeExportElement(LibraryExportElement e) {
void _writeExportElement(LibraryExportElementImpl e) {
e.location;

_sink.writeIndentedLine(() {
_writeDirectiveUri(e.uri);
});

_sink.withIndent(() {
_writeEnclosingElement(e);
_writeMetadata(e);
_writeNamespaceCombinators(e.combinators);
});
Expand All @@ -496,6 +507,7 @@ class _ElementWriter {

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
_writeDocumentation(e);
_writeMetadata(e);
_writeSinceSdkVersion(e);
Expand Down Expand Up @@ -569,6 +581,7 @@ class _ElementWriter {

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
_writeDocumentation(e);
_writeMetadata(e);
_writeSinceSdkVersion(e);
Expand All @@ -584,7 +597,7 @@ class _ElementWriter {
_assertNonSyntheticElementSelf(e);
}

void _writeImportElement(LibraryImportElement e) {
void _writeImportElement(LibraryImportElementImpl e) {
e.location;

_sink.writeIndentedLine(() {
Expand All @@ -594,12 +607,13 @@ class _ElementWriter {
});

_sink.withIndent(() {
_writeEnclosingElement(e);
_writeMetadata(e);
_writeNamespaceCombinators(e.combinators);
});
}

void _writeImportElementPrefix(ImportElementPrefix? prefix) {
void _writeImportElementPrefix(ImportElementPrefixImpl? prefix) {
if (prefix != null) {
_sink.writeIf(prefix is DeferredImportElementPrefix, ' deferred');
_sink.write(' as ');
Expand Down Expand Up @@ -649,6 +663,7 @@ class _ElementWriter {

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
_writeDocumentation(e);
_writeMetadata(e);
_writeSinceSdkVersion(e);
Expand Down Expand Up @@ -745,6 +760,7 @@ class _ElementWriter {
return configuration.withSyntheticDartCoreImport || !import.isSynthetic;
}).toList();
_writeElements('imports', imports, _writeImportElement);
_writeElements('prefixes', e.prefixes, _writePrefixElement);
}

_writeElements('exports', e.libraryExports, _writeExportElement);
Expand Down Expand Up @@ -1047,6 +1063,7 @@ class _ElementWriter {

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
_writeDocumentation(e);
_writeMetadata(e);
_writeSinceSdkVersion(e);
Expand Down Expand Up @@ -1199,6 +1216,17 @@ class _ElementWriter {
});
}

void _writePrefixElement(PrefixElementImpl e) {
_sink.writeIndentedLine(() {
_writeName(e);
});

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
});
}

void _writePropertyAccessorElement(PropertyAccessorElement e) {
e as PropertyAccessorElementImpl;

Expand Down Expand Up @@ -1252,6 +1280,7 @@ class _ElementWriter {

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
_writeDocumentation(e);
_writeMetadata(e);
_writeSinceSdkVersion(e);
Expand Down Expand Up @@ -1321,6 +1350,7 @@ class _ElementWriter {

_sink.withIndent(() {
_writeReference(e);
_writeEnclosingElement(e);
_writeDocumentation(e);
_writeMetadata(e);
_writeSinceSdkVersion(e);
Expand Down Expand Up @@ -1495,6 +1525,7 @@ class _ElementWriter {

void _writeUnitElement(CompilationUnitElementImpl e) {
_writeReference(e);
_writeEnclosingElement(e);

if (configuration.withImports) {
var imports = e.libraryImports.where((import) {
Expand Down
Loading

0 comments on commit f4f9568

Please sign in to comment.