mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Enable private field promotion in pkg/front_end
Change-Id: I71c8eb0e5783b2309efc2230cc1cc3ce59df4790 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325449 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
This commit is contained in:
parent
a744a03491
commit
f66254a0c5
|
@ -1587,8 +1587,8 @@ class ConstantsTransformer extends RemovingTransformer {
|
|||
}
|
||||
}
|
||||
if (_exhaustivenessDataForTesting != null) {
|
||||
_exhaustivenessDataForTesting!.objectFieldLookup ??= _exhaustivenessCache;
|
||||
_exhaustivenessDataForTesting!.switchResults[replacement] =
|
||||
_exhaustivenessDataForTesting.objectFieldLookup ??= _exhaustivenessCache;
|
||||
_exhaustivenessDataForTesting.switchResults[replacement] =
|
||||
new ExhaustivenessResult(type, cases,
|
||||
patternGuards.map((c) => c.fileOffset).toList(), reportedErrors!);
|
||||
}
|
||||
|
@ -1826,10 +1826,9 @@ class ConstantsTransformer extends RemovingTransformer {
|
|||
// [PatternAssignment]s for effect.
|
||||
if (_exhaustivenessDataForTesting != null) {
|
||||
ExhaustivenessResult? result =
|
||||
_exhaustivenessDataForTesting!.switchResults[expression];
|
||||
_exhaustivenessDataForTesting.switchResults[expression];
|
||||
if (result != null) {
|
||||
_exhaustivenessDataForTesting!.switchResults[expression.body] =
|
||||
result;
|
||||
_exhaustivenessDataForTesting.switchResults[expression.body] = result;
|
||||
}
|
||||
}
|
||||
return expression.body;
|
||||
|
@ -5849,7 +5848,7 @@ class EvaluationEnvironment {
|
|||
bool get isEmpty {
|
||||
// Since we look up variables in enclosing environment, the environment
|
||||
// is not empty if its parent is not empty.
|
||||
if (_parent != null && !_parent!.isEmpty) return false;
|
||||
if (_parent != null && !_parent.isEmpty) return false;
|
||||
return _typeVariables.isEmpty && _variables.isEmpty;
|
||||
}
|
||||
|
||||
|
@ -5897,7 +5896,7 @@ class EvaluationEnvironment {
|
|||
final DartType substitutedType = substitute(type, _typeVariables);
|
||||
if (identical(substitutedType, type) && _parent != null) {
|
||||
// No distinct type created, substitute type in parent.
|
||||
return _parent!.substituteType(type);
|
||||
return _parent.substituteType(type);
|
||||
}
|
||||
return substitutedType;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class ForwardingNode {
|
|||
bool hasValidImplementation = false;
|
||||
if (_superClassMember != null) {
|
||||
superTarget =
|
||||
_superClassMember!.getMember(_combinedMemberSignature.membersBuilder);
|
||||
_superClassMember.getMember(_combinedMemberSignature.membersBuilder);
|
||||
if (superTarget is Procedure &&
|
||||
interfaceMember is Procedure &&
|
||||
(superTarget.function.positionalParameters.length <
|
||||
|
@ -148,7 +148,7 @@ class ForwardingNode {
|
|||
} else {
|
||||
// [superTarget] is a valid implementation for [interfaceMember] so
|
||||
// we need to add concrete forwarding stub of the variances differ.
|
||||
needsSuperImpl = _superClassMember!
|
||||
needsSuperImpl = _superClassMember
|
||||
.getCovariance(_combinedMemberSignature.membersBuilder) !=
|
||||
_combinedMemberSignature.combinedMemberSignatureCovariance;
|
||||
hasValidImplementation = true;
|
||||
|
@ -202,9 +202,8 @@ class ForwardingNode {
|
|||
if (needsNoSuchMethodForwarder) {
|
||||
_createNoSuchMethodForwarder(
|
||||
classBuilder,
|
||||
_noSuchMethodTarget!
|
||||
.getMember(_combinedMemberSignature.membersBuilder)
|
||||
as Procedure,
|
||||
_noSuchMethodTarget.getMember(
|
||||
_combinedMemberSignature.membersBuilder) as Procedure,
|
||||
stub);
|
||||
} else if (needsSuperImpl ||
|
||||
(needMixinStub && _superClassMember == _mixedInMember)) {
|
||||
|
@ -228,9 +227,8 @@ class ForwardingNode {
|
|||
interfaceMember.stubTarget = null;
|
||||
_createNoSuchMethodForwarder(
|
||||
classBuilder,
|
||||
_noSuchMethodTarget!
|
||||
.getMember(_combinedMemberSignature.membersBuilder)
|
||||
as Procedure,
|
||||
_noSuchMethodTarget.getMember(
|
||||
_combinedMemberSignature.membersBuilder) as Procedure,
|
||||
interfaceMember);
|
||||
} else if (needsSuperImpl) {
|
||||
_createForwardingImplIfNeeded(interfaceMember.function!,
|
||||
|
@ -280,7 +278,7 @@ class ForwardingNode {
|
|||
type.typeParameters,
|
||||
function.typeParameters
|
||||
.map((TypeParameter parameter) => new TypeParameterType
|
||||
.withDefaultNullabilityForLibrary(
|
||||
.withDefaultNullabilityForLibrary(
|
||||
parameter, procedure.enclosingLibrary))
|
||||
.toList())
|
||||
.substituteType(type.withoutTypeParameters) as FunctionType;
|
||||
|
|
|
@ -323,8 +323,8 @@ class SynthesizedInterfaceMember extends SynthesizedMember {
|
|||
}
|
||||
if (classBuilder.libraryBuilder is! SourceLibraryBuilder) {
|
||||
if (_canonicalMember != null) {
|
||||
_member = _canonicalMember!.getMember(membersBuilder);
|
||||
_covariance = _canonicalMember!.getCovariance(membersBuilder);
|
||||
_member = _canonicalMember.getMember(membersBuilder);
|
||||
_covariance = _canonicalMember.getCovariance(membersBuilder);
|
||||
} else {
|
||||
_member = declarations.first.getMember(membersBuilder);
|
||||
_covariance = declarations.first.getCovariance(membersBuilder);
|
||||
|
@ -336,7 +336,7 @@ class SynthesizedInterfaceMember extends SynthesizedMember {
|
|||
combinedMemberSignature = new CombinedClassMemberSignature.internal(
|
||||
membersBuilder,
|
||||
classBuilder as SourceClassBuilder,
|
||||
declarations.indexOf(_canonicalMember!),
|
||||
declarations.indexOf(_canonicalMember),
|
||||
declarations,
|
||||
forSetter: isSetter);
|
||||
} else {
|
||||
|
|
|
@ -64,12 +64,12 @@ class Covariance {
|
|||
Covariance.internal(
|
||||
this._positionalParameters, this._namedParameters, this._typeParameters) {
|
||||
assert(_positionalParameters == null ||
|
||||
_positionalParameters!.any((element) => element != 0));
|
||||
_positionalParameters.any((element) => element != 0));
|
||||
assert(_namedParameters == null ||
|
||||
_namedParameters!.values.isNotEmpty &&
|
||||
_namedParameters!.values.every((element) => element != 0));
|
||||
_namedParameters.values.isNotEmpty &&
|
||||
_namedParameters.values.every((element) => element != 0));
|
||||
assert(
|
||||
_typeParameters == null || _typeParameters!.any((element) => element));
|
||||
_typeParameters == null || _typeParameters.any((element) => element));
|
||||
}
|
||||
|
||||
/// The empty covariance.
|
||||
|
@ -214,8 +214,7 @@ class Covariance {
|
|||
positionalParameters = _positionalParameters;
|
||||
} else {
|
||||
positionalParameters = new List<int>.filled(
|
||||
max(_positionalParameters!.length,
|
||||
other._positionalParameters!.length),
|
||||
max(_positionalParameters.length, other._positionalParameters.length),
|
||||
0);
|
||||
for (int index = 0; index < positionalParameters.length; index++) {
|
||||
positionalParameters[index] =
|
||||
|
@ -230,8 +229,8 @@ class Covariance {
|
|||
} else {
|
||||
namedParameters = {};
|
||||
Set<String> names = {
|
||||
..._namedParameters!.keys,
|
||||
...other._namedParameters!.keys
|
||||
..._namedParameters.keys,
|
||||
...other._namedParameters.keys
|
||||
};
|
||||
for (String name in names) {
|
||||
namedParameters[name] =
|
||||
|
@ -245,7 +244,7 @@ class Covariance {
|
|||
typeParameters = _typeParameters;
|
||||
} else {
|
||||
typeParameters = new List<bool>.filled(
|
||||
max(_typeParameters!.length, other._typeParameters!.length), false);
|
||||
max(_typeParameters.length, other._typeParameters.length), false);
|
||||
for (int index = 0; index < typeParameters.length; index++) {
|
||||
typeParameters[index] = isTypeParameterGenericCovariantImpl(index) ||
|
||||
other.isTypeParameterGenericCovariantImpl(index);
|
||||
|
@ -338,7 +337,7 @@ class Covariance {
|
|||
return false;
|
||||
}
|
||||
int positionalParameterCount = max(
|
||||
_positionalParameters!.length, other._positionalParameters!.length);
|
||||
_positionalParameters.length, other._positionalParameters.length);
|
||||
for (int i = 0; i < positionalParameterCount; i++) {
|
||||
if (getPositionalVariance(i) != other.getPositionalVariance(i)) {
|
||||
return false;
|
||||
|
@ -350,8 +349,8 @@ class Covariance {
|
|||
return false;
|
||||
}
|
||||
Set<String> names = {
|
||||
..._namedParameters!.keys,
|
||||
...other._namedParameters!.keys
|
||||
..._namedParameters.keys,
|
||||
...other._namedParameters.keys
|
||||
};
|
||||
for (String name in names) {
|
||||
if (getNamedVariance(name) != other.getNamedVariance(name)) {
|
||||
|
@ -364,7 +363,7 @@ class Covariance {
|
|||
return false;
|
||||
}
|
||||
int typeParameterCount =
|
||||
max(_typeParameters!.length, other._typeParameters!.length);
|
||||
max(_typeParameters.length, other._typeParameters.length);
|
||||
for (int i = 0; i < typeParameterCount; i++) {
|
||||
if (isTypeParameterGenericCovariantImpl(i) !=
|
||||
other.isTypeParameterGenericCovariantImpl(i)) {
|
||||
|
|
|
@ -493,7 +493,7 @@ class DeclaredSourceConstructorBuilder
|
|||
|
||||
if (_constructorTearOff != null) {
|
||||
buildConstructorTearOffProcedure(
|
||||
tearOff: _constructorTearOff!,
|
||||
tearOff: _constructorTearOff,
|
||||
declarationConstructor: constructor,
|
||||
implementationConstructor: _constructor,
|
||||
enclosingDeclarationTypeParameters: classBuilder.cls.typeParameters,
|
||||
|
@ -720,7 +720,7 @@ class DeclaredSourceConstructorBuilder
|
|||
libraryBuilder: libraryBuilder));
|
||||
if (_constructorTearOff != null) {
|
||||
delayedDefaultValueCloners.add(new DelayedDefaultValueCloner(
|
||||
superTarget, _constructorTearOff!, substitution,
|
||||
superTarget, _constructorTearOff, substitution,
|
||||
positionalSuperParameters:
|
||||
positionalSuperParameters ?? const <int>[],
|
||||
namedSuperParameters: namedSuperParameters ?? const <String>[],
|
||||
|
@ -822,12 +822,12 @@ class DeclaredSourceConstructorBuilder
|
|||
@override
|
||||
VariableDeclaration? getTearOffParameter(int index) {
|
||||
if (_constructorTearOff != null) {
|
||||
if (index < _constructorTearOff!.function.positionalParameters.length) {
|
||||
return _constructorTearOff!.function.positionalParameters[index];
|
||||
if (index < _constructorTearOff.function.positionalParameters.length) {
|
||||
return _constructorTearOff.function.positionalParameters[index];
|
||||
} else {
|
||||
index -= _constructorTearOff!.function.positionalParameters.length;
|
||||
if (index < _constructorTearOff!.function.namedParameters.length) {
|
||||
return _constructorTearOff!.function.namedParameters[index];
|
||||
index -= _constructorTearOff.function.positionalParameters.length;
|
||||
if (index < _constructorTearOff.function.namedParameters.length) {
|
||||
return _constructorTearOff.function.namedParameters[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ class DeclaredSourceConstructorBuilder
|
|||
finishConstructorPatch(origin.constructor, _constructor);
|
||||
|
||||
if (_constructorTearOff != null) {
|
||||
finishProcedurePatch(origin._constructorTearOff!, _constructorTearOff!);
|
||||
finishProcedurePatch(origin._constructorTearOff!, _constructorTearOff);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1219,7 +1219,7 @@ class SourceExtensionTypeConstructorBuilder
|
|||
|
||||
if (_constructorTearOff != null) {
|
||||
buildConstructorTearOffProcedure(
|
||||
tearOff: _constructorTearOff!,
|
||||
tearOff: _constructorTearOff,
|
||||
declarationConstructor: _constructor,
|
||||
implementationConstructor: _constructor,
|
||||
libraryBuilder: libraryBuilder);
|
||||
|
|
|
@ -179,7 +179,7 @@ class SourceFactoryBuilder extends SourceFunctionBuilderImpl {
|
|||
|
||||
if (_factoryTearOff != null) {
|
||||
buildConstructorTearOffProcedure(
|
||||
tearOff: _factoryTearOff!,
|
||||
tearOff: _factoryTearOff,
|
||||
declarationConstructor: _procedure,
|
||||
implementationConstructor: _procedureInternal,
|
||||
libraryBuilder: libraryBuilder);
|
||||
|
@ -202,12 +202,12 @@ class SourceFactoryBuilder extends SourceFunctionBuilderImpl {
|
|||
@override
|
||||
VariableDeclaration? getTearOffParameter(int index) {
|
||||
if (_factoryTearOff != null) {
|
||||
if (index < _factoryTearOff!.function.positionalParameters.length) {
|
||||
return _factoryTearOff!.function.positionalParameters[index];
|
||||
if (index < _factoryTearOff.function.positionalParameters.length) {
|
||||
return _factoryTearOff.function.positionalParameters[index];
|
||||
} else {
|
||||
index -= _factoryTearOff!.function.positionalParameters.length;
|
||||
if (index < _factoryTearOff!.function.namedParameters.length) {
|
||||
return _factoryTearOff!.function.namedParameters[index];
|
||||
index -= _factoryTearOff.function.positionalParameters.length;
|
||||
if (index < _factoryTearOff.function.namedParameters.length) {
|
||||
return _factoryTearOff.function.namedParameters[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ class SourceFactoryBuilder extends SourceFunctionBuilderImpl {
|
|||
finishProcedurePatch(origin._procedure, _procedureInternal);
|
||||
|
||||
if (_factoryTearOff != null) {
|
||||
finishProcedurePatch(origin._factoryTearOff!, _factoryTearOff!);
|
||||
finishProcedurePatch(origin._factoryTearOff!, _factoryTearOff);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,9 +409,8 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder {
|
|||
_procedure.function.redirectingFactoryTarget =
|
||||
new RedirectingFactoryTarget.error(message);
|
||||
if (_factoryTearOff != null) {
|
||||
_factoryTearOff!.function.body =
|
||||
createRedirectingFactoryErrorBody(message)
|
||||
..parent = _factoryTearOff!.function;
|
||||
_factoryTearOff.function.body = createRedirectingFactoryErrorBody(message)
|
||||
..parent = _factoryTearOff.function;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -446,7 +445,7 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder {
|
|||
if (_factoryTearOff != null) {
|
||||
_tearOffTypeParameters =
|
||||
buildRedirectingFactoryTearOffProcedureParameters(
|
||||
tearOff: _factoryTearOff!,
|
||||
tearOff: _factoryTearOff,
|
||||
implementationConstructor: _procedureInternal,
|
||||
libraryBuilder: libraryBuilder);
|
||||
}
|
||||
|
@ -543,7 +542,7 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder {
|
|||
typeArguments ??= [];
|
||||
if (_factoryTearOff != null) {
|
||||
delayedDefaultValueCloners.add(buildRedirectingFactoryTearOffBody(
|
||||
_factoryTearOff!,
|
||||
_factoryTearOff,
|
||||
target!,
|
||||
typeArguments,
|
||||
_tearOffTypeParameters!,
|
||||
|
|
|
@ -332,7 +332,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
assert(
|
||||
_packageUri == null ||
|
||||
!importUri.isScheme('package') ||
|
||||
importUri.path.startsWith(_packageUri!.path),
|
||||
importUri.path.startsWith(_packageUri.path),
|
||||
"Foreign package uri '$_packageUri' set on library with import uri "
|
||||
"'${importUri}'.");
|
||||
assert(
|
||||
|
@ -1753,7 +1753,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
List<TypeBuilder>? arguments, int charOffset,
|
||||
{required InstanceTypeVariableAccessState instanceTypeVariableAccess}) {
|
||||
if (_omittedTypeDeclarationBuilders != null) {
|
||||
Builder? builder = _omittedTypeDeclarationBuilders![name];
|
||||
Builder? builder = _omittedTypeDeclarationBuilders[name];
|
||||
if (builder is OmittedTypeDeclarationBuilder) {
|
||||
return new DependentTypeBuilder(builder.omittedTypeBuilder);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
|
|||
// bounds should have been assigned.
|
||||
libraryBuilder.registerPendingNullability(
|
||||
_typeVariables![i].fileUri!,
|
||||
_typeVariables![i].charOffset,
|
||||
_typeVariables[i].charOffset,
|
||||
asTypeArguments[i] as TypeParameterType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -439,7 +439,7 @@ class EffectExpression implements DelayedExpression {
|
|||
identical(this, expression) ||
|
||||
_effect.uses(expression) ||
|
||||
_result.uses(expression) ||
|
||||
(_lateEffect != null && _lateEffect!.uses(expression));
|
||||
(_lateEffect != null && _lateEffect.uses(expression));
|
||||
|
||||
@override
|
||||
bool get isEffectOnly => _result.isEffectOnly;
|
||||
|
@ -452,9 +452,9 @@ class EffectExpression implements DelayedExpression {
|
|||
_result.createStatements(typeEnvironment, results, effects: effects);
|
||||
if (_lateEffect != null) {
|
||||
if (effects != null) {
|
||||
_lateEffect!.createStatements(typeEnvironment, effects);
|
||||
_lateEffect.createStatements(typeEnvironment, effects);
|
||||
} else {
|
||||
_lateEffect!.createStatements(typeEnvironment, results);
|
||||
_lateEffect.createStatements(typeEnvironment, results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ name: front_end
|
|||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ^3.0.0
|
||||
sdk: ^3.2.0-0
|
||||
|
||||
# Use 'any' constraints here; we get our versions from the DEPS file.
|
||||
dependencies:
|
||||
|
|
|
@ -119,7 +119,7 @@ class _OrdinaryVisitor<R> extends VisitorDefault<R?> with VisitorNullMixin<R> {
|
|||
@override
|
||||
R? defaultDartType(DartType node) {
|
||||
if (_defaultDartType != null) {
|
||||
return _defaultDartType!(node);
|
||||
return _defaultDartType(node);
|
||||
} else {
|
||||
return super.defaultDartType(node);
|
||||
}
|
||||
|
@ -140,9 +140,9 @@ class _TypeSchemaVisitor<R> extends VisitorDefault<R?>
|
|||
@override
|
||||
R? defaultDartType(DartType node) {
|
||||
if (node is UnknownType && _visitUnknownType != null) {
|
||||
return _visitUnknownType!(node);
|
||||
return _visitUnknownType(node);
|
||||
} else if (_defaultDartType != null) {
|
||||
return _defaultDartType!(node);
|
||||
return _defaultDartType(node);
|
||||
} else {
|
||||
return super.defaultDartType(node);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class VerifyingAnalysis extends AnalysisVisitor {
|
|||
|
||||
void run({bool verbose = false, bool generate = false}) {
|
||||
if (!generate && _allowedListPath != null) {
|
||||
File file = new File(_allowedListPath!);
|
||||
File file = new File(_allowedListPath);
|
||||
if (file.existsSync()) {
|
||||
try {
|
||||
_expectedJson = json.jsonDecode(file.readAsStringSync());
|
||||
|
@ -47,7 +47,7 @@ class VerifyingAnalysis extends AnalysisVisitor {
|
|||
actualJson[uri] = map;
|
||||
});
|
||||
|
||||
new File(_allowedListPath!).writeAsStringSync(
|
||||
new File(_allowedListPath).writeAsStringSync(
|
||||
new json.JsonEncoder.withIndent(' ').convert(actualJson));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue