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

Unified Diff: pkg/front_end/lib/src/scanner/string_utilities.dart

Issue 2486873003: Move scanner into pkg/front_end/lib/src/scanner. (Closed)
Patch Set: Created 4 years, 1 month 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: pkg/front_end/lib/src/scanner/string_utilities.dart
diff --git a/pkg/front_end/lib/src/scanner/string_utilities.dart b/pkg/front_end/lib/src/scanner/string_utilities.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4f9dc14c1c79a33372ebf7363230d0189bed199c
--- /dev/null
+++ b/pkg/front_end/lib/src/scanner/string_utilities.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library front_end.src.scanner.string_utilities;
+
+import 'package:front_end/src/scanner/interner.dart';
+
+class StringUtilities {
+ static Interner INTERNER = new NullInterner();
+
+ static bool endsWith3(String str, int c1, int c2, int c3) {
Brian Wilkerson 2016/11/08 20:53:24 We might want to verify that these methods are sti
+ var length = str.length;
+ return length >= 3 &&
+ str.codeUnitAt(length - 3) == c1 &&
+ str.codeUnitAt(length - 2) == c2 &&
+ str.codeUnitAt(length - 1) == c3;
+ }
+
+ static String intern(String string) => INTERNER.intern(string);
+
+ static bool startsWith3(String str, int start, int c1, int c2, int c3) {
+ return str.length - start >= 3 &&
+ str.codeUnitAt(start) == c1 &&
+ str.codeUnitAt(start + 1) == c2 &&
+ str.codeUnitAt(start + 2) == c3;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698