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/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
10 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 const Closure& receiver = | 69 const Closure& receiver = |
70 Closure::CheckedHandle(zone, arguments->NativeArgAt(0)); | 70 Closure::CheckedHandle(zone, arguments->NativeArgAt(0)); |
71 const Function& func = Function::Handle(receiver.function()); | 71 const Function& func = Function::Handle(receiver.function()); |
72 return func.GetClosureHashCode(); | 72 return func.GetClosureHashCode(); |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 DEFINE_NATIVE_ENTRY(Closure_clone, 1) { | 76 DEFINE_NATIVE_ENTRY(Closure_clone, 1) { |
77 const Closure& receiver = | 77 const Closure& receiver = |
78 Closure::CheckedHandle(zone, arguments->NativeArgAt(0)); | 78 Closure::CheckedHandle(zone, arguments->NativeArgAt(0)); |
| 79 const TypeArguments& instantiator = |
| 80 TypeArguments::Handle(zone, receiver.instantiator()); |
79 const Function& func = Function::Handle(zone, receiver.function()); | 81 const Function& func = Function::Handle(zone, receiver.function()); |
80 const Context& ctx = Context::Handle(zone, receiver.context()); | 82 const Context& ctx = Context::Handle(zone, receiver.context()); |
81 Context& cloned_ctx = | 83 Context& cloned_ctx = |
82 Context::Handle(zone, Context::New(ctx.num_variables())); | 84 Context::Handle(zone, Context::New(ctx.num_variables())); |
83 cloned_ctx.set_parent(Context::Handle(zone, ctx.parent())); | 85 cloned_ctx.set_parent(Context::Handle(zone, ctx.parent())); |
84 Object& inst = Object::Handle(zone); | 86 Object& inst = Object::Handle(zone); |
85 for (int i = 0; i < ctx.num_variables(); i++) { | 87 for (int i = 0; i < ctx.num_variables(); i++) { |
86 inst = ctx.At(i); | 88 inst = ctx.At(i); |
87 cloned_ctx.SetAt(i, inst); | 89 cloned_ctx.SetAt(i, inst); |
88 } | 90 } |
89 return Closure::New(func, cloned_ctx); | 91 return Closure::New(instantiator, func, cloned_ctx); |
90 } | 92 } |
91 | 93 |
92 | 94 |
93 } // namespace dart | 95 } // namespace dart |
OLD | NEW |