| OLD | NEW |
| 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 class RegExpWrapper { | 5 class RegExpWrapper { |
| 6 final re; | 6 final re; |
| 7 | 7 |
| 8 // TODO(ahe): This constructor is clearly not const. We need some | 8 // TODO(ahe): This constructor is clearly not const. We need some |
| 9 // better way to handle constant regular expressions. One might | 9 // better way to handle constant regular expressions. One might |
| 10 // question if regular expressions are really constant as we have | 10 // question if regular expressions are really constant as we have |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 static makeRegExp(pattern, flags) { | 33 static makeRegExp(pattern, flags) { |
| 34 checkString(pattern); | 34 checkString(pattern); |
| 35 try { | 35 try { |
| 36 return JS('Object', @'new RegExp($0, $1)', pattern, flags); | 36 return JS('Object', @'new RegExp($0, $1)', pattern, flags); |
| 37 } catch (var e) { | 37 } catch (var e) { |
| 38 throw new IllegalJSRegExpException(pattern, | 38 throw new IllegalJSRegExpException(pattern, |
| 39 JS('String', @'String($0)', e)); | 39 JS('String', @'String($0)', e)); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | |
| 44 stringify(x) => x === null ? "" : x.toString(); | |
| OLD | NEW |