OLD | NEW |
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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
(...skipping 5757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5768 library.SetLoadRequested(); | 5768 library.SetLoadRequested(); |
5769 CallLibraryTagHandler(Dart_kImportTag, import_pos, canon_url); | 5769 CallLibraryTagHandler(Dart_kImportTag, import_pos, canon_url); |
5770 } | 5770 } |
5771 | 5771 |
5772 Namespace& ns = Namespace::Handle(Z, | 5772 Namespace& ns = Namespace::Handle(Z, |
5773 Namespace::New(library, show_names, hide_names)); | 5773 Namespace::New(library, show_names, hide_names)); |
5774 if (metadata_pos >= 0) { | 5774 if (metadata_pos >= 0) { |
5775 ns.AddMetadata(metadata_pos, current_class()); | 5775 ns.AddMetadata(metadata_pos, current_class()); |
5776 } | 5776 } |
5777 | 5777 |
| 5778 // Ensure that private dart:_ libraries are only imported into dart: |
| 5779 // libraries, including indirectly through exports. |
| 5780 const String& lib_url = String::Handle(Z, library_.url()); |
| 5781 if (canon_url.StartsWith(Symbols::DartSchemePrivate()) && |
| 5782 !lib_url.StartsWith(Symbols::DartScheme())) { |
| 5783 ReportError(import_pos, "private library is not accessible"); |
| 5784 } |
| 5785 |
5778 if (is_import) { | 5786 if (is_import) { |
5779 // Ensure that private dart:_ libraries are only imported into dart: | |
5780 // libraries. | |
5781 const String& lib_url = String::Handle(Z, library_.url()); | |
5782 if (canon_url.StartsWith(Symbols::DartSchemePrivate()) && | |
5783 !lib_url.StartsWith(Symbols::DartScheme())) { | |
5784 ReportError(import_pos, "private library is not accessible"); | |
5785 } | |
5786 if (prefix.IsNull() || (prefix.Length() == 0)) { | 5787 if (prefix.IsNull() || (prefix.Length() == 0)) { |
5787 ASSERT(!is_deferred_import); | 5788 ASSERT(!is_deferred_import); |
5788 library_.AddImport(ns); | 5789 library_.AddImport(ns); |
5789 } else { | 5790 } else { |
5790 LibraryPrefix& library_prefix = LibraryPrefix::Handle(Z); | 5791 LibraryPrefix& library_prefix = LibraryPrefix::Handle(Z); |
5791 library_prefix = library_.LookupLocalLibraryPrefix(prefix); | 5792 library_prefix = library_.LookupLocalLibraryPrefix(prefix); |
5792 if (!library_prefix.IsNull()) { | 5793 if (!library_prefix.IsNull()) { |
5793 // Check that prefix names of deferred import clauses are | 5794 // Check that prefix names of deferred import clauses are |
5794 // unique. | 5795 // unique. |
5795 if (!is_deferred_import && library_prefix.is_deferred_load()) { | 5796 if (!is_deferred_import && library_prefix.is_deferred_load()) { |
(...skipping 7680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13476 void Parser::SkipQualIdent() { | 13477 void Parser::SkipQualIdent() { |
13477 ASSERT(IsIdentifier()); | 13478 ASSERT(IsIdentifier()); |
13478 ConsumeToken(); | 13479 ConsumeToken(); |
13479 if (CurrentToken() == Token::kPERIOD) { | 13480 if (CurrentToken() == Token::kPERIOD) { |
13480 ConsumeToken(); // Consume the kPERIOD token. | 13481 ConsumeToken(); // Consume the kPERIOD token. |
13481 ExpectIdentifier("identifier expected after '.'"); | 13482 ExpectIdentifier("identifier expected after '.'"); |
13482 } | 13483 } |
13483 } | 13484 } |
13484 | 13485 |
13485 } // namespace dart | 13486 } // namespace dart |
OLD | NEW |