| 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/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 5046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5057 } | 5057 } |
| 5058 } | 5058 } |
| 5059 ExpectSemicolon(); | 5059 ExpectSemicolon(); |
| 5060 | 5060 |
| 5061 // Canonicalize library URL. | 5061 // Canonicalize library URL. |
| 5062 const String& canon_url = String::CheckedHandle( | 5062 const String& canon_url = String::CheckedHandle( |
| 5063 CallLibraryTagHandler(Dart_kCanonicalizeUrl, import_pos, url)); | 5063 CallLibraryTagHandler(Dart_kCanonicalizeUrl, import_pos, url)); |
| 5064 // Lookup the library URL. | 5064 // Lookup the library URL. |
| 5065 Library& library = Library::Handle(Library::LookupLibrary(canon_url)); | 5065 Library& library = Library::Handle(Library::LookupLibrary(canon_url)); |
| 5066 if (library.IsNull()) { | 5066 if (library.IsNull()) { |
| 5067 // Create an empty library to mark that we have initiated loading of this |
| 5068 // library. |
| 5069 library = Library::New(canon_url); |
| 5070 library.Register(); |
| 5067 // Call the library tag handler to load the library. | 5071 // Call the library tag handler to load the library. |
| 5068 // TODO(hausner): do not load eagerly if import is deferred. | 5072 // TODO(hausner): do not load eagerly if import is deferred. |
| 5069 CallLibraryTagHandler(Dart_kImportTag, import_pos, canon_url); | 5073 CallLibraryTagHandler(Dart_kImportTag, import_pos, canon_url); |
| 5070 // If the library tag handler succeded without registering the | |
| 5071 // library we create an empty library to import. | |
| 5072 library = Library::LookupLibrary(canon_url); | |
| 5073 if (library.IsNull()) { | |
| 5074 library = Library::New(canon_url); | |
| 5075 library.Register(); | |
| 5076 } | |
| 5077 } | 5074 } |
| 5078 | 5075 |
| 5079 Namespace& ns = | 5076 Namespace& ns = |
| 5080 Namespace::Handle(Namespace::New(library, show_names, hide_names)); | 5077 Namespace::Handle(Namespace::New(library, show_names, hide_names)); |
| 5081 if (metadata_pos >= 0) { | 5078 if (metadata_pos >= 0) { |
| 5082 ns.AddMetadata(metadata_pos, current_class()); | 5079 ns.AddMetadata(metadata_pos, current_class()); |
| 5083 } | 5080 } |
| 5084 | 5081 |
| 5085 if (is_import) { | 5082 if (is_import) { |
| 5086 // Ensure that private dart:_ libraries are only imported into dart: | 5083 // Ensure that private dart:_ libraries are only imported into dart: |
| (...skipping 5867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10954 void Parser::SkipQualIdent() { | 10951 void Parser::SkipQualIdent() { |
| 10955 ASSERT(IsIdentifier()); | 10952 ASSERT(IsIdentifier()); |
| 10956 ConsumeToken(); | 10953 ConsumeToken(); |
| 10957 if (CurrentToken() == Token::kPERIOD) { | 10954 if (CurrentToken() == Token::kPERIOD) { |
| 10958 ConsumeToken(); // Consume the kPERIOD token. | 10955 ConsumeToken(); // Consume the kPERIOD token. |
| 10959 ExpectIdentifier("identifier expected after '.'"); | 10956 ExpectIdentifier("identifier expected after '.'"); |
| 10960 } | 10957 } |
| 10961 } | 10958 } |
| 10962 | 10959 |
| 10963 } // namespace dart | 10960 } // namespace dart |
| OLD | NEW |