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

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

Issue 616673002: throw e is not a compile-time constant expression (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | tests/language/compile_time_constant_r_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 8859 matching lines...) Expand 10 before | Expand all | Expand 10 after
8870 8870
8871 8871
8872 AstNode* Parser::ParseExpr(bool require_compiletime_const, 8872 AstNode* Parser::ParseExpr(bool require_compiletime_const,
8873 bool consume_cascades) { 8873 bool consume_cascades) {
8874 TRACE_PARSER("ParseExpr"); 8874 TRACE_PARSER("ParseExpr");
8875 String* expr_ident = 8875 String* expr_ident =
8876 Token::IsIdentifier(CurrentToken()) ? CurrentLiteral() : NULL; 8876 Token::IsIdentifier(CurrentToken()) ? CurrentLiteral() : NULL;
8877 const intptr_t expr_pos = TokenPos(); 8877 const intptr_t expr_pos = TokenPos();
8878 8878
8879 if (CurrentToken() == Token::kTHROW) { 8879 if (CurrentToken() == Token::kTHROW) {
8880 if (require_compiletime_const) {
8881 ReportError("'throw expr' is not a valid compile-time constant");
8882 }
8880 ConsumeToken(); 8883 ConsumeToken();
8881 if (CurrentToken() == Token::kSEMICOLON) { 8884 if (CurrentToken() == Token::kSEMICOLON) {
8882 ReportError("expression expected after throw"); 8885 ReportError("expression expected after throw");
8883 } 8886 }
8884 AstNode* expr = ParseExpr(require_compiletime_const, consume_cascades); 8887 AstNode* expr = ParseExpr(require_compiletime_const, consume_cascades);
8885 return new(I) ThrowNode(expr_pos, expr, NULL); 8888 return new(I) ThrowNode(expr_pos, expr, NULL);
8886 } 8889 }
8887 AstNode* expr = ParseConditionalExpr(); 8890 AstNode* expr = ParseConditionalExpr();
8888 if (!Token::IsAssignmentOperator(CurrentToken())) { 8891 if (!Token::IsAssignmentOperator(CurrentToken())) {
8889 if ((CurrentToken() == Token::kCASCADE) && consume_cascades) { 8892 if ((CurrentToken() == Token::kCASCADE) && consume_cascades) {
(...skipping 2893 matching lines...) Expand 10 before | Expand all | Expand 10 after
11783 void Parser::SkipQualIdent() { 11786 void Parser::SkipQualIdent() {
11784 ASSERT(IsIdentifier()); 11787 ASSERT(IsIdentifier());
11785 ConsumeToken(); 11788 ConsumeToken();
11786 if (CurrentToken() == Token::kPERIOD) { 11789 if (CurrentToken() == Token::kPERIOD) {
11787 ConsumeToken(); // Consume the kPERIOD token. 11790 ConsumeToken(); // Consume the kPERIOD token.
11788 ExpectIdentifier("identifier expected after '.'"); 11791 ExpectIdentifier("identifier expected after '.'");
11789 } 11792 }
11790 } 11793 }
11791 11794
11792 } // namespace dart 11795 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/compile_time_constant_r_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698