From 1bdbafff49df3be889e8f169399620cd2052c302 Mon Sep 17 00:00:00 2001 From: Tess Strickland Date: Fri, 7 Jul 2023 11:36:59 +0000 Subject: [PATCH] [pkg/vm_snapshot_analysis] Allow old 'patched_class_' field. While in more recent SDK versions the 'patched_class_' field has been replaced with 'wrapped_class_', this package can still be used with the earlier SDK versions if we fall back to checking it. Issue: https://github.com/flutter/flutter/issues/130009 Change-Id: Ifb1250393b72e58bbdc0764c7e2ce96269e659ea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312802 Commit-Queue: Tess Strickland Reviewed-by: Martin Kustermann --- pkg/vm_snapshot_analysis/CHANGELOG.md | 5 +++++ pkg/vm_snapshot_analysis/lib/v8_profile.dart | 5 ++++- pkg/vm_snapshot_analysis/pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/vm_snapshot_analysis/CHANGELOG.md b/pkg/vm_snapshot_analysis/CHANGELOG.md index c9349713a36..5f15e032f3f 100644 --- a/pkg/vm_snapshot_analysis/CHANGELOG.md +++ b/pkg/vm_snapshot_analysis/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.7.6 + +- Allow the old `'patched_class_'` field for `PatchClass` until we change the + SDK lower bound for this package to a version that does not have it. + ## 0.7.5 - Fix for flutter/flutter#130009 where an attempt to lookup the owner info diff --git a/pkg/vm_snapshot_analysis/lib/v8_profile.dart b/pkg/vm_snapshot_analysis/lib/v8_profile.dart index 54837be0114..6bcf9029ec4 100644 --- a/pkg/vm_snapshot_analysis/lib/v8_profile.dart +++ b/pkg/vm_snapshot_analysis/lib/v8_profile.dart @@ -440,7 +440,10 @@ class _ProgramInfoBuilder { type: NodeType.functionNode); case 'PatchClass': - return getInfoNodeFor(node['wrapped_class_']!); + // Allow the old patched_class_ field if the wrapped_class_ field does + //not exist. + final wrappedClass = node['wrapped_class_'] ?? node['patched_class_']!; + return getInfoNodeFor(wrappedClass); case 'Class': // Default to root node. Some builtin classes (void, dynamic) don't have diff --git a/pkg/vm_snapshot_analysis/pubspec.yaml b/pkg/vm_snapshot_analysis/pubspec.yaml index b5ca72c7632..6365f3788ac 100644 --- a/pkg/vm_snapshot_analysis/pubspec.yaml +++ b/pkg/vm_snapshot_analysis/pubspec.yaml @@ -1,5 +1,5 @@ name: vm_snapshot_analysis -version: 0.7.5 +version: 0.7.6 description: Utilities for analysing AOT snapshot size. repository: https://github.com/dart-lang/sdk/tree/main/pkg/vm_snapshot_analysis