Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0d93a85

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[vm/bytecode] Clean component metadata except bytecode when dropping AST
Change-Id: If0a7894406458b0cb6f4e1c5e4d60a6377b2459b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98044 Commit-Queue: Ryan Macnak <rmacnak@google.com> Auto-Submit: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
1 parent ca2f03c commit 0d93a85

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/vm/lib/bytecode/ast_remover.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ class ASTRemover extends Transformer {
1515

1616
ASTRemover(Component component)
1717
: metadata = component.metadata[new BytecodeMetadataRepository().tag] {
18-
stashes[component] = new _ComponentStash(component.mainMethod);
18+
stashes[component] = new _ComponentStash(component.mainMethod,
19+
new Map<String, MetadataRepository<dynamic>>.from(component.metadata));
1920
component.mainMethod = null;
21+
component.metadata.removeWhere((tag, md) => tag != metadata.tag);
2022
}
2123

2224
@override
@@ -100,6 +102,7 @@ class ASTRemover extends Transformer {
100102
if (node is Component) {
101103
_ComponentStash componentStash = stash as _ComponentStash;
102104
node.mainMethod = componentStash.mainMethod;
105+
node.metadata.addAll(componentStash.metadata);
103106
} else if (node is Library) {
104107
_LibraryStash libraryStash = stash as _LibraryStash;
105108
node.annotations.addAll(libraryStash.annotations);
@@ -172,6 +175,7 @@ class _VariableDeclarationStash extends _Stash {
172175

173176
class _ComponentStash extends _Stash {
174177
final Procedure mainMethod;
178+
final Map<String, MetadataRepository<dynamic>> metadata;
175179

176-
_ComponentStash(this.mainMethod);
180+
_ComponentStash(this.mainMethod, this.metadata);
177181
}

0 commit comments

Comments
 (0)