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

Side by Side Diff: vm/parser.cc

Issue 12220027: - Add handling of private dart:_ libraries. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 10 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 | « vm/object.cc ('k') | vm/symbols.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/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 4237 matching lines...) Expand 10 before | Expand all | Expand 10 after
4248 // library we create an empty library to import. 4248 // library we create an empty library to import.
4249 library = Library::LookupLibrary(canon_url); 4249 library = Library::LookupLibrary(canon_url);
4250 if (library.IsNull()) { 4250 if (library.IsNull()) {
4251 library = Library::New(canon_url); 4251 library = Library::New(canon_url);
4252 library.Register(); 4252 library.Register();
4253 } 4253 }
4254 } 4254 }
4255 const Namespace& ns = 4255 const Namespace& ns =
4256 Namespace::Handle(Namespace::New(library, show_names, hide_names)); 4256 Namespace::Handle(Namespace::New(library, show_names, hide_names));
4257 if (is_import) { 4257 if (is_import) {
4258 // Ensure that private dart:_ libraries are only imported into dart:
4259 // libraries.
4260 const String& lib_url = String::Handle(library_.url());
4261 if (canon_url.StartsWith(Symbols::DartSchemePrivate()) &&
4262 !lib_url.StartsWith(Symbols::DartScheme())) {
4263 ErrorMsg(import_pos, "private library is not accessible");
4264 }
4258 if (prefix.IsNull() || (prefix.Length() == 0)) { 4265 if (prefix.IsNull() || (prefix.Length() == 0)) {
4259 library_.AddImport(ns); 4266 library_.AddImport(ns);
4260 } else { 4267 } else {
4261 LibraryPrefix& library_prefix = LibraryPrefix::Handle(); 4268 LibraryPrefix& library_prefix = LibraryPrefix::Handle();
4262 library_prefix = library_.LookupLocalLibraryPrefix(prefix); 4269 library_prefix = library_.LookupLocalLibraryPrefix(prefix);
4263 if (!library_prefix.IsNull()) { 4270 if (!library_prefix.IsNull()) {
4264 library_prefix.AddImport(ns); 4271 library_prefix.AddImport(ns);
4265 } else { 4272 } else {
4266 library_prefix = LibraryPrefix::New(prefix, ns); 4273 library_prefix = LibraryPrefix::New(prefix, ns);
4267 library_.AddObject(library_prefix, prefix); 4274 library_.AddObject(library_prefix, prefix);
(...skipping 5484 matching lines...) Expand 10 before | Expand all | Expand 10 after
9752 void Parser::SkipQualIdent() { 9759 void Parser::SkipQualIdent() {
9753 ASSERT(IsIdentifier()); 9760 ASSERT(IsIdentifier());
9754 ConsumeToken(); 9761 ConsumeToken();
9755 if (CurrentToken() == Token::kPERIOD) { 9762 if (CurrentToken() == Token::kPERIOD) {
9756 ConsumeToken(); // Consume the kPERIOD token. 9763 ConsumeToken(); // Consume the kPERIOD token.
9757 ExpectIdentifier("identifier expected after '.'"); 9764 ExpectIdentifier("identifier expected after '.'");
9758 } 9765 }
9759 } 9766 }
9760 9767
9761 } // namespace dart 9768 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698