Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(865)

Side by Side Diff: runtime/vm/parser.cc

Issue 12036005: Allow cascades in initializer lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove inadvertently pasted comment. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 ConsumeToken(); 1741 ConsumeToken();
1742 ExpectToken(Token::kPERIOD); 1742 ExpectToken(Token::kPERIOD);
1743 } 1743 }
1744 const String& field_name = *ExpectIdentifier("field name expected"); 1744 const String& field_name = *ExpectIdentifier("field name expected");
1745 ExpectToken(Token::kASSIGN); 1745 ExpectToken(Token::kASSIGN);
1746 1746
1747 const bool saved_mode = SetAllowFunctionLiterals(false); 1747 const bool saved_mode = SetAllowFunctionLiterals(false);
1748 // "this" must not be accessible in initializer expressions. 1748 // "this" must not be accessible in initializer expressions.
1749 receiver->set_invisible(true); 1749 receiver->set_invisible(true);
1750 AstNode* init_expr = ParseConditionalExpr(); 1750 AstNode* init_expr = ParseConditionalExpr();
1751 if (CurrentToken() == Token::kCASCADE) {
1752 init_expr = ParseCascades(init_expr);
1753 }
1751 receiver->set_invisible(false); 1754 receiver->set_invisible(false);
1752 SetAllowFunctionLiterals(saved_mode); 1755 SetAllowFunctionLiterals(saved_mode);
1753 Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name)); 1756 Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name));
1754 if (field.IsNull()) { 1757 if (field.IsNull()) {
1755 ErrorMsg(field_pos, "unresolved reference to instance field '%s'", 1758 ErrorMsg(field_pos, "unresolved reference to instance field '%s'",
1756 field_name.ToCString()); 1759 field_name.ToCString());
1757 } 1760 }
1758 CheckDuplicateFieldInit(field_pos, initialized_fields, &field); 1761 CheckDuplicateFieldInit(field_pos, initialized_fields, &field);
1759 AstNode* instance = new LoadLocalNode(field_pos, receiver); 1762 AstNode* instance = new LoadLocalNode(field_pos, receiver);
1760 return new StoreInstanceFieldNode(field_pos, instance, field, init_expr); 1763 return new StoreInstanceFieldNode(field_pos, instance, field, init_expr);
(...skipping 7948 matching lines...) Expand 10 before | Expand all | Expand 10 after
9709 void Parser::SkipQualIdent() { 9712 void Parser::SkipQualIdent() {
9710 ASSERT(IsIdentifier()); 9713 ASSERT(IsIdentifier());
9711 ConsumeToken(); 9714 ConsumeToken();
9712 if (CurrentToken() == Token::kPERIOD) { 9715 if (CurrentToken() == Token::kPERIOD) {
9713 ConsumeToken(); // Consume the kPERIOD token. 9716 ConsumeToken(); // Consume the kPERIOD token.
9714 ExpectIdentifier("identifier expected after '.'"); 9717 ExpectIdentifier("identifier expected after '.'");
9715 } 9718 }
9716 } 9719 }
9717 9720
9718 } // namespace dart 9721 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698