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

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

Issue 189843003: Reapply "Access to imports in the VM's runtime mirrors. Extend test coverage of the source mirrors." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/parser.h » ('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 8929 matching lines...) Expand 10 before | Expand all | Expand 10 after
8940 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); 8940 OS::SNPrint(chars, len, kFormat, prefix.ToCString());
8941 return chars; 8941 return chars;
8942 } 8942 }
8943 8943
8944 8944
8945 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { 8945 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const {
8946 JSONObject jsobj(stream); 8946 JSONObject jsobj(stream);
8947 } 8947 }
8948 8948
8949 8949
8950 void Namespace::set_metadata_field(const Field& value) const {
8951 StorePointer(&raw_ptr()->metadata_field_, value.raw());
8952 }
8953
8954
8955 void Namespace::AddMetadata(intptr_t token_pos, const Class& owner_class) {
8956 ASSERT(Field::Handle(metadata_field()).IsNull());
8957 Field& field = Field::Handle(Field::New(Symbols::TopLevel(),
8958 true, // is_static
8959 false, // is_final
8960 false, // is_const
8961 owner_class,
8962 token_pos));
8963 field.set_type(Type::Handle(Type::DynamicType()));
8964 field.set_value(Array::empty_array());
8965 set_metadata_field(field);
8966 }
8967
8968
8969 RawObject* Namespace::GetMetadata() const {
8970 Field& field = Field::Handle(metadata_field());
8971 if (field.IsNull()) {
8972 // There is no metadata for this object.
8973 return Object::empty_array().raw();
8974 }
8975 Object& metadata = Object::Handle();
8976 metadata = field.value();
8977 if (field.value() == Object::empty_array().raw()) {
8978 metadata = Parser::ParseMetadata(Class::Handle(field.owner()),
8979 field.token_pos());
8980 if (metadata.IsArray()) {
8981 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw());
8982 field.set_value(Array::Cast(metadata));
8983 }
8984 }
8985 return metadata.raw();
8986 }
8987
8988
8950 const char* Namespace::ToCString() const { 8989 const char* Namespace::ToCString() const {
8951 const char* kFormat = "Namespace for library '%s'"; 8990 const char* kFormat = "Namespace for library '%s'";
8952 const Library& lib = Library::Handle(library()); 8991 const Library& lib = Library::Handle(library());
8953 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; 8992 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1;
8954 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 8993 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
8955 OS::SNPrint(chars, len, kFormat, lib.ToCString()); 8994 OS::SNPrint(chars, len, kFormat, lib.ToCString());
8956 return chars; 8995 return chars;
8957 } 8996 }
8958 8997
8959 8998
(...skipping 8550 matching lines...) Expand 10 before | Expand all | Expand 10 after
17510 return "_MirrorReference"; 17549 return "_MirrorReference";
17511 } 17550 }
17512 17551
17513 17552
17514 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 17553 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
17515 Instance::PrintToJSONStream(stream, ref); 17554 Instance::PrintToJSONStream(stream, ref);
17516 } 17555 }
17517 17556
17518 17557
17519 } // namespace dart 17558 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698