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 11892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11903 ResolveIdentInLocalScope(ident_pos, type_name, NULL)) { | 11903 ResolveIdentInLocalScope(ident_pos, type_name, NULL)) { |
11904 // The type is malformed. Skip over its type arguments. | 11904 // The type is malformed. Skip over its type arguments. |
11905 ParseTypeArguments(ClassFinalizer::kIgnore); | 11905 ParseTypeArguments(ClassFinalizer::kIgnore); |
11906 return ClassFinalizer::NewFinalizedMalformedType( | 11906 return ClassFinalizer::NewFinalizedMalformedType( |
11907 Error::Handle(Z), // No previous error. | 11907 Error::Handle(Z), // No previous error. |
11908 script_, | 11908 script_, |
11909 ident_pos, | 11909 ident_pos, |
11910 "using '%s' in this context is invalid", | 11910 "using '%s' in this context is invalid", |
11911 type_name.ToCString()); | 11911 type_name.ToCString()); |
11912 } | 11912 } |
11913 if (!prefix.IsNull() && prefix.is_deferred_load() && !allow_deferred_type) { | 11913 if (!prefix.IsNull() && prefix.is_deferred_load()) { |
11914 ParseTypeArguments(ClassFinalizer::kIgnore); | 11914 // If deferred prefixes are allowed but it is not yet loaded, |
11915 return ClassFinalizer::NewFinalizedMalformedType( | 11915 // remember that this function depends on the prefix. |
11916 Error::Handle(Z), // No previous error. | 11916 if (allow_deferred_type && !prefix.is_loaded()) { |
11917 script_, | 11917 ASSERT(parsed_function() != NULL); |
11918 ident_pos, | 11918 parsed_function()->AddDeferredPrefix(prefix); |
11919 "using deferred type '%s.%s' is invalid", | 11919 } |
11920 String::Handle(Z, prefix.name()).ToCString(), | 11920 // If the deferred prefixes are not allowed, or if the prefix |
11921 type_name.ToCString()); | 11921 // is not yet loaded, return a malformed type. Otherwise, handle |
| 11922 // resolution below, as needed. |
| 11923 if (!prefix.is_loaded() || !allow_deferred_type) { |
| 11924 ParseTypeArguments(ClassFinalizer::kIgnore); |
| 11925 return ClassFinalizer::NewFinalizedMalformedType( |
| 11926 Error::Handle(Z), // No previous error. |
| 11927 script_, |
| 11928 ident_pos, |
| 11929 !prefix.is_loaded() |
| 11930 ? "deferred type '%s.%s' is not yet loaded" |
| 11931 : "using deferred type '%s.%s' is invalid", |
| 11932 String::Handle(Z, prefix.name()).ToCString(), |
| 11933 type_name.ToCString()); |
| 11934 } |
11922 } | 11935 } |
11923 } | 11936 } |
11924 Object& type_class = Object::Handle(Z); | 11937 Object& type_class = Object::Handle(Z); |
11925 // Leave type_class as null if type finalization mode is kIgnore. | 11938 // Leave type_class as null if type finalization mode is kIgnore. |
11926 if (finalization != ClassFinalizer::kIgnore) { | 11939 if (finalization != ClassFinalizer::kIgnore) { |
11927 type_class = UnresolvedClass::New(prefix, type_name, ident_pos); | 11940 type_class = UnresolvedClass::New(prefix, type_name, ident_pos); |
11928 } | 11941 } |
11929 TypeArguments& type_arguments = TypeArguments::Handle( | 11942 TypeArguments& type_arguments = TypeArguments::Handle( |
11930 Z, ParseTypeArguments(finalization)); | 11943 Z, ParseTypeArguments(finalization)); |
11931 if (finalization == ClassFinalizer::kIgnore) { | 11944 if (finalization == ClassFinalizer::kIgnore) { |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13405 void Parser::SkipQualIdent() { | 13418 void Parser::SkipQualIdent() { |
13406 ASSERT(IsIdentifier()); | 13419 ASSERT(IsIdentifier()); |
13407 ConsumeToken(); | 13420 ConsumeToken(); |
13408 if (CurrentToken() == Token::kPERIOD) { | 13421 if (CurrentToken() == Token::kPERIOD) { |
13409 ConsumeToken(); // Consume the kPERIOD token. | 13422 ConsumeToken(); // Consume the kPERIOD token. |
13410 ExpectIdentifier("identifier expected after '.'"); | 13423 ExpectIdentifier("identifier expected after '.'"); |
13411 } | 13424 } |
13412 } | 13425 } |
13413 | 13426 |
13414 } // namespace dart | 13427 } // namespace dart |
OLD | NEW |