From 7b5f8df929fe7eec8df757e0f7de09d9bd456014 Mon Sep 17 00:00:00 2001 From: Tess Strickland Date: Mon, 1 Jun 2026 10:35:58 -0700 Subject: [PATCH] [vm,dyn_modules] Fix the starting file offset for closure functions. For closures generated from both FunctionDeclarations and FunctionExpressions, the starting file offset of the generated closure function should be the file offset of the node itself, not the file offset of the FunctionNode. (This matches the logic in KernelLoader::LoadClosureFunction.) TEST=pkg/vm_service/test/coverage_extension_methods_test Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try Change-Id: I25a0cd0aa6505e122a215237ca6ef7e8edb031af Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507424 Reviewed-by: Alexander Markov Commit-Queue: Tess Strickland --- pkg/dart2bytecode/lib/bytecode_generator.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/dart2bytecode/lib/bytecode_generator.dart b/pkg/dart2bytecode/lib/bytecode_generator.dart index d22f0c99db7..7dcfe40134e 100644 --- a/pkg/dart2bytecode/lib/bytecode_generator.dart +++ b/pkg/dart2bytecode/lib/bytecode_generator.dart @@ -2865,9 +2865,7 @@ class BytecodeGenerator extends RecursiveVisitor { int position = TreeNode.noOffset; int endPosition = TreeNode.noOffset; if (options.emitSourcePositions) { - position = (node is ast.FunctionDeclaration) - ? node.fileOffset - : function.fileOffset; + position = node.fileOffset; endPosition = function.fileEndOffset; if (position != TreeNode.noOffset) { flags |= ClosureDeclaration.hasSourcePositionsFlag;