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 = | 79 const TypeArguments& instantiator_type_arguments = |
80 TypeArguments::Handle(zone, receiver.instantiator()); | 80 TypeArguments::Handle(zone, receiver.instantiator_type_arguments()); |
81 const Function& func = Function::Handle(zone, receiver.function()); | 81 const TypeArguments& function_type_arguments = |
82 const Context& ctx = Context::Handle(zone, receiver.context()); | 82 TypeArguments::Handle(zone, receiver.function_type_arguments()); |
83 Context& cloned_ctx = | 83 const Function& function = Function::Handle(zone, receiver.function()); |
84 Context::Handle(zone, Context::New(ctx.num_variables())); | 84 const Context& context = Context::Handle(zone, receiver.context()); |
85 cloned_ctx.set_parent(Context::Handle(zone, ctx.parent())); | 85 Context& cloned_context = |
86 Object& inst = Object::Handle(zone); | 86 Context::Handle(zone, Context::New(context.num_variables())); |
87 for (int i = 0; i < ctx.num_variables(); i++) { | 87 cloned_context.set_parent(Context::Handle(zone, context.parent())); |
88 inst = ctx.At(i); | 88 Object& instance = Object::Handle(zone); |
89 cloned_ctx.SetAt(i, inst); | 89 for (int i = 0; i < context.num_variables(); i++) { |
| 90 instance = context.At(i); |
| 91 cloned_context.SetAt(i, instance); |
90 } | 92 } |
91 return Closure::New(instantiator, func, cloned_ctx); | 93 return Closure::New(instantiator_type_arguments, function_type_arguments, |
| 94 function, cloned_context); |
92 } | 95 } |
93 | 96 |
94 | 97 |
95 } // namespace dart | 98 } // namespace dart |
OLD | NEW |