Index: runtime/vm/parser.cc |
=================================================================== |
--- runtime/vm/parser.cc (revision 45190) |
+++ runtime/vm/parser.cc (working copy) |
@@ -38,6 +38,7 @@ |
namespace dart { |
DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); |
+DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); |
DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); |
DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); |
@@ -9564,6 +9565,10 @@ |
if (target == NULL) { |
ReportError(jump_pos, "label '%s' not found", target_name.ToCString()); |
} |
+ } else if (FLAG_enable_debug_break && (CurrentToken() == Token::kSTRING)) { |
+ 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
|
+ ConsumeToken(); |
+ return new(Z) StopNode(jump_pos, message); |
} else { |
target = current_block_->scope->LookupInnermostLabel(jump_kind); |
if (target == NULL) { |
@@ -9825,7 +9830,9 @@ |
ExpectToken(Token::kRBRACE); |
} else if (token == Token::kBREAK) { |
statement = ParseJump(label_name); |
- AddNodeForFinallyInlining(statement); |
+ if ((statement != NULL) && !statement->IsStopNode()) { |
+ AddNodeForFinallyInlining(statement); |
+ } |
ExpectSemicolon(); |
} else if (token == Token::kCONTINUE) { |
statement = ParseJump(label_name); |