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

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

Issue 24631003: Add proper API for creating private symbols wrt a library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // The trailing . on the default constructor name is dropped: 231 // The trailing . on the default constructor name is dropped:
232 // 232 //
233 // List. -> List 233 // List. -> List
234 // 234 //
235 // And so forth: 235 // And so forth:
236 // 236 //
237 // get:foo@6be832b -> foo 237 // get:foo@6be832b -> foo
238 // _MyClass@6b3832b. -> _MyClass 238 // _MyClass@6b3832b. -> _MyClass
239 // _MyClass@6b3832b.named -> _MyClass.named 239 // _MyClass@6b3832b.named -> _MyClass.named
240 // 240 //
241 static RawString* IdentifierPrettyName(const String& name) { 241 RawString* String::IdentifierPrettyName(const String& name) {
242 if (name.Equals(Symbols::TopLevel())) { 242 if (name.Equals(Symbols::TopLevel())) {
243 // Name of invisible top-level class. 243 // Name of invisible top-level class.
244 return Symbols::Empty().raw(); 244 return Symbols::Empty().raw();
245 } 245 }
246 246
247 // First remove all private name mangling. 247 // First remove all private name mangling.
248 String& unmangled_name = String::Handle(Symbols::Empty().raw()); 248 String& unmangled_name = String::Handle(Symbols::Empty().raw());
249 String& segment = String::Handle(); 249 String& segment = String::Handle();
250 intptr_t start_pos = 0; 250 intptr_t start_pos = 0;
251 for (intptr_t i = 0; i < name.Length(); i++) { 251 for (intptr_t i = 0; i < name.Length(); i++) {
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 return Symbols::Float32x4List().raw(); 1478 return Symbols::Float32x4List().raw();
1479 case kTypedDataFloat32ArrayCid: 1479 case kTypedDataFloat32ArrayCid:
1480 case kExternalTypedDataFloat32ArrayCid: 1480 case kExternalTypedDataFloat32ArrayCid:
1481 return Symbols::Float32List().raw(); 1481 return Symbols::Float32List().raw();
1482 case kTypedDataFloat64ArrayCid: 1482 case kTypedDataFloat64ArrayCid:
1483 case kExternalTypedDataFloat64ArrayCid: 1483 case kExternalTypedDataFloat64ArrayCid:
1484 return Symbols::Float64List().raw(); 1484 return Symbols::Float64List().raw();
1485 default: 1485 default:
1486 if (!IsSignatureClass()) { 1486 if (!IsSignatureClass()) {
1487 const String& name = String::Handle(Name()); 1487 const String& name = String::Handle(Name());
1488 return IdentifierPrettyName(name); 1488 return String::IdentifierPrettyName(name);
1489 } else { 1489 } else {
1490 return Name(); 1490 return Name();
1491 } 1491 }
1492 } 1492 }
1493 UNREACHABLE(); 1493 UNREACHABLE();
1494 } 1494 }
1495 1495
1496 1496
1497 RawType* Class::SignatureType() const { 1497 RawType* Class::SignatureType() const {
1498 ASSERT(IsSignatureClass()); 1498 ASSERT(IsSignatureClass());
(...skipping 3544 matching lines...) Expand 10 before | Expand all | Expand 10 after
5043 } 5043 }
5044 5044
5045 5045
5046 bool Function::HasOptimizedCode() const { 5046 bool Function::HasOptimizedCode() const {
5047 return HasCode() && Code::Handle(raw_ptr()->code_).is_optimized(); 5047 return HasCode() && Code::Handle(raw_ptr()->code_).is_optimized();
5048 } 5048 }
5049 5049
5050 5050
5051 RawString* Function::UserVisibleName() const { 5051 RawString* Function::UserVisibleName() const {
5052 const String& str = String::Handle(name()); 5052 const String& str = String::Handle(name());
5053 return IdentifierPrettyName(str); 5053 return String::IdentifierPrettyName(str);
5054 } 5054 }
5055 5055
5056 5056
5057 RawString* Function::QualifiedUserVisibleName() const { 5057 RawString* Function::QualifiedUserVisibleName() const {
5058 String& tmp = String::Handle(); 5058 String& tmp = String::Handle();
5059 const Class& cls = Class::Handle(Owner()); 5059 const Class& cls = Class::Handle(Owner());
5060 5060
5061 if (IsClosureFunction()) { 5061 if (IsClosureFunction()) {
5062 if (IsLocalFunction() && !IsImplicitClosureFunction()) { 5062 if (IsLocalFunction() && !IsImplicitClosureFunction()) {
5063 const Function& parent = Function::Handle(parent_function()); 5063 const Function& parent = Function::Handle(parent_function());
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 clone.set_dependent_code(Object::null_array()); 5460 clone.set_dependent_code(Object::null_array());
5461 if (!clone.is_static()) { 5461 if (!clone.is_static()) {
5462 clone.SetOffset(0); 5462 clone.SetOffset(0);
5463 } 5463 }
5464 return clone.raw(); 5464 return clone.raw();
5465 } 5465 }
5466 5466
5467 5467
5468 RawString* Field::UserVisibleName() const { 5468 RawString* Field::UserVisibleName() const {
5469 const String& str = String::Handle(name()); 5469 const String& str = String::Handle(name());
5470 return IdentifierPrettyName(str); 5470 return String::IdentifierPrettyName(str);
5471 } 5471 }
5472 5472
5473 5473
5474 intptr_t Field::guarded_list_length() const { 5474 intptr_t Field::guarded_list_length() const {
5475 return Smi::Value(raw_ptr()->guarded_list_length_); 5475 return Smi::Value(raw_ptr()->guarded_list_length_);
5476 } 5476 }
5477 5477
5478 5478
5479 void Field::set_guarded_list_length(intptr_t list_length) const { 5479 void Field::set_guarded_list_length(intptr_t list_length) const {
5480 raw_ptr()->guarded_list_length_ = Smi::New(list_length); 5480 raw_ptr()->guarded_list_length_ = Smi::New(list_length);
(...skipping 9684 matching lines...) Expand 10 before | Expand all | Expand 10 after
15165 return "_MirrorReference"; 15165 return "_MirrorReference";
15166 } 15166 }
15167 15167
15168 15168
15169 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15169 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15170 JSONObject jsobj(stream); 15170 JSONObject jsobj(stream);
15171 } 15171 }
15172 15172
15173 15173
15174 } // namespace dart 15174 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/resolver.h » ('j') | sdk/lib/mirrors/mirrors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698