| 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 10356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10367 String::Handle(current_class().Name()).ToCString()); | 10367 String::Handle(current_class().Name()).ToCString()); |
| 10368 } | 10368 } |
| 10369 if (current_class().IsMixinApplication()) { | 10369 if (current_class().IsMixinApplication()) { |
| 10370 const Type& mixin_type = Type::Handle(current_class().mixin()); | 10370 const Type& mixin_type = Type::Handle(current_class().mixin()); |
| 10371 if (mixin_type.type_class() == current_function().origin()) { | 10371 if (mixin_type.type_class() == current_function().origin()) { |
| 10372 ErrorMsg("method of mixin class '%s' may not refer to 'super'", | 10372 ErrorMsg("method of mixin class '%s' may not refer to 'super'", |
| 10373 String::Handle(Class::Handle( | 10373 String::Handle(Class::Handle( |
| 10374 current_function().origin()).Name()).ToCString()); | 10374 current_function().origin()).Name()).ToCString()); |
| 10375 } | 10375 } |
| 10376 } | 10376 } |
| 10377 const intptr_t super_pos = TokenPos(); |
| 10377 ConsumeToken(); | 10378 ConsumeToken(); |
| 10378 if (CurrentToken() == Token::kPERIOD) { | 10379 if (CurrentToken() == Token::kPERIOD) { |
| 10379 ConsumeToken(); | 10380 ConsumeToken(); |
| 10380 const intptr_t ident_pos = TokenPos(); | 10381 const intptr_t ident_pos = TokenPos(); |
| 10381 const String& ident = *ExpectIdentifier("identifier expected"); | 10382 const String& ident = *ExpectIdentifier("identifier expected"); |
| 10382 if (CurrentToken() == Token::kLPAREN) { | 10383 if (CurrentToken() == Token::kLPAREN) { |
| 10383 primary = ParseSuperCall(ident); | 10384 primary = ParseSuperCall(ident); |
| 10384 } else { | 10385 } else { |
| 10385 primary = ParseSuperFieldAccess(ident, ident_pos); | 10386 primary = ParseSuperFieldAccess(ident, ident_pos); |
| 10386 } | 10387 } |
| 10387 } else if ((CurrentToken() == Token::kLBRACK) || | 10388 } else if ((CurrentToken() == Token::kLBRACK) || |
| 10388 Token::CanBeOverloaded(CurrentToken()) || | 10389 Token::CanBeOverloaded(CurrentToken()) || |
| 10389 (CurrentToken() == Token::kNE)) { | 10390 (CurrentToken() == Token::kNE)) { |
| 10390 primary = ParseSuperOperator(); | 10391 primary = ParseSuperOperator(); |
| 10391 } else { | 10392 } else { |
| 10392 primary = new PrimaryNode(TokenPos(), Symbols::Super()); | 10393 primary = new PrimaryNode(super_pos, Symbols::Super()); |
| 10393 } | 10394 } |
| 10394 } else { | 10395 } else { |
| 10395 UnexpectedToken(); | 10396 UnexpectedToken(); |
| 10396 } | 10397 } |
| 10397 return primary; | 10398 return primary; |
| 10398 } | 10399 } |
| 10399 | 10400 |
| 10400 | 10401 |
| 10401 // Evaluate expression in expr and return the value. The expression must | 10402 // Evaluate expression in expr and return the value. The expression must |
| 10402 // be a compile time constant. | 10403 // be a compile time constant. |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10753 void Parser::SkipQualIdent() { | 10754 void Parser::SkipQualIdent() { |
| 10754 ASSERT(IsIdentifier()); | 10755 ASSERT(IsIdentifier()); |
| 10755 ConsumeToken(); | 10756 ConsumeToken(); |
| 10756 if (CurrentToken() == Token::kPERIOD) { | 10757 if (CurrentToken() == Token::kPERIOD) { |
| 10757 ConsumeToken(); // Consume the kPERIOD token. | 10758 ConsumeToken(); // Consume the kPERIOD token. |
| 10758 ExpectIdentifier("identifier expected after '.'"); | 10759 ExpectIdentifier("identifier expected after '.'"); |
| 10759 } | 10760 } |
| 10760 } | 10761 } |
| 10761 | 10762 |
| 10762 } // namespace dart | 10763 } // namespace dart |
| OLD | NEW |