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

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

Issue 23810003: Make showHide combinators work with getter/setter names (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | « no previous file | tests/language/import_show_lib.dart » ('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 7636 matching lines...) Expand 10 before | Expand all | Expand 10 after
7647 } 7647 }
7648 7648
7649 7649
7650 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { 7650 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const {
7651 stream->OpenObject(); 7651 stream->OpenObject();
7652 stream->CloseObject(); 7652 stream->CloseObject();
7653 } 7653 }
7654 7654
7655 7655
7656 bool Namespace::HidesName(const String& name) const { 7656 bool Namespace::HidesName(const String& name) const {
7657 // Quick check for common case with no combinators.
7658 if (hide_names() == show_names()) {
7659 ASSERT(hide_names() == Array::null());
7660 return false;
7661 }
7662 const String* plain_name = &name;
7663 if (Field::IsGetterName(name)) {
7664 plain_name = &String::Handle(Field::NameFromGetter(name));
7665 } else if (Field::IsSetterName(name)) {
7666 plain_name = &String::Handle(Field::NameFromSetter(name));
7667 }
7657 // Check whether the name is in the list of explicitly hidden names. 7668 // Check whether the name is in the list of explicitly hidden names.
7658 if (hide_names() != Array::null()) { 7669 if (hide_names() != Array::null()) {
7659 const Array& names = Array::Handle(hide_names()); 7670 const Array& names = Array::Handle(hide_names());
7660 String& hidden = String::Handle(); 7671 String& hidden = String::Handle();
7661 intptr_t num_names = names.Length(); 7672 intptr_t num_names = names.Length();
7662 for (intptr_t i = 0; i < num_names; i++) { 7673 for (intptr_t i = 0; i < num_names; i++) {
7663 hidden ^= names.At(i); 7674 hidden ^= names.At(i);
7664 if (name.Equals(hidden)) { 7675 if (plain_name->Equals(hidden)) {
7665 return true; 7676 return true;
7666 } 7677 }
7667 } 7678 }
7668 } 7679 }
7669 // The name is not explicitly hidden. Now check whether it is in the 7680 // The name is not explicitly hidden. Now check whether it is in the
7670 // list of explicitly visible names, if there is one. 7681 // list of explicitly visible names, if there is one.
7671 if (show_names() != Array::null()) { 7682 if (show_names() != Array::null()) {
7672 const Array& names = Array::Handle(show_names()); 7683 const Array& names = Array::Handle(show_names());
7673 String& shown = String::Handle(); 7684 String& shown = String::Handle();
7674 intptr_t num_names = names.Length(); 7685 intptr_t num_names = names.Length();
7675 for (intptr_t i = 0; i < num_names; i++) { 7686 for (intptr_t i = 0; i < num_names; i++) {
7676 shown ^= names.At(i); 7687 shown ^= names.At(i);
7677 if (name.Equals(shown)) { 7688 if (plain_name->Equals(shown)) {
7678 return false; 7689 return false;
7679 } 7690 }
7680 } 7691 }
7681 // There is a list of visible names. The name we're looking for is not 7692 // There is a list of visible names. The name we're looking for is not
7682 // contained in the list, so it is hidden. 7693 // contained in the list, so it is hidden.
7683 return true; 7694 return true;
7684 } 7695 }
7685 // The name is not filtered out. 7696 // The name is not filtered out.
7686 return false; 7697 return false;
7687 } 7698 }
(...skipping 7213 matching lines...) Expand 10 before | Expand all | Expand 10 after
14901 } 14912 }
14902 14913
14903 14914
14904 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14915 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14905 stream->OpenObject(); 14916 stream->OpenObject();
14906 stream->CloseObject(); 14917 stream->CloseObject();
14907 } 14918 }
14908 14919
14909 14920
14910 } // namespace dart 14921 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/import_show_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698