| 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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 CheckToken(Token::kAT, "Metadata character '@' expected"); | 962 CheckToken(Token::kAT, "Metadata character '@' expected"); |
| 963 GrowableObjectArray& meta_values = | 963 GrowableObjectArray& meta_values = |
| 964 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); | 964 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); |
| 965 while (CurrentToken() == Token::kAT) { | 965 while (CurrentToken() == Token::kAT) { |
| 966 ConsumeToken(); | 966 ConsumeToken(); |
| 967 intptr_t expr_pos = TokenPos(); | 967 intptr_t expr_pos = TokenPos(); |
| 968 if (!IsIdentifier()) { | 968 if (!IsIdentifier()) { |
| 969 ExpectIdentifier("identifier expected"); | 969 ExpectIdentifier("identifier expected"); |
| 970 } | 970 } |
| 971 // Reject expressions with deferred library prefix eagerly. | 971 // Reject expressions with deferred library prefix eagerly. |
| 972 Object& obj = Object::Handle(Z, | 972 Object& obj = |
| 973 library_.LookupLocalObject(*CurrentLiteral())); | 973 Object::Handle(Z, library_.LookupLocalObject(*CurrentLiteral())); |
| 974 if (!obj.IsNull() && obj.IsLibraryPrefix()) { | 974 if (!obj.IsNull() && obj.IsLibraryPrefix()) { |
| 975 if (LibraryPrefix::Cast(obj).is_deferred_load()) { | 975 if (LibraryPrefix::Cast(obj).is_deferred_load()) { |
| 976 ReportError("Metadata must be compile-time constant"); | 976 ReportError("Metadata must be compile-time constant"); |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 AstNode* expr = NULL; | 979 AstNode* expr = NULL; |
| 980 if ((LookaheadToken(1) == Token::kLPAREN) || | 980 if ((LookaheadToken(1) == Token::kLPAREN) || |
| 981 ((LookaheadToken(1) == Token::kPERIOD) && | 981 ((LookaheadToken(1) == Token::kPERIOD) && |
| 982 (LookaheadToken(3) == Token::kLPAREN)) || | 982 (LookaheadToken(3) == Token::kLPAREN)) || |
| 983 ((LookaheadToken(1) == Token::kPERIOD) && | 983 ((LookaheadToken(1) == Token::kPERIOD) && |
| (...skipping 10786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11770 StaticGetterNode* getter = | 11770 StaticGetterNode* getter = |
| 11771 new(Z) StaticGetterNode(ident_pos, | 11771 new(Z) StaticGetterNode(ident_pos, |
| 11772 /* receiver */ NULL, | 11772 /* receiver */ NULL, |
| 11773 Class::ZoneHandle(Z, func.Owner()), | 11773 Class::ZoneHandle(Z, func.Owner()), |
| 11774 ident); | 11774 ident); |
| 11775 getter->set_owner(library_); | 11775 getter->set_owner(library_); |
| 11776 return getter; | 11776 return getter; |
| 11777 } else { | 11777 } else { |
| 11778 return new(Z) PrimaryNode(ident_pos, Function::ZoneHandle(Z, func.raw())); | 11778 return new(Z) PrimaryNode(ident_pos, Function::ZoneHandle(Z, func.raw())); |
| 11779 } | 11779 } |
| 11780 } else if (obj.IsLibraryPrefix()) { |
| 11781 const LibraryPrefix& prefix = LibraryPrefix::Cast(obj); |
| 11782 ReportError(ident_pos, |
| 11783 "illegal use of library prefix '%s'", |
| 11784 String::Handle(prefix.name()).ToCString()); |
| 11780 } else { | 11785 } else { |
| 11781 ASSERT(obj.IsNull() || obj.IsLibraryPrefix()); | 11786 ASSERT(obj.IsNull()); |
| 11782 } | 11787 } |
| 11783 // Lexically unresolved primary identifiers are referenced by their name. | 11788 // Lexically unresolved primary identifiers are referenced by their name. |
| 11784 return new(Z) PrimaryNode(ident_pos, ident); | 11789 return new(Z) PrimaryNode(ident_pos, ident); |
| 11785 } | 11790 } |
| 11786 | 11791 |
| 11787 | 11792 |
| 11788 // Do a lookup for the identifier in the scope of the specified | 11793 // Do a lookup for the identifier in the scope of the specified |
| 11789 // library prefix. This means trying to resolve it locally in all of the | 11794 // library prefix. This means trying to resolve it locally in all of the |
| 11790 // libraries present in the library prefix. | 11795 // libraries present in the library prefix. |
| 11791 AstNode* Parser::ResolveIdentInPrefixScope(intptr_t ident_pos, | 11796 AstNode* Parser::ResolveIdentInPrefixScope(intptr_t ident_pos, |
| (...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13518 void Parser::SkipQualIdent() { | 13523 void Parser::SkipQualIdent() { |
| 13519 ASSERT(IsIdentifier()); | 13524 ASSERT(IsIdentifier()); |
| 13520 ConsumeToken(); | 13525 ConsumeToken(); |
| 13521 if (CurrentToken() == Token::kPERIOD) { | 13526 if (CurrentToken() == Token::kPERIOD) { |
| 13522 ConsumeToken(); // Consume the kPERIOD token. | 13527 ConsumeToken(); // Consume the kPERIOD token. |
| 13523 ExpectIdentifier("identifier expected after '.'"); | 13528 ExpectIdentifier("identifier expected after '.'"); |
| 13524 } | 13529 } |
| 13525 } | 13530 } |
| 13526 | 13531 |
| 13527 } // namespace dart | 13532 } // namespace dart |
| OLD | NEW |