[vm,dyn_modules] Fix source reports for enhanced enums with bytecode.

Coverage information for enhanced enums should not include initializer
functions for enum elements or the values field, so skip over these when
the enum is defined in bytecode.

TEST=vm/cc/SourceReport_Coverage_IssueCov386_EnhancedEnums

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try
Change-Id: I1dba3c87fdfcc39762bba5f0c35cfd061ec76371
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504240
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Tess Strickland
2026-05-20 06:04:16 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 84704290ab
commit 58e0b77bd6
+10
View File
@@ -202,6 +202,16 @@ bool SourceReport::ShouldSkipField(const Field& field) {
return true;
}
}
// Static const fields from compiled code will not have an initializer
// function, just an implicit static getter (which is skipped).
// Static const fields in bytecode _do_ have initializer functions,
// though, so skip them to ensure they aren't reported in the coverage
// information so as to match coverage for compile code.
if (field.is_static() && field.is_const()) {
return true;
}
return false;
}