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

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

Issue 14012005: Implement rethrow statement (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « runtime/vm/object.cc ('k') | runtime/vm/token.h » ('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 "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 6393 matching lines...) Expand 10 before | Expand all | Expand 10 after
6404 statement = ParseJump(label_name); 6404 statement = ParseJump(label_name);
6405 AddNodeForFinallyInlining(statement); 6405 AddNodeForFinallyInlining(statement);
6406 ExpectSemicolon(); 6406 ExpectSemicolon();
6407 } else if (CurrentToken() == Token::kCONTINUE) { 6407 } else if (CurrentToken() == Token::kCONTINUE) {
6408 statement = ParseJump(label_name); 6408 statement = ParseJump(label_name);
6409 AddNodeForFinallyInlining(statement); 6409 AddNodeForFinallyInlining(statement);
6410 ExpectSemicolon(); 6410 ExpectSemicolon();
6411 } else if (CurrentToken() == Token::kSEMICOLON) { 6411 } else if (CurrentToken() == Token::kSEMICOLON) {
6412 // Empty statement, nothing to do. 6412 // Empty statement, nothing to do.
6413 ConsumeToken(); 6413 ConsumeToken();
6414 } else if ((CurrentToken() == Token::kTHROW) && 6414 } else if ((CurrentToken() == Token::kRETHROW) ||
6415 (LookaheadToken(1) == Token::kSEMICOLON)) { 6415 ((CurrentToken() == Token::kTHROW) &&
6416 (LookaheadToken(1) == Token::kSEMICOLON))) {
6416 // Rethrow of current exception. Throwing of an exception object 6417 // Rethrow of current exception. Throwing of an exception object
6417 // is an expression and is handled in ParseExpr(). 6418 // is an expression and is handled in ParseExpr().
6419 // TODO(hausner): remove support for 'throw;'.
6418 ConsumeToken(); 6420 ConsumeToken();
6419 ExpectSemicolon(); 6421 ExpectSemicolon();
6420 // Check if it is ok to do a rethrow. 6422 // Check if it is ok to do a rethrow.
6421 SourceLabel* label = current_block_->scope->LookupInnermostCatchLabel(); 6423 SourceLabel* label = current_block_->scope->LookupInnermostCatchLabel();
6422 if (label == NULL || 6424 if (label == NULL ||
6423 label->FunctionLevel() != current_block_->scope->function_level()) { 6425 label->FunctionLevel() != current_block_->scope->function_level()) {
6424 ErrorMsg(statement_pos, "rethrow of an exception is not valid here"); 6426 ErrorMsg(statement_pos, "rethrow of an exception is not valid here");
6425 } 6427 }
6426 ASSERT(label->owner() != NULL); 6428 ASSERT(label->owner() != NULL);
6427 LocalScope* scope = label->owner()->parent(); 6429 LocalScope* scope = label->owner()->parent();
(...skipping 3490 matching lines...) Expand 10 before | Expand all | Expand 10 after
9918 void Parser::SkipQualIdent() { 9920 void Parser::SkipQualIdent() {
9919 ASSERT(IsIdentifier()); 9921 ASSERT(IsIdentifier());
9920 ConsumeToken(); 9922 ConsumeToken();
9921 if (CurrentToken() == Token::kPERIOD) { 9923 if (CurrentToken() == Token::kPERIOD) {
9922 ConsumeToken(); // Consume the kPERIOD token. 9924 ConsumeToken(); // Consume the kPERIOD token.
9923 ExpectIdentifier("identifier expected after '.'"); 9925 ExpectIdentifier("identifier expected after '.'");
9924 } 9926 }
9925 } 9927 }
9926 9928
9927 } // namespace dart 9929 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698