[dart2js] Fix tests for dart2js_info.

Fixes errors introduced in https://dart-review.googlesource.com/c/sdk/+/246140.

Change-Id: I7d09e58e27bcea138d4945fbda1d45b12bd6f53f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246800
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
diff --git a/pkg/compiler/test/analyses/dart2js_allowed.json b/pkg/compiler/test/analyses/dart2js_allowed.json
index 2d86d0b..4ae46c3 100644
--- a/pkg/compiler/test/analyses/dart2js_allowed.json
+++ b/pkg/compiler/test/analyses/dart2js_allowed.json
@@ -104,11 +104,10 @@
     "Dynamic access of 'index'.": 1
   },
   "pkg/dart2js_info/lib/src/util.dart": {
-    "Dynamic access of 'name'.": 1,
     "Dynamic invocation of '-'.": 1
   },
   "pkg/js_ast/lib/src/template.dart": {
     "Dynamic invocation of '[]'.": 9,
     "Dynamic invocation of 'toStatement'.": 1
   }
-}
\ No newline at end of file
+}
diff --git a/pkg/dart2js_info/lib/src/util.dart b/pkg/dart2js_info/lib/src/util.dart
index f509ea6..48bb5d1 100644
--- a/pkg/dart2js_info/lib/src/util.dart
+++ b/pkg/dart2js_info/lib/src/util.dart
@@ -74,7 +74,7 @@
   final infoPath = <Info>[];
   Info? localInfo = info;
   while (localInfo != null) {
-    infoPath.add(info);
+    infoPath.add(localInfo);
     localInfo = localInfo.parent;
   }
   var sb = StringBuffer();