blob: 89aba16e4b13b0f53a02bae162f48eb82961f5d1 [file] [edit]
// Copyright (c) 2026, 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.
final Set<int> _loadedPrefixes = {};
// The standalone target doesn't support loading deferred libraries, dart2wasm
// emits an error when `--enable-deferred-loading` is enabled with this target.
// These methods are still referenced in the compiler, but we can simply make
// them do nothing.
Future<void> loadLibraryFromLoadId(int loadId) {
_loadedPrefixes.add(loadId);
return Future.value();
}
bool checkLibraryIsLoadedFromLoadId(int loadId) {
if (_loadedPrefixes.contains(loadId)) {
return true;
}
throw DeferredLoadIdNotLoadedError();
}
class DeferredLoadIdNotLoadedError extends Error implements NoSuchMethodError {
DeferredLoadIdNotLoadedError();
String toString() {
return 'Deferred loading is not available with dart2wasm standalone';
}
}