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

Unified Diff: runtime/vm/parser.cc

Issue 489993004: Private names are not exported, not even if the library imports itself (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/import_self_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 39425)
+++ runtime/vm/parser.cc (working copy)
@@ -9553,6 +9553,15 @@
const String& ident) {
TRACE_PARSER("ResolveIdentInPrefixScope");
HANDLESCOPE(I);
+ if (ident.CharAt(0) == '_') {
srdjan 2014/08/21 17:02:21 Should we use Library::kPrivateIdentifierStart?
hausner 2014/08/21 17:06:20 Done.
+ // Private names are not exported by libraries. The name mangling
+ // of private names with a library-specific suffix usually ensures
+ // that _x in library A is not found when looked up from library B.
+ // In the pathological case where a library includes itself with
+ // a prefix, the name mangling would not help in hiding the private
+ // name, so we need to explicitly reject private names here.
+ return NULL;
+ }
Object& obj = Object::Handle(I);
if (prefix.is_loaded()) {
obj = prefix.LookupObject(ident);
« no previous file with comments | « no previous file | tests/language/import_self_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698