blob: 7fded7d2df9a2318487126d76ac32809302a4be9 [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> _loaded = {};
// 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) {
_loaded.add(loadId);
return Future.value();
}
bool checkLibraryIsLoadedFromLoadId(int loadId) {
if (_loaded.contains(loadId)) {
return true;
}
throw DeferredLoadIdNotLoadedError();
}
class DeferredLoadIdNotLoadedError extends Error implements NoSuchMethodError {
DeferredLoadIdNotLoadedError();
String toString() {
return 'Deferred loading is not available with dart2wasm standalone';
}
}