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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 List regExpExec(JSSyntaxRegExp regExp, String str) { 5 List regExpExec(JSSyntaxRegExp regExp, String str) {
6 var nativeRegExp = regExpGetNative(regExp); 6 var nativeRegExp = regExpGetNative(regExp);
7 var result = JS('List', r'#.exec(#)', nativeRegExp, str); 7 var result = JS('List', r'#.exec(#)', nativeRegExp, str);
8 if (JS('bool', r'# === null', result)) return null; 8 if (JS('bool', r'# == null', result)) return null;
9 return result; 9 return result;
10 } 10 }
11 11
12 bool regExpTest(JSSyntaxRegExp regExp, String str) { 12 bool regExpTest(JSSyntaxRegExp regExp, String str) {
13 var nativeRegExp = regExpGetNative(regExp); 13 var nativeRegExp = regExpGetNative(regExp);
14 return JS('bool', r'#.test(#)', nativeRegExp, str); 14 return JS('bool', r'#.test(#)', nativeRegExp, str);
15 } 15 }
16 16
17 regExpGetNative(JSSyntaxRegExp regExp) { 17 regExpGetNative(JSSyntaxRegExp regExp) {
18 var r = JS('var', r'#._re', regExp); 18 var r = JS('var', r'#._re', regExp);
(...skipping 18 matching lines...) Expand all
37 if (global) sb.add('g'); 37 if (global) sb.add('g');
38 try { 38 try {
39 return JS('Object', r'new RegExp(#, #)', pattern, sb.toString()); 39 return JS('Object', r'new RegExp(#, #)', pattern, sb.toString());
40 } catch (e) { 40 } catch (e) {
41 throw new IllegalJSRegExpException(pattern, 41 throw new IllegalJSRegExpException(pattern,
42 JS('String', r'String(#)', e)); 42 JS('String', r'String(#)', e));
43 } 43 }
44 } 44 }
45 45
46 int regExpMatchStart(m) => JS('int', r'#.index', m); 46 int regExpMatchStart(m) => JS('int', r'#.index', m);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698