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