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

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

Issue 2823253005: Fix #28740 demangle constructors in stack traces (A.A becomes new A) REDO (Closed)
Patch Set: Fix #28740 demangle constructors in stack traces (A.A becomes new A) REDO Created 3 years, 8 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
« no previous file with comments | « no previous file | runtime/vm/object_test.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/become.h" 10 #include "vm/become.h"
(...skipping 7141 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 ASSERT(!fun.IsNull()); 7152 ASSERT(!fun.IsNull());
7153 if (!fun.IsAsyncGenerator() && !fun.IsAsyncFunction() && 7153 if (!fun.IsAsyncGenerator() && !fun.IsAsyncFunction() &&
7154 !fun.IsSyncGenerator()) { 7154 !fun.IsSyncGenerator()) {
7155 // Parent function is not the generator of an asynchronous body closure, 7155 // Parent function is not the generator of an asynchronous body closure,
7156 // start at |this|. 7156 // start at |this|.
7157 fun = raw(); 7157 fun = raw();
7158 } 7158 }
7159 } 7159 }
7160 // A function's scrubbed name and its user visible name are identical. 7160 // A function's scrubbed name and its user visible name are identical.
7161 String& result = String::Handle(fun.UserVisibleName()); 7161 String& result = String::Handle(fun.UserVisibleName());
7162 if (IsClosureFunction()) { 7162 if (IsClosureFunction() && fun.IsLocalFunction() &&
7163 while (fun.IsLocalFunction() && !fun.IsImplicitClosureFunction()) { 7163 !fun.IsImplicitClosureFunction()) {
7164 fun = fun.parent_function();
7165 if (fun.IsAsyncClosure() || fun.IsSyncGenClosure() ||
7166 fun.IsAsyncGenClosure()) {
7167 // Skip the closure and use the real function name found in
7168 // the parent.
7164 fun = fun.parent_function(); 7169 fun = fun.parent_function();
7165 if (fun.IsAsyncClosure() || fun.IsSyncGenClosure() ||
7166 fun.IsAsyncGenClosure()) {
7167 // Skip the closure and use the real function name found in
7168 // the parent.
7169 fun = fun.parent_function();
7170 }
7171 result = String::Concat(Symbols::Dot(), result, Heap::kOld);
7172 result = String::Concat(String::Handle(fun.UserVisibleName()), result,
7173 Heap::kOld);
7174 } 7170 }
7171 result = String::Concat(Symbols::Dot(), result, Heap::kOld);
7172 result = String::Concat(String::Handle(fun.QualifiedName(name_visibility)),
siva 2017/04/20 00:14:59 Is it necessary to convert the iteration into a re
7173 result, Heap::kOld);
7174
7175 return result.raw();
7175 } 7176 }
7176 const Class& cls = Class::Handle(Owner()); 7177 const Class& cls = Class::Handle(Owner());
7177 if (!cls.IsTopLevel()) { 7178 if (!cls.IsTopLevel()) {
7178 result = String::Concat(Symbols::Dot(), result, Heap::kOld); 7179 if (kind() == RawFunction::kConstructor) {
siva 2017/04/20 00:14:59 I tried your cl and changed this line to if (fun.k
7179 const String& cls_name = String::Handle(name_visibility == kScrubbedName 7180 result = String::Concat(Symbols::ConstructorStacktracePrefix(), result,
7180 ? cls.ScrubbedName() 7181 Heap::kOld);
7181 : cls.UserVisibleName()); 7182 } else {
7182 result = String::Concat(cls_name, result, Heap::kOld); 7183 result = String::Concat(Symbols::Dot(), result, Heap::kOld);
7184 const String& cls_name = String::Handle(name_visibility == kScrubbedName
7185 ? cls.ScrubbedName()
7186 : cls.UserVisibleName());
7187 result = String::Concat(cls_name, result, Heap::kOld);
7188 }
7183 } 7189 }
7184 return result.raw(); 7190 return result.raw();
7185 } 7191 }
7186 7192
7187 7193
7188 RawString* Function::GetSource() const { 7194 RawString* Function::GetSource() const {
7189 if (IsImplicitConstructor() || IsSignatureFunction()) { 7195 if (IsImplicitConstructor() || IsSignatureFunction()) {
7190 // We may need to handle more cases when the restrictions on mixins are 7196 // We may need to handle more cases when the restrictions on mixins are
7191 // relaxed. In particular we might start associating some source with the 7197 // relaxed. In particular we might start associating some source with the
7192 // forwarding constructors when it becomes possible to specify a particular 7198 // forwarding constructors when it becomes possible to specify a particular
(...skipping 15993 matching lines...) Expand 10 before | Expand all | Expand 10 after
23186 return UserTag::null(); 23192 return UserTag::null();
23187 } 23193 }
23188 23194
23189 23195
23190 const char* UserTag::ToCString() const { 23196 const char* UserTag::ToCString() const {
23191 const String& tag_label = String::Handle(label()); 23197 const String& tag_label = String::Handle(label());
23192 return tag_label.ToCString(); 23198 return tag_label.ToCString();
23193 } 23199 }
23194 23200
23195 } // namespace dart 23201 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698