| 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 // Patch file for dart:core classes. | 5 // Patch file for dart:core classes. |
| 6 | 6 |
| 7 import 'dart:_interceptors'; | 7 import 'dart:_interceptors'; |
| 8 import 'dart:_js_helper' show checkNull, | 8 import 'dart:_js_helper' show checkNull, |
| 9 getRuntimeTypeString, | 9 getRuntimeTypeString, |
| 10 isJsArray, | 10 isJsArray, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 multiLine: multiLine, | 237 multiLine: multiLine, |
| 238 caseSensitive: caseSensitive); | 238 caseSensitive: caseSensitive); |
| 239 } | 239 } |
| 240 | 240 |
| 241 // Patch for 'identical' function. | 241 // Patch for 'identical' function. |
| 242 patch bool identical(Object a, Object b) { | 242 patch bool identical(Object a, Object b) { |
| 243 return Primitives.identicalImplementation(a, b); | 243 return Primitives.identicalImplementation(a, b); |
| 244 } | 244 } |
| 245 | 245 |
| 246 patch class StringBuffer { | 246 patch class StringBuffer { |
| 247 patch factory StringBuffer([Object content = ""]) { | 247 String _contents = ""; |
| 248 return new JsStringBuffer(content); | 248 |
| 249 patch StringBuffer([Object content = ""]) { |
| 250 if (content is String) { |
| 251 _contents = content; |
| 252 } else { |
| 253 write(content); |
| 254 } |
| 249 } | 255 } |
| 256 |
| 257 patch int get length => _contents.length; |
| 258 |
| 259 patch void write(Object obj) { |
| 260 String str = obj is String ? obj : "$obj"; |
| 261 _contents = Primitives.stringConcatUnchecked(_contents, str); |
| 262 } |
| 263 |
| 264 patch void clear() { |
| 265 _contents = ""; |
| 266 } |
| 267 |
| 268 patch String toString() => _contents; |
| 250 } | 269 } |
| OLD | NEW |