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

Unified Diff: runtime/vm/parser.cc

Issue 9960084: Introduce a flag to disable string operator + (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« runtime/lib/string.cc ('K') | « runtime/vm/bootstrap_natives.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 6383)
+++ runtime/vm/parser.cc (working copy)
@@ -26,6 +26,7 @@
DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors.");
DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings.");
+DEFINE_FLAG(bool, allow_string_plus, true, "Allow + operator on strings.");
static void CheckedModeHandler(bool value) {
FLAG_enable_asserts = value;
@@ -5702,8 +5703,12 @@
if (left_operand->IsLiteralNode()) {
LiteralNode* lit = left_operand->AsLiteralNode();
if (lit->literal().IsString()) {
- str_concat = new StringConcatNode(lit->token_index());
- str_concat->AddExpr(lit);
+ if (FLAG_allow_string_plus) {
+ str_concat = new StringConcatNode(lit->token_index());
+ str_concat->AddExpr(lit);
+ } else {
+ ErrorMsg(op_pos, "operator + on strings no longer allowed");
+ }
}
} else if (left_operand->IsStringConcatNode()) {
str_concat = left_operand->AsStringConcatNode();
« runtime/lib/string.cc ('K') | « runtime/vm/bootstrap_natives.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698