Skip to content

Commit

Permalink
Version 2.14.0-206.0.dev
Browse files Browse the repository at this point in the history
Merge commit '4ce805bfa7511f21d740284ae7eea278e8d009b4' into 'dev'
  • Loading branch information
Dart CI committed Jun 13, 2021
2 parents 0a32380 + 4ce805b commit ccdd47f
Show file tree
Hide file tree
Showing 15 changed files with 2,822 additions and 1,860 deletions.
1 change: 1 addition & 0 deletions pkg/analyzer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Deprecated `CompilationUnitElement.types`, use `classes` instead.
* Added `Element.nonSynthetic`, use it to get the element that caused creation
of this element, e.g. the field for a synthetic getter.
* Synthetic getters and setters now use `-1` as `nameOffset`.

## 1.7.0
* Require `meta: ^1.4.0`.
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/analysis/driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import 'package:meta/meta.dart';
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
class AnalysisDriver implements AnalysisDriverGeneric {
/// The version of data format, should be incremented on every format change.
static const int DATA_VERSION = 148;
static const int DATA_VERSION = 150;

/// The number of exception contexts allowed to write. Once this field is
/// zero, we stop writing any new exception contexts in this process.
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4727,7 +4727,7 @@ class ParameterElementImpl_ofImplicitSetter extends ParameterElementImpl {
ParameterElementImpl_ofImplicitSetter(
PropertyAccessorElementImpl_ImplicitSetter setter)
: setter = setter,
super('_${setter.variable.name}', setter.variable.nameOffset) {
super('_${setter.variable.name}', -1) {
enclosingElement = setter;
isSynthetic = true;
parameterKind = ParameterKind.REQUIRED;
Expand Down Expand Up @@ -4886,7 +4886,7 @@ class PropertyAccessorElementImpl extends ExecutableElementImpl
/// associated with the given [variable].
PropertyAccessorElementImpl.forVariable(PropertyInducingElementImpl variable,
{Reference? reference})
: super(variable.name, variable.nameOffset, reference: reference) {
: super(variable.name, -1, reference: reference) {
this.variable = variable;
isAbstract = variable is FieldElementImpl && variable.isAbstract;
isStatic = variable.isStatic;
Expand Down
8 changes: 0 additions & 8 deletions pkg/analyzer/lib/src/summary2/informative_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,6 @@ class InformativeDataApplier {
element as FieldElementImpl;
element.setCodeRange(info.codeOffset, info.codeLength);
element.nameOffset = info.nameOffset;
(element.getter as PropertyAccessorElementImpl?)?.nameOffset =
info.nameOffset;
(element.setter as PropertyAccessorElementImpl?)?.nameOffset =
info.nameOffset;
element.documentationComment = info.documentationComment;

var linkedData = element.linkedData as FieldElementLinkedData;
Expand Down Expand Up @@ -565,10 +561,6 @@ class InformativeDataApplier {
element as TopLevelVariableElementImpl;
element.setCodeRange(info.codeOffset, info.codeLength);
element.nameOffset = info.nameOffset;
(element.getter as PropertyAccessorElementImpl?)?.nameOffset =
info.nameOffset;
(element.setter as PropertyAccessorElementImpl?)?.nameOffset =
info.nameOffset;
element.documentationComment = info.documentationComment;

var linkedData = element.linkedData as TopLevelVariableElementLinkedData;
Expand Down
26 changes: 15 additions & 11 deletions pkg/analyzer/test/src/summary/element_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,6 @@ class _ElementWriter {
expect(element.nonSynthetic, same(element));
}

void _assertNonSyntheticElementSelfOr(Element element, Element ifSynthetic) {
if (element.isSynthetic) {
expect(element.nonSynthetic, same(ifSynthetic));
} else {
expect(element.nonSynthetic, same(element));
}
}

/// Assert that the [accessor] of the [property] is correctly linked to
/// the same enclosing element as the [property].
void _assertSyntheticAccessorEnclosing(
Expand Down Expand Up @@ -398,7 +390,13 @@ class _ElementWriter {

expect(e.isAsynchronous, isFalse);
expect(e.isGenerator, isFalse);
_assertNonSyntheticElementSelfOr(e, e.enclosingElement);

if (e.isSynthetic) {
expect(e.nameOffset, -1);
expect(e.nonSynthetic, same(e.enclosingElement));
} else {
expect(e.nameOffset, isPositive);
}
}

void _writeDocumentation(Element element) {
Expand Down Expand Up @@ -668,7 +666,10 @@ class _ElementWriter {
}
}

if (!e.isSynthetic) {
if (e.isSynthetic) {
expect(e.nameOffset, -1);
} else {
expect(e.nameOffset, isPositive);
_assertNonSyntheticElementSelf(e);
}

Expand Down Expand Up @@ -704,14 +705,17 @@ class _ElementWriter {
DartType type = e.type;
expect(type, isNotNull);

if (!e.isSynthetic) {
if (e.isSynthetic) {
expect(e.nameOffset, -1);
} else {
expect(e.getter, isNotNull);
_assertSyntheticAccessorEnclosing(e, e.getter!);

if (e.setter != null) {
_assertSyntheticAccessorEnclosing(e, e.setter!);
}

expect(e.nameOffset, isPositive);
_assertNonSyntheticElementSelf(e);
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import 'test_strategies.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ResynthesizeAst2Test);
defineReflectiveTests(ApplyCheckElementTextReplacements);
// defineReflectiveTests(ApplyCheckElementTextReplacements);
});
}

Expand Down
Loading

0 comments on commit ccdd47f

Please sign in to comment.