| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 6493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6504 Instance::Handle(isolate, Closure::New(*this, context, Heap::kOld)); | 6504 Instance::Handle(isolate, Closure::New(*this, context, Heap::kOld)); |
| 6505 const char* error_str = NULL; | 6505 const char* error_str = NULL; |
| 6506 closure ^= closure.CheckAndCanonicalize(&error_str); | 6506 closure ^= closure.CheckAndCanonicalize(&error_str); |
| 6507 ASSERT(!closure.IsNull()); | 6507 ASSERT(!closure.IsNull()); |
| 6508 set_implicit_static_closure(closure); | 6508 set_implicit_static_closure(closure); |
| 6509 } | 6509 } |
| 6510 return implicit_static_closure(); | 6510 return implicit_static_closure(); |
| 6511 } | 6511 } |
| 6512 | 6512 |
| 6513 | 6513 |
| 6514 RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { |
| 6515 ASSERT(IsImplicitClosureFunction()); |
| 6516 const Class& cls = Class::Handle(signature_class()); |
| 6517 const Context& context = Context::Handle(Context::New(1)); |
| 6518 context.SetAt(0, receiver); |
| 6519 const Instance& result = Instance::Handle(Closure::New(*this, context)); |
| 6520 if (cls.NumTypeArguments() > 0) { |
| 6521 const TypeArguments& type_arguments = |
| 6522 TypeArguments::Handle(receiver.GetTypeArguments()); |
| 6523 result.SetTypeArguments(type_arguments); |
| 6524 } |
| 6525 return result.raw(); |
| 6526 } |
| 6527 |
| 6528 |
| 6514 RawString* Function::BuildSignature(bool instantiate, | 6529 RawString* Function::BuildSignature(bool instantiate, |
| 6515 NameVisibility name_visibility, | 6530 NameVisibility name_visibility, |
| 6516 const TypeArguments& instantiator) const { | 6531 const TypeArguments& instantiator) const { |
| 6517 const GrowableObjectArray& pieces = | 6532 const GrowableObjectArray& pieces = |
| 6518 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 6533 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 6519 String& name = String::Handle(); | 6534 String& name = String::Handle(); |
| 6520 if (!instantiate && !is_static() && (name_visibility == kInternalName)) { | 6535 if (!instantiate && !is_static() && (name_visibility == kInternalName)) { |
| 6521 // Prefix the signature with its signature class and type parameters, if any | 6536 // Prefix the signature with its signature class and type parameters, if any |
| 6522 // (e.g. "Map<K, V>(K) => bool"). In case of a function type alias, the | 6537 // (e.g. "Map<K, V>(K) => bool"). In case of a function type alias, the |
| 6523 // signature class name is the alias name. | 6538 // signature class name is the alias name. |
| (...skipping 14634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21158 return tag_label.ToCString(); | 21173 return tag_label.ToCString(); |
| 21159 } | 21174 } |
| 21160 | 21175 |
| 21161 | 21176 |
| 21162 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21177 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21163 Instance::PrintJSONImpl(stream, ref); | 21178 Instance::PrintJSONImpl(stream, ref); |
| 21164 } | 21179 } |
| 21165 | 21180 |
| 21166 | 21181 |
| 21167 } // namespace dart | 21182 } // namespace dart |
| OLD | NEW |