| 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 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2783 | 2783 |
| 2784 | 2784 |
| 2785 void Parser::ParseConstructorRedirection(const Class& cls, | 2785 void Parser::ParseConstructorRedirection(const Class& cls, |
| 2786 LocalVariable* receiver) { | 2786 LocalVariable* receiver) { |
| 2787 TRACE_PARSER("ParseConstructorRedirection"); | 2787 TRACE_PARSER("ParseConstructorRedirection"); |
| 2788 ExpectToken(Token::kCOLON); | 2788 ExpectToken(Token::kCOLON); |
| 2789 ASSERT(CurrentToken() == Token::kTHIS); | 2789 ASSERT(CurrentToken() == Token::kTHIS); |
| 2790 const intptr_t call_pos = TokenPos(); | 2790 const intptr_t call_pos = TokenPos(); |
| 2791 ConsumeToken(); | 2791 ConsumeToken(); |
| 2792 String& ctor_name = String::Handle(Z, cls.Name()); | 2792 String& ctor_name = String::Handle(Z, cls.Name()); |
| 2793 | 2793 GrowableHandlePtrArray<const String> pieces(Z, 3); |
| 2794 ctor_name = String::Concat(ctor_name, Symbols::Dot()); | 2794 pieces.Add(ctor_name); |
| 2795 pieces.Add(Symbols::Dot()); |
| 2795 if (CurrentToken() == Token::kPERIOD) { | 2796 if (CurrentToken() == Token::kPERIOD) { |
| 2796 ConsumeToken(); | 2797 ConsumeToken(); |
| 2797 ctor_name = String::Concat(ctor_name, | 2798 pieces.Add(*ExpectIdentifier("constructor name expected")); |
| 2798 *ExpectIdentifier("constructor name expected")); | |
| 2799 } | 2799 } |
| 2800 ctor_name = Symbols::FromConcatAll(pieces); |
| 2800 CheckToken(Token::kLPAREN, "parameter list expected"); | 2801 CheckToken(Token::kLPAREN, "parameter list expected"); |
| 2801 | 2802 |
| 2802 ArgumentListNode* arguments = new ArgumentListNode(call_pos); | 2803 ArgumentListNode* arguments = new ArgumentListNode(call_pos); |
| 2803 // 'this' parameter is the first argument to constructor. | 2804 // 'this' parameter is the first argument to constructor. |
| 2804 AstNode* implicit_argument = new LoadLocalNode(call_pos, receiver); | 2805 AstNode* implicit_argument = new LoadLocalNode(call_pos, receiver); |
| 2805 arguments->Add(implicit_argument); | 2806 arguments->Add(implicit_argument); |
| 2806 // Construction phase parameter is second argument. | 2807 // Construction phase parameter is second argument. |
| 2807 LocalVariable* phase_param = LookupPhaseParameter(); | 2808 LocalVariable* phase_param = LookupPhaseParameter(); |
| 2808 ASSERT(phase_param != NULL); | 2809 ASSERT(phase_param != NULL); |
| 2809 AstNode* phase_argument = new LoadLocalNode(call_pos, phase_param); | 2810 AstNode* phase_argument = new LoadLocalNode(call_pos, phase_param); |
| (...skipping 11477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14287 void Parser::SkipQualIdent() { | 14288 void Parser::SkipQualIdent() { |
| 14288 ASSERT(IsIdentifier()); | 14289 ASSERT(IsIdentifier()); |
| 14289 ConsumeToken(); | 14290 ConsumeToken(); |
| 14290 if (CurrentToken() == Token::kPERIOD) { | 14291 if (CurrentToken() == Token::kPERIOD) { |
| 14291 ConsumeToken(); // Consume the kPERIOD token. | 14292 ConsumeToken(); // Consume the kPERIOD token. |
| 14292 ExpectIdentifier("identifier expected after '.'"); | 14293 ExpectIdentifier("identifier expected after '.'"); |
| 14293 } | 14294 } |
| 14294 } | 14295 } |
| 14295 | 14296 |
| 14296 } // namespace dart | 14297 } // namespace dart |
| OLD | NEW |