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

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

Issue 217543004: VM: Evaluate metadata on a class in the scope of its library not the scope of the class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comments Created 6 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 | 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 8015 matching lines...) Expand 10 before | Expand all | Expand 10 after
8026 cls, 8026 cls,
8027 token_pos)); 8027 token_pos));
8028 field.set_type(Type::Handle(Type::DynamicType())); 8028 field.set_type(Type::Handle(Type::DynamicType()));
8029 field.set_value(Array::empty_array()); 8029 field.set_value(Array::empty_array());
8030 GrowableObjectArray& metadata = 8030 GrowableObjectArray& metadata =
8031 GrowableObjectArray::Handle(this->metadata()); 8031 GrowableObjectArray::Handle(this->metadata());
8032 metadata.Add(field, Heap::kOld); 8032 metadata.Add(field, Heap::kOld);
8033 } 8033 }
8034 8034
8035 8035
8036 void Library::AddClassMetadata(const Class& cls, intptr_t token_pos) const { 8036 void Library::AddClassMetadata(const Class& cls,
8037 AddMetadata(cls, String::Handle(MakeClassMetaName(cls)), token_pos); 8037 const Class& toplevel_class,
8038 intptr_t token_pos) const {
8039 // We use the toplevel class as the owner of a class's metadata field because
8040 // a class's metadata is in scope of the library, not the class.
8041 AddMetadata(toplevel_class,
8042 String::Handle(MakeClassMetaName(cls)),
8043 token_pos);
8038 } 8044 }
8039 8045
8040 8046
8041 void Library::AddFieldMetadata(const Field& field, 8047 void Library::AddFieldMetadata(const Field& field,
8042 intptr_t token_pos) const { 8048 intptr_t token_pos) const {
8043 AddMetadata(Class::Handle(field.origin()), 8049 AddMetadata(Class::Handle(field.origin()),
8044 String::Handle(MakeFieldMetaName(field)), 8050 String::Handle(MakeFieldMetaName(field)),
8045 token_pos); 8051 token_pos);
8046 } 8052 }
8047 8053
(...skipping 10169 matching lines...) Expand 10 before | Expand all | Expand 10 after
18217 return "_MirrorReference"; 18223 return "_MirrorReference";
18218 } 18224 }
18219 18225
18220 18226
18221 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 18227 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
18222 Instance::PrintToJSONStream(stream, ref); 18228 Instance::PrintToJSONStream(stream, ref);
18223 } 18229 }
18224 18230
18225 18231
18226 } // namespace dart 18232 } // 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