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

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

Issue 9694024: - Allow string interpolation in constant strings. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 7651 matching lines...) Expand 10 before | Expand all | Expand 10 after
7662 // String interpolation needed. 7662 // String interpolation needed.
7663 bool is_compiletime_const = true; 7663 bool is_compiletime_const = true;
7664 ArrayNode* values = new ArrayNode(token_index_, TypeArguments::ZoneHandle()); 7664 ArrayNode* values = new ArrayNode(token_index_, TypeArguments::ZoneHandle());
7665 while (CurrentToken() == Token::kSTRING) { 7665 while (CurrentToken() == Token::kSTRING) {
7666 values->AddElement(new LiteralNode(token_index_, *CurrentLiteral())); 7666 values->AddElement(new LiteralNode(token_index_, *CurrentLiteral()));
7667 ConsumeToken(); 7667 ConsumeToken();
7668 while ((CurrentToken() == Token::kINTERPOL_VAR) || 7668 while ((CurrentToken() == Token::kINTERPOL_VAR) ||
7669 (CurrentToken() == Token::kINTERPOL_START)) { 7669 (CurrentToken() == Token::kINTERPOL_START)) {
7670 AstNode* expr = NULL; 7670 AstNode* expr = NULL;
7671 const intptr_t expr_pos = token_index_; 7671 const intptr_t expr_pos = token_index_;
7672 // TODO(hausner): Remove the statement below when we allow interpolated
7673 // strings to be compile time constants.
7674 is_compiletime_const = false;
7675 if (CurrentToken() == Token::kINTERPOL_VAR) { 7672 if (CurrentToken() == Token::kINTERPOL_VAR) {
7676 expr = ResolveVarOrField(token_index_, *CurrentLiteral()); 7673 expr = ResolveVarOrField(token_index_, *CurrentLiteral());
7677 ASSERT(!expr->IsPrimaryNode()); 7674 ASSERT(!expr->IsPrimaryNode());
7678 ConsumeToken(); 7675 ConsumeToken();
7679 } else { 7676 } else {
7680 ASSERT(CurrentToken() == Token::kINTERPOL_START); 7677 ASSERT(CurrentToken() == Token::kINTERPOL_START);
7681 ConsumeToken(); 7678 ConsumeToken();
7682 expr = ParseExpr(kAllowConst); 7679 expr = ParseExpr(kAllowConst);
7683 ExpectToken(Token::kINTERPOL_END); 7680 ExpectToken(Token::kINTERPOL_END);
7684 } 7681 }
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
8170 void Parser::SkipQualIdent() { 8167 void Parser::SkipQualIdent() {
8171 ASSERT(IsIdentifier()); 8168 ASSERT(IsIdentifier());
8172 ConsumeToken(); 8169 ConsumeToken();
8173 if (CurrentToken() == Token::kPERIOD) { 8170 if (CurrentToken() == Token::kPERIOD) {
8174 ConsumeToken(); // Consume the kPERIOD token. 8171 ConsumeToken(); // Consume the kPERIOD token.
8175 ExpectIdentifier("identifier expected after '.'"); 8172 ExpectIdentifier("identifier expected after '.'");
8176 } 8173 }
8177 } 8174 }
8178 8175
8179 } // namespace dart 8176 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | tests/language/src/AdjacentConstStringLiteralsTest.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698