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

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

Issue 1308013002: Addressed review comments from previous CLs; adding more Symbols::FromConcat (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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 10015 matching lines...) Expand 10 before | Expand all | Expand 10 after
10026 const String& private_name = String::ZoneHandle(core_lib.PrivateName(member)); 10026 const String& private_name = String::ZoneHandle(core_lib.PrivateName(member));
10027 return private_name; 10027 return private_name;
10028 } 10028 }
10029 10029
10030 10030
10031 RawClass* Library::LookupCoreClass(const String& class_name) { 10031 RawClass* Library::LookupCoreClass(const String& class_name) {
10032 const Library& core_lib = Library::Handle(Library::CoreLibrary()); 10032 const Library& core_lib = Library::Handle(Library::CoreLibrary());
10033 String& name = String::Handle(class_name.raw()); 10033 String& name = String::Handle(class_name.raw());
10034 if (class_name.CharAt(0) == kPrivateIdentifierStart) { 10034 if (class_name.CharAt(0) == kPrivateIdentifierStart) {
10035 // Private identifiers are mangled on a per library basis. 10035 // Private identifiers are mangled on a per library basis.
10036 name = String::Concat(name, String::Handle(core_lib.private_key())); 10036 name = Symbols::FromConcat(name, String::Handle(core_lib.private_key()));
10037 name = Symbols::New(name);
10038 } 10037 }
10039 return core_lib.LookupClass(name); 10038 return core_lib.LookupClass(name);
10040 } 10039 }
10041 10040
10042 10041
10043 // Cannot handle qualified names properly as it only appends private key to 10042 // Cannot handle qualified names properly as it only appends private key to
10044 // the end (e.g. _Alfa.foo -> _Alfa.foo@...). 10043 // the end (e.g. _Alfa.foo -> _Alfa.foo@...).
10045 RawString* Library::PrivateName(const String& name) const { 10044 RawString* Library::PrivateName(const String& name) const {
10046 ASSERT(IsPrivate(name)); 10045 ASSERT(IsPrivate(name));
10047 // ASSERT(strchr(name, '@') == NULL); 10046 // ASSERT(strchr(name, '@') == NULL);
10048 String& str = String::Handle(); 10047 String& str = String::Handle();
10049 str = name.raw(); 10048 str = name.raw();
10050 str = String::Concat(str, String::Handle(this->private_key())); 10049 str = Symbols::FromConcat(str, String::Handle(this->private_key()));
10051 str = Symbols::New(str);
10052 return str.raw(); 10050 return str.raw();
10053 } 10051 }
10054 10052
10055 10053
10056 RawLibrary* Library::GetLibrary(intptr_t index) { 10054 RawLibrary* Library::GetLibrary(intptr_t index) {
10057 Isolate* isolate = Isolate::Current(); 10055 Isolate* isolate = Isolate::Current();
10058 const GrowableObjectArray& libs = 10056 const GrowableObjectArray& libs =
10059 GrowableObjectArray::Handle(isolate->object_store()->libraries()); 10057 GrowableObjectArray::Handle(isolate->object_store()->libraries());
10060 ASSERT(!libs.IsNull()); 10058 ASSERT(!libs.IsNull());
10061 if ((0 <= index) && (index < libs.Length())) { 10059 if ((0 <= index) && (index < libs.Length())) {
(...skipping 4882 matching lines...) Expand 10 before | Expand all | Expand 10 after
14944 bound_name = TypeParameter::Cast(bound).name(); 14942 bound_name = TypeParameter::Cast(bound).name();
14945 } else if (bound.IsType()) { 14943 } else if (bound.IsType()) {
14946 const Class& cls = Class::Handle(Type::Cast(bound).type_class()); 14944 const Class& cls = Class::Handle(Type::Cast(bound).type_class());
14947 bound_name = cls.Name(); 14945 bound_name = cls.Name();
14948 if (Type::Cast(bound).arguments() != TypeArguments::null()) { 14946 if (Type::Cast(bound).arguments() != TypeArguments::null()) {
14949 bound_name = String::Concat(bound_name, Symbols::OptimizedOut()); 14947 bound_name = String::Concat(bound_name, Symbols::OptimizedOut());
14950 } 14948 }
14951 } else { 14949 } else {
14952 bound_name = String::New(Symbols::OptimizedOut()); 14950 bound_name = String::New(Symbols::OptimizedOut());
14953 } 14951 }
14954 type_name = String::Concat(type_name, bound_name); 14952 return Symbols::FromConcat(type_name, bound_name);
14955 return Symbols::New(type_name);
14956 } 14953 }
14957 if (IsTypeParameter()) { 14954 if (IsTypeParameter()) {
14958 return TypeParameter::Cast(*this).name(); 14955 return TypeParameter::Cast(*this).name();
14959 } 14956 }
14960 // If the type is still being finalized, we may be reporting an error about 14957 // If the type is still being finalized, we may be reporting an error about
14961 // a malformed type, so proceed with caution. 14958 // a malformed type, so proceed with caution.
14962 const TypeArguments& args = TypeArguments::Handle(arguments()); 14959 const TypeArguments& args = TypeArguments::Handle(arguments());
14963 const intptr_t num_args = args.IsNull() ? 0 : args.Length(); 14960 const intptr_t num_args = args.IsNull() ? 0 : args.Length();
14964 String& class_name = String::Handle(); 14961 String& class_name = String::Handle();
14965 intptr_t first_type_param_index; 14962 intptr_t first_type_param_index;
(...skipping 6449 matching lines...) Expand 10 before | Expand all | Expand 10 after
21415 return tag_label.ToCString(); 21412 return tag_label.ToCString();
21416 } 21413 }
21417 21414
21418 21415
21419 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21416 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21420 Instance::PrintJSONImpl(stream, ref); 21417 Instance::PrintJSONImpl(stream, ref);
21421 } 21418 }
21422 21419
21423 21420
21424 } // namespace dart 21421 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698