[kernel] Get location less in verifier

Change-Id: I644f46819b2c4524f57aa3a37f4e2b754b6f951d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Jens Johansen 2023-08-25 11:38:35 +00:00 committed by Commit Queue
parent ba2642c2a6
commit fc79ba71c6

View file

@ -1351,7 +1351,7 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
assert(treeNodeStack.isNotEmpty);
for (int i = treeNodeStack.length - 1; i >= 0; --i) {
TreeNode node = treeNodeStack[i];
if (withLocation && !_hasLocation(node)) continue;
if (withLocation && !_hasLocation(_getLocation(node), node)) continue;
return node;
}
return null;
@ -1363,8 +1363,8 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
for (int i = treeNodeStack.length - 1; i >= 0; --i) {
TreeNode node = treeNodeStack[i];
if (withLocation && !_hasLocation(node)) continue;
Location? location = _getLocation(node);
if (withLocation && !_hasLocation(location, node)) continue;
if (location != null && location.file == currentLibrary!.fileUri) {
return node;
}
@ -1390,8 +1390,7 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
return null;
}
bool _hasLocation(TreeNode node) {
Location? location = _getLocation(node);
bool _hasLocation(Location? location, TreeNode node) {
return location != null && node.fileOffset != TreeNode.noOffset;
}
@ -1512,10 +1511,9 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
@override
void defaultDartType(DartType node) {
final TreeNode? localContext = this.localContext;
final TreeNode? remoteContext = this.remoteContext;
if (!KnownTypes.isKnown(node)) {
final TreeNode? localContext = this.localContext;
final TreeNode? remoteContext = this.remoteContext;
problem(localContext, "Unexpected appearance of the unknown type.",
origin: remoteContext);
}