1// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "vm/bootstrap_natives.h"
6
7#include "vm/exceptions.h"
8#include "vm/native_entry.h"
9#include "vm/object.h"
10
11namespace dart {
12
13DEFINE_NATIVE_ENTRY(WeakProperty_new, 0, 2) {
14 GET_NON_NULL_NATIVE_ARGUMENT(Instance, key, arguments->NativeArgAt(0));
15 GET_NON_NULL_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(1));
16 const WeakProperty& weak_property = WeakProperty::Handle(WeakProperty::New());
17 weak_property.set_key(key);
18 weak_property.set_value(value);
19 return weak_property.raw();
20}
21
22DEFINE_NATIVE_ENTRY(WeakProperty_getKey, 0, 1) {
23 GET_NON_NULL_NATIVE_ARGUMENT(WeakProperty, weak_property,
24 arguments->NativeArgAt(0));
25 return weak_property.key();
26}
27
28DEFINE_NATIVE_ENTRY(WeakProperty_getValue, 0, 1) {
29 GET_NON_NULL_NATIVE_ARGUMENT(WeakProperty, weak_property,
30 arguments->NativeArgAt(0));
31 return weak_property.value();
32}
33
34DEFINE_NATIVE_ENTRY(WeakProperty_setValue, 0, 2) {
35 GET_NON_NULL_NATIVE_ARGUMENT(WeakProperty, weak_property,
36 arguments->NativeArgAt(0));
37 GET_NON_NULL_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(1));
38 weak_property.set_value(value);
39 return Object::null();
40}
41
42} // namespace dart
43