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 6227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6238 return result.raw(); | 6238 return result.raw(); |
6239 } | 6239 } |
6240 | 6240 |
6241 RawFunction* Function::ImplicitClosureFunction() const { | 6241 RawFunction* Function::ImplicitClosureFunction() const { |
6242 // Return the existing implicit closure function if any. | 6242 // Return the existing implicit closure function if any. |
6243 if (implicit_closure_function() != Function::null()) { | 6243 if (implicit_closure_function() != Function::null()) { |
6244 return implicit_closure_function(); | 6244 return implicit_closure_function(); |
6245 } | 6245 } |
6246 ASSERT(!IsSignatureFunction() && !IsClosureFunction()); | 6246 ASSERT(!IsSignatureFunction() && !IsClosureFunction()); |
6247 // Create closure function. | 6247 // Create closure function. |
6248 const String& closure_name = Symbols::ImplicitClosure(); | 6248 const String& closure_name = String::Handle(name()); |
6249 const Function& closure_function = Function::Handle( | 6249 const Function& closure_function = Function::Handle( |
6250 NewClosureFunction(closure_name, *this, token_pos())); | 6250 NewClosureFunction(closure_name, *this, token_pos())); |
6251 | 6251 |
6252 // Set closure function's context scope. | 6252 // Set closure function's context scope. |
6253 ContextScope& context_scope = ContextScope::Handle(); | 6253 ContextScope& context_scope = ContextScope::Handle(); |
6254 if (is_static()) { | 6254 if (is_static()) { |
6255 context_scope = ContextScope::New(0); | 6255 context_scope = ContextScope::New(0); |
6256 } else { | 6256 } else { |
6257 context_scope = LocalScope::CreateImplicitClosureScope(*this); | 6257 context_scope = LocalScope::CreateImplicitClosureScope(*this); |
6258 } | 6258 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6572 const String& suffix = String::Handle(PrettyName()); | 6572 const String& suffix = String::Handle(PrettyName()); |
6573 return String::Concat(tmp, suffix); | 6573 return String::Concat(tmp, suffix); |
6574 } | 6574 } |
6575 | 6575 |
6576 | 6576 |
6577 RawString* Function::QualifiedUserVisibleName() const { | 6577 RawString* Function::QualifiedUserVisibleName() const { |
6578 String& tmp = String::Handle(); | 6578 String& tmp = String::Handle(); |
6579 const Class& cls = Class::Handle(Owner()); | 6579 const Class& cls = Class::Handle(Owner()); |
6580 | 6580 |
6581 if (IsClosureFunction()) { | 6581 if (IsClosureFunction()) { |
6582 if (IsLocalFunction()) { | 6582 if (IsLocalFunction() && !IsImplicitClosureFunction()) { |
6583 const Function& parent = Function::Handle(parent_function()); | 6583 const Function& parent = Function::Handle(parent_function()); |
6584 tmp = parent.QualifiedUserVisibleName(); | 6584 tmp = parent.QualifiedUserVisibleName(); |
6585 } else { | 6585 } else { |
6586 return UserVisibleName(); | 6586 return UserVisibleName(); |
6587 } | 6587 } |
6588 } else { | 6588 } else { |
6589 if (cls.IsTopLevel()) { | 6589 if (cls.IsTopLevel()) { |
6590 return UserVisibleName(); | 6590 return UserVisibleName(); |
6591 } else { | 6591 } else { |
6592 tmp = cls.UserVisibleName(); | 6592 tmp = cls.UserVisibleName(); |
(...skipping 14132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20725 return tag_label.ToCString(); | 20725 return tag_label.ToCString(); |
20726 } | 20726 } |
20727 | 20727 |
20728 | 20728 |
20729 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20729 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20730 Instance::PrintJSONImpl(stream, ref); | 20730 Instance::PrintJSONImpl(stream, ref); |
20731 } | 20731 } |
20732 | 20732 |
20733 | 20733 |
20734 } // namespace dart | 20734 } // namespace dart |
OLD | NEW |