Files
sdk/runtime/bin/directory_patch.dart
T
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00

39 lines
1.6 KiB
Dart

// Copyright (c) 2012, 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.
@patch class _Directory {
@patch static _current() native "Directory_Current";
@patch static _setCurrent(path) native "Directory_SetCurrent";
@patch static _createTemp(String path) native "Directory_CreateTemp";
@patch static String _systemTemp() native "Directory_SystemTemp";
@patch static _exists(String path) native "Directory_Exists";
@patch static _create(String path) native "Directory_Create";
@patch static _deleteNative(String path, bool recursive)
native "Directory_Delete";
@patch static _rename(String path, String newPath)
native "Directory_Rename";
@patch static void _fillWithDirectoryListing(
List<FileSystemEntity> list, String path, bool recursive,
bool followLinks)
native "Directory_FillWithDirectoryListing";
}
@patch class _AsyncDirectoryListerOps {
@patch factory _AsyncDirectoryListerOps(int pointer) =>
new _AsyncDirectoryListerOpsImpl(pointer);
}
class _AsyncDirectoryListerOpsImpl extends NativeFieldWrapperClass1
implements _AsyncDirectoryListerOps {
_AsyncDirectoryListerOpsImpl._();
factory _AsyncDirectoryListerOpsImpl(int pointer)
=> new _AsyncDirectoryListerOpsImpl._().._setPointer(pointer);
void _setPointer(int pointer)
native "Directory_SetAsyncDirectoryListerPointer";
int getPointer()
native "Directory_GetAsyncDirectoryListerPointer";
}