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

Unified Diff: sdk/lib/_internal/js_runtime/lib/string_helper.dart

Issue 2648653005: js_runtime: help type inference of string replace (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/string_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/string_helper.dart b/sdk/lib/_internal/js_runtime/lib/string_helper.dart
index 8ec6c479974d43341439103b8a7cc1f21e16484c..78a0980cff9d66b8d7542f577746a3a89a4bcb45 100644
--- a/sdk/lib/_internal/js_runtime/lib/string_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/string_helper.dart
@@ -142,7 +142,7 @@ stringReplaceAllUnchecked(receiver, pattern, replacement) {
if (pattern is String) {
if (pattern == "") {
if (receiver == "") {
- return replacement;
+ return JS('String', '#', replacement); // help type inference.
Siggi Cherem (dart-lang) 2017/01/23 17:45:04 would it also work if we change the check in line
} else {
StringBuffer result = new StringBuffer('');
int length = receiver.length;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698