Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1194)

Unified Diff: runtime/lib/weak_property.cc

Issue 10834397: Expose the WeakProperty type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add missing files Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/lib_impl_sources.gypi ('k') | runtime/lib/weak_property.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/weak_property.cc
diff --git a/runtime/lib/weak_property.cc b/runtime/lib/weak_property.cc
new file mode 100644
index 0000000000000000000000000000000000000000..273cef8656fe4d15fea8d6aa68c036038fcf0a9c
--- /dev/null
+++ b/runtime/lib/weak_property.cc
@@ -0,0 +1,36 @@
+// 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.
+
+#include "vm/bootstrap_natives.h"
+
+#include "vm/exceptions.h"
+#include "vm/native_entry.h"
+#include "vm/object.h"
+
+namespace dart {
+
+DEFINE_NATIVE_ENTRY(WeakProperty_new, 2) {
+ GET_NATIVE_ARGUMENT(Instance, key, arguments->At(0));
+ GET_NATIVE_ARGUMENT(Instance, value, arguments->At(1));
+ const WeakProperty& weak_property = WeakProperty::Handle(WeakProperty::New());
+ weak_property.set_key(key);
+ weak_property.set_value(value);
+ arguments->SetReturn(weak_property);
+}
+
+
+DEFINE_NATIVE_ENTRY(WeakProperty_getKey, 1) {
+ GET_NATIVE_ARGUMENT(WeakProperty, weak_property, arguments->At(0));
+ const Object& key = Object::Handle(weak_property.key());
+ arguments->SetReturn(key);
+}
+
+
+DEFINE_NATIVE_ENTRY(WeakProperty_getValue, 1) {
+ GET_NATIVE_ARGUMENT(WeakProperty, weak_property, arguments->At(0));
+ const Object& value = Object::Handle(weak_property.value());
+ arguments->SetReturn(value);
+}
+
+} // namespace dart
« no previous file with comments | « runtime/lib/lib_impl_sources.gypi ('k') | runtime/lib/weak_property.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698