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

Unified Diff: runtime/lib/regexp_patch.dart

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: Created 3 years, 9 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/lib/profiler.dart ('k') | runtime/lib/schedule_microtask_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/regexp_patch.dart
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart
index 5a6514527594dd6984225e89d4da16e81df87243..0c9320452470020883d21daa3fb73dcd1c878300 100644
--- a/runtime/lib/regexp_patch.dart
+++ b/runtime/lib/regexp_patch.dart
@@ -2,12 +2,12 @@
// 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.
-@patch
-class RegExp {
- @patch
- factory RegExp(String source,
- {bool multiLine: false, bool caseSensitive: true}) {
- _RegExpHashKey key = new _RegExpHashKey(source, multiLine, caseSensitive);
+@patch class RegExp {
+ @patch factory RegExp(String source,
+ {bool multiLine: false,
+ bool caseSensitive: true}) {
+ _RegExpHashKey key = new _RegExpHashKey(
+ source, multiLine, caseSensitive);
_RegExpHashValue value = _cache[key];
if (value == null) {
@@ -19,7 +19,8 @@ class RegExp {
value = new _RegExpHashValue(
new _RegExp(source,
- multiLine: multiLine, caseSensitive: caseSensitive),
+ multiLine: multiLine,
+ caseSensitive: caseSensitive),
key);
_cache[key] = value;
} else {
@@ -50,6 +51,7 @@ class RegExp {
new LinkedList<_RegExpHashKey>();
}
+
// Represents both a key in the regular expression cache as well as its
// corresponding entry in the LRU list.
class _RegExpHashKey extends LinkedListEntry<_RegExpHashKey> {
@@ -60,13 +62,14 @@ class _RegExpHashKey extends LinkedListEntry<_RegExpHashKey> {
_RegExpHashKey(this.pattern, this.multiLine, this.caseSensitive);
int get hashCode => pattern.hashCode;
- bool operator ==(_RegExpHashKey that) {
+ bool operator==(_RegExpHashKey that) {
return (this.pattern == that.pattern) &&
- (this.multiLine == that.multiLine) &&
- (this.caseSensitive == that.caseSensitive);
+ (this.multiLine == that.multiLine) &&
+ (this.caseSensitive == that.caseSensitive);
}
}
+
// Represents a value in the regular expression cache. Contains a pointer
// back to the key in order to access the corresponding LRU entry.
class _RegExpHashValue {
@@ -76,6 +79,7 @@ class _RegExpHashValue {
_RegExpHashValue(this.regexp, this.key);
}
+
class _RegExpMatch implements Match {
_RegExpMatch(this._regexp, this.input, this._match);
@@ -125,10 +129,12 @@ class _RegExpMatch implements Match {
static const int _MATCH_PAIR = 2;
}
+
class _RegExp implements RegExp {
- factory _RegExp(String pattern,
+ factory _RegExp(
+ String pattern,
{bool multiLine: false,
- bool caseSensitive: true}) native "RegExp_factory";
+ bool caseSensitive: true}) native "RegExp_factory";
Match firstMatch(String str) {
if (str is! String) throw new ArgumentError(str);
@@ -193,18 +199,18 @@ class _RegExp implements RegExp {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // '0' - '7'
- 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // '8' - '9'
-
- 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'A' - 'G'
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'H' - 'O'
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'P' - 'W'
- 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, // 'X' - 'Z', '_'
-
- 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'a' - 'g'
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'h' - 'o'
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'p' - 'w'
- 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, // 'x' - 'z'
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // '0' - '7'
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // '8' - '9'
+
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'A' - 'G'
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'H' - 'O'
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'P' - 'W'
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, // 'X' - 'Z', '_'
+
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'a' - 'g'
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'h' - 'o'
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'p' - 'w'
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, // 'x' - 'z'
// Latin-1 range
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -227,7 +233,8 @@ class _RegExp implements RegExp {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
- List _ExecuteMatch(String str, int start_index) native "RegExp_ExecuteMatch";
+ List _ExecuteMatch(String str, int start_index)
+ native "RegExp_ExecuteMatch";
List _ExecuteMatchSticky(String str, int start_index)
native "RegExp_ExecuteMatchSticky";
@@ -254,7 +261,7 @@ class _AllMatchesIterator implements Iterator<Match> {
Match get current => _current;
bool moveNext() {
- if (_re == null) return false; // Cleared after a failed match.
+ if (_re == null) return false; // Cleared after a failed match.
if (_nextIndex <= _str.length) {
var match = _re._ExecuteMatch(_str, _nextIndex);
if (match != null) {
« no previous file with comments | « runtime/lib/profiler.dart ('k') | runtime/lib/schedule_microtask_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698