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

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

Issue 1087383002: Add support for debug break in Dart source. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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
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 20 matching lines...) Expand all
31 #include "vm/scopes.h" 31 #include "vm/scopes.h"
32 #include "vm/stack_frame.h" 32 #include "vm/stack_frame.h"
33 #include "vm/symbols.h" 33 #include "vm/symbols.h"
34 #include "vm/tags.h" 34 #include "vm/tags.h"
35 #include "vm/timer.h" 35 #include "vm/timer.h"
36 #include "vm/zone.h" 36 #include "vm/zone.h"
37 37
38 namespace dart { 38 namespace dart {
39 39
40 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); 40 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements.");
41 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\".");
41 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); 42 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks.");
42 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); 43 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
43 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); 44 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
44 DECLARE_FLAG(bool, error_on_bad_type); 45 DECLARE_FLAG(bool, error_on_bad_type);
45 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 46 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
46 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 47 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
47 48
48 static void CheckedModeHandler(bool value) { 49 static void CheckedModeHandler(bool value) {
49 FLAG_enable_asserts = value; 50 FLAG_enable_asserts = value;
50 FLAG_enable_type_checks = value; 51 FLAG_enable_type_checks = value;
(...skipping 9506 matching lines...) Expand 10 before | Expand all | Expand 10 after
9557 if (switch_scope != NULL) { 9558 if (switch_scope != NULL) {
9558 // We found a switch scope. Enter a forward reference to the label. 9559 // We found a switch scope. Enter a forward reference to the label.
9559 target = new(Z) SourceLabel( 9560 target = new(Z) SourceLabel(
9560 TokenPos(), target_name, SourceLabel::kForward); 9561 TokenPos(), target_name, SourceLabel::kForward);
9561 switch_scope->AddLabel(target); 9562 switch_scope->AddLabel(target);
9562 } 9563 }
9563 } 9564 }
9564 if (target == NULL) { 9565 if (target == NULL) {
9565 ReportError(jump_pos, "label '%s' not found", target_name.ToCString()); 9566 ReportError(jump_pos, "label '%s' not found", target_name.ToCString());
9566 } 9567 }
9568 } else if (FLAG_enable_debug_break && (CurrentToken() == Token::kSTRING)) {
9569 const char* message = strdup(CurrentLiteral()->ToCString());
Ivan Posva 2015/04/16 21:44:51 Who is responsible for freeing this memory?
Ivan Posva 2015/04/16 21:47:05 Got the answer for this one: Stop does not do a st
regis 2015/04/16 22:17:04 Yes, the strdup is necessary, since the literal st
9570 ConsumeToken();
9571 return new(Z) StopNode(jump_pos, message);
9567 } else { 9572 } else {
9568 target = current_block_->scope->LookupInnermostLabel(jump_kind); 9573 target = current_block_->scope->LookupInnermostLabel(jump_kind);
9569 if (target == NULL) { 9574 if (target == NULL) {
9570 ReportError(jump_pos, "'%s' is illegal here", Token::Str(jump_kind)); 9575 ReportError(jump_pos, "'%s' is illegal here", Token::Str(jump_kind));
9571 } 9576 }
9572 } 9577 }
9573 ASSERT(target != NULL); 9578 ASSERT(target != NULL);
9574 if (jump_kind == Token::kCONTINUE) { 9579 if (jump_kind == Token::kCONTINUE) {
9575 if (target->kind() == SourceLabel::kSwitch) { 9580 if (target->kind() == SourceLabel::kSwitch) {
9576 ReportError(jump_pos, "'continue' jump to switch statement is illegal"); 9581 ReportError(jump_pos, "'continue' jump to switch statement is illegal");
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
9818 } 9823 }
9819 ConsumeToken(); 9824 ConsumeToken();
9820 ParseStatementSequence(); 9825 ParseStatementSequence();
9821 statement = CloseBlock(); 9826 statement = CloseBlock();
9822 if (label != NULL) { 9827 if (label != NULL) {
9823 statement->AsSequenceNode()->set_label(label); 9828 statement->AsSequenceNode()->set_label(label);
9824 } 9829 }
9825 ExpectToken(Token::kRBRACE); 9830 ExpectToken(Token::kRBRACE);
9826 } else if (token == Token::kBREAK) { 9831 } else if (token == Token::kBREAK) {
9827 statement = ParseJump(label_name); 9832 statement = ParseJump(label_name);
9828 AddNodeForFinallyInlining(statement); 9833 if ((statement != NULL) && !statement->IsStopNode()) {
9834 AddNodeForFinallyInlining(statement);
9835 }
9829 ExpectSemicolon(); 9836 ExpectSemicolon();
9830 } else if (token == Token::kCONTINUE) { 9837 } else if (token == Token::kCONTINUE) {
9831 statement = ParseJump(label_name); 9838 statement = ParseJump(label_name);
9832 AddNodeForFinallyInlining(statement); 9839 AddNodeForFinallyInlining(statement);
9833 ExpectSemicolon(); 9840 ExpectSemicolon();
9834 } else if (token == Token::kSEMICOLON) { 9841 } else if (token == Token::kSEMICOLON) {
9835 // Empty statement, nothing to do. 9842 // Empty statement, nothing to do.
9836 ConsumeToken(); 9843 ConsumeToken();
9837 } else if (token == Token::kRETHROW) { 9844 } else if (token == Token::kRETHROW) {
9838 // Rethrow of current exception. 9845 // Rethrow of current exception.
(...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after
13495 void Parser::SkipQualIdent() { 13502 void Parser::SkipQualIdent() {
13496 ASSERT(IsIdentifier()); 13503 ASSERT(IsIdentifier());
13497 ConsumeToken(); 13504 ConsumeToken();
13498 if (CurrentToken() == Token::kPERIOD) { 13505 if (CurrentToken() == Token::kPERIOD) {
13499 ConsumeToken(); // Consume the kPERIOD token. 13506 ConsumeToken(); // Consume the kPERIOD token.
13500 ExpectIdentifier("identifier expected after '.'"); 13507 ExpectIdentifier("identifier expected after '.'");
13501 } 13508 }
13502 } 13509 }
13503 13510
13504 } // namespace dart 13511 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698