Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Side by Side Diff: runtime/vm/object.cc

Issue 17904009: Hide parent function name in name of closurized function to user. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/resolver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4608 matching lines...) Expand 10 before | Expand all | Expand 10 after
4619 const String& str = String::Handle(name()); 4619 const String& str = String::Handle(name());
4620 return IdentifierPrettyName(str); 4620 return IdentifierPrettyName(str);
4621 } 4621 }
4622 4622
4623 4623
4624 RawString* Function::QualifiedUserVisibleName() const { 4624 RawString* Function::QualifiedUserVisibleName() const {
4625 String& tmp = String::Handle(); 4625 String& tmp = String::Handle();
4626 const Class& cls = Class::Handle(Owner()); 4626 const Class& cls = Class::Handle(Owner());
4627 4627
4628 if (IsClosureFunction()) { 4628 if (IsClosureFunction()) {
4629 if (IsLocalFunction()) { 4629 if (IsLocalFunction() && !IsImplicitClosureFunction()) {
4630 const Function& parent = Function::Handle(parent_function()); 4630 const Function& parent = Function::Handle(parent_function());
4631 tmp = parent.QualifiedUserVisibleName(); 4631 tmp = parent.QualifiedUserVisibleName();
4632 } else { 4632 } else {
4633 return UserVisibleName(); 4633 return UserVisibleName();
4634 } 4634 }
4635 } else { 4635 } else {
4636 if (cls.IsTopLevel()) { 4636 if (cls.IsTopLevel()) {
4637 return UserVisibleName(); 4637 return UserVisibleName();
4638 } else { 4638 } else {
4639 tmp = cls.UserVisibleName(); 4639 tmp = cls.UserVisibleName();
(...skipping 8642 matching lines...) Expand 10 before | Expand all | Expand 10 after
13282 13282
13283 13283
13284 const char* ExternalTypedData::ToCString() const { 13284 const char* ExternalTypedData::ToCString() const {
13285 return "ExternalTypedData"; 13285 return "ExternalTypedData";
13286 } 13286 }
13287 13287
13288 13288
13289 const char* Closure::ToCString(const Instance& closure) { 13289 const char* Closure::ToCString(const Instance& closure) {
13290 const Function& fun = Function::Handle(Closure::function(closure)); 13290 const Function& fun = Function::Handle(Closure::function(closure));
13291 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); 13291 const bool is_implicit_closure = fun.IsImplicitClosureFunction();
13292 const char* fun_sig = String::Handle(fun.Signature()).ToCString(); 13292 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString();
13293 const char* from = is_implicit_closure ? " from " : ""; 13293 const char* from = is_implicit_closure ? " from " : "";
13294 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; 13294 const char* fun_desc = is_implicit_closure ? fun.ToCString() : "";
13295 const char* format = "Closure: %s%s%s"; 13295 const char* format = "Closure: %s%s%s";
13296 intptr_t len = OS::SNPrint(NULL, 0, format, fun_sig, from, fun_desc) + 1; 13296 intptr_t len = OS::SNPrint(NULL, 0, format, fun_sig, from, fun_desc) + 1;
13297 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 13297 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
13298 OS::SNPrint(chars, len, format, fun_sig, from, fun_desc); 13298 OS::SNPrint(chars, len, format, fun_sig, from, fun_desc);
13299 return chars; 13299 return chars;
13300 } 13300 }
13301 13301
13302 13302
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
13665 space); 13665 space);
13666 return reinterpret_cast<RawWeakProperty*>(raw); 13666 return reinterpret_cast<RawWeakProperty*>(raw);
13667 } 13667 }
13668 13668
13669 13669
13670 const char* WeakProperty::ToCString() const { 13670 const char* WeakProperty::ToCString() const {
13671 return "_WeakProperty"; 13671 return "_WeakProperty";
13672 } 13672 }
13673 13673
13674 } // namespace dart 13674 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698