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

Unified Diff: runtime/vm/parser.cc

Issue 312693008: Add javascript compatibility warnings for strings that are not identical, but (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | tests/standalone/javascript_compatibility_errors_test.dart » ('j') | 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 37011)
+++ runtime/vm/parser.cc (working copy)
@@ -42,6 +42,7 @@
DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
DECLARE_FLAG(bool, error_on_bad_type);
DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
+DECLARE_FLAG(bool, warn_on_javascript_compatibility);
static void CheckedModeHandler(bool value) {
FLAG_enable_asserts = value;
@@ -8378,13 +8379,17 @@
} else if (cls.IsTopLevel() &&
(cls.library() == Library::CoreLibrary()) &&
(func.name() == Symbols::Identical().raw())) {
- // This is the predefined toplevel function identical(a,b). Create
- // a comparison node instead.
- ASSERT(num_arguments == 2);
- return new(isolate()) ComparisonNode(ident_pos,
- Token::kEQ_STRICT,
- arguments->NodeAt(0),
- arguments->NodeAt(1));
+ // This is the predefined toplevel function identical(a,b).
+ // Create a comparison node instead of a static call to the function, unless
+ // javascript warnings are desired and identical is not invoked from a patch
+ // source.
+ if (!FLAG_warn_on_javascript_compatibility || is_patch_source()) {
+ ASSERT(num_arguments == 2);
+ return new(isolate()) ComparisonNode(ident_pos,
+ Token::kEQ_STRICT,
+ arguments->NodeAt(0),
+ arguments->NodeAt(1));
+ }
}
return new(isolate()) StaticCallNode(call_pos, func, arguments);
}
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | tests/standalone/javascript_compatibility_errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698