// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. library vm.metadata.binary_cache; import 'package:kernel/ast.dart' show BinarySink, BinarySource, MetadataRepository, Node, TreeNode; class BinaryCacheMetadataRepository extends MetadataRepository> { static const repositoryTag = 'vm.binary_cache'; @override String get tag => repositoryTag; @override final Map> mapping = >{}; @override void writeToBinary(List metadata, Node node, BinarySink sink) { sink.writeByteList(metadata); } @override List readFromBinary(Node node, BinarySource source) { List result = source.readByteList(); _weakMap[node] = result; return result; } static List lookup(Node node) => _weakMap[node]; static void insert(Node node, List metadata) { _weakMap[node] = metadata; } static final _weakMap = new Expando>(); }