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

Unified 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698