Files
sdk/runtime/lib/lib_prefix.dart
T
hausner@google.com ed24226376 Support deferred library prefix syntax
First step towards deferred library support:
- Parse the “deferred as” import clause.
- Implement p.loadLibrary() which returns a future that
  completes when the library is loaded.
- Treat type annotations of deferred types as malformed.
- Throw NoSuchMethodError when calling functions from
  unloaded libraries.
- Libraries are still read synchronously, but items in the
  library won’t be visible through the deferred prefix until
  the future returned by loadLibrary() completes.

Review URL: https://codereview.chromium.org//208323015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34481 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-27 21:20:47 +00:00

25 lines
655 B
Dart

// Copyright (c) 2014, 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.
import "dart:async";
import "dart:isolate";
// This type corresponds to the VM-internal class LibraryPrefix.
class _LibraryPrefix {
_load() native "LibraryPrefix_load";
loadLibrary() {
var completer = new Completer<bool>();
var port = new RawReceivePort();
port.handler = (_) {
this._load();
completer.complete(true);
port.close();
};
port.sendPort.send(1);
return completer.future;
}
}