Don't use deprecated analyzer elements in dartfuzz.

Change-Id: Ib6a1ddb831854c60604fa57aeac2103443ee8efe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124101
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2019-11-04 22:37:45 +00:00 committed by commit-bot@chromium.org
parent 79dc0cbc47
commit 0804a6f260
2 changed files with 13 additions and 6 deletions

View file

@ -121,7 +121,7 @@ void visitClass(ClassElement classElement) {
constructor.isFactory &&
constructor.name.isNotEmpty) {
addToTable(
typeString(classElement.type),
typeString(classElement.thisType),
'${classElement.name}.${constructor.name}',
protoString(null, constructor.parameters));
}
@ -135,7 +135,7 @@ void visitClass(ClassElement classElement) {
protoString(null, method.parameters));
} else {
addToTable(typeString(method.returnType), method.name,
protoString(classElement.type, method.parameters));
protoString(classElement.thisType, method.parameters));
}
}
}
@ -147,7 +147,7 @@ void visitClass(ClassElement classElement) {
'${classElement.name}.${variable.name}', 'Vv');
} else {
addToTable(typeString(variable.type), variable.name,
'${typeString(classElement.type)}v');
'${typeString(classElement.thisType)}v');
}
}
}

View file

@ -23,6 +23,7 @@ import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'gen_util.dart';
@ -1123,7 +1124,10 @@ Set<InterfaceType> instantiatePTypes(
} else {
return true;
}
ParameterizedType ptx = pType.instantiate([iType]);
ParameterizedType ptx = pType.element.instantiate(
typeArguments: [iType],
nullabilitySuffix: NullabilitySuffix.star,
);
newITypes.add(ptx);
if (iType.typeArguments.length >= 1) {
complexTypes.add(getConstName(ptx.displayName));
@ -1141,7 +1145,10 @@ Set<InterfaceType> instantiatePTypes(
} else {
return true;
}
ParameterizedType ptx = pType.instantiate([iType1, iType2]);
ParameterizedType ptx = pType.element.instantiate(
typeArguments: [iType1, iType2],
nullabilitySuffix: NullabilitySuffix.star,
);
newITypes.add(ptx);
if (iType1.typeArguments.length >= 1 ||
iType2.typeArguments.length >= 1) {
@ -1262,7 +1269,7 @@ visitCompilationUnit(CompilationUnitElement unit, Set<InterfaceType> allTypes) {
// Compute heuristic to decide whether to include the type.
int no = countOperators(classElement);
if (no > operatorCountThreshold) {
allTypes.add(classElement.type);
allTypes.add(classElement.thisType);
}
}
}