[dart2js] Fix NamedFunction handling in OnlineJavascriptTracer.

Currently we're assigning the step to the underlying function expression rather than to the surrounding NamedFunction. To match the old implementation we should  assign the step to the parent.

Change-Id: I60138e9e78a39e6b26a5e2fa33dbf504cd21fcde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342981
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart
index c67ca87..d9c8dfd 100644
--- a/pkg/compiler/lib/src/io/position_information.dart
+++ b/pkg/compiler/lib/src/io/position_information.dart
@@ -1549,26 +1549,27 @@
   @override
   visitNode(js.Node node, _) {}
 
-  void _handleFunction(js.Node node, js.Node body, int start) {
-    _currentNode.active =
-        _currentNode.active || reader.getSourceInformation(node) != null;
-    Offset entryOffset = getOffsetForNode(_currentNode.statementOffset, start);
-    notifyStep(node, entryOffset, StepKind.FUN_ENTRY);
+  void _handleFunction(_PositionInfoNode node, js.Node body, int start) {
+    _currentNode.active = _currentNode.active ||
+        reader.getSourceInformation(node.astNode) != null;
+    Offset entryOffset = getOffsetForNode(node.statementOffset, start);
+    notifyStep(node.astNode, entryOffset, StepKind.FUN_ENTRY);
 
     visit(body, statementOffset: start);
 
-    _currentNode.addNotifyStep(StepKind.FUN_EXIT);
+    node.addNotifyStep(StepKind.FUN_EXIT);
   }
 
   _handleFunctionExpression(js.FunctionExpression node, int start) {
-    final parentNode = _currentNode.parent!.astNode;
-    js.NamedFunction? namedParent;
+    final parentNode = _currentNode.parent;
+    final parentAstNode = _currentNode.parent?.astNode;
+    _PositionInfoNode functionNode = _currentNode;
     js.Expression? declaration;
-    if (parentNode is js.NamedFunction) {
-      namedParent = parentNode;
-      declaration = parentNode.name;
-    } else if (parentNode is js.FunctionDeclaration) {
-      declaration = parentNode.name;
+    if (parentAstNode is js.NamedFunction) {
+      functionNode = parentNode!;
+      declaration = parentAstNode.name;
+    } else if (parentAstNode is js.FunctionDeclaration) {
+      declaration = parentAstNode.name;
     }
 
     visit(declaration);
@@ -1576,7 +1577,7 @@
       visit(param);
     }
     // For named functions we treat the named parent as the main node.
-    _handleFunction(namedParent ?? node, node.body, start);
+    _handleFunction(functionNode, node.body, start);
   }
 
   @override