| Index: sdk/lib/_internal/compiler/implementation/util/util.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/util/util.dart b/sdk/lib/_internal/compiler/implementation/util/util.dart
|
| index 0c94d40cbcae406907c307bb1600f6cc1a177169..9d4056a6954ca0eb9113f782ae271802b3ec0faf 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/util/util.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/util/util.dart
|
| @@ -37,36 +37,36 @@ class SpannableAssertionFailure {
|
|
|
| /// Writes the characters of [string] on [buffer]. The characters
|
| /// are escaped as suitable for JavaScript and JSON. [buffer] is
|
| -/// anything which supports [:add:] and [:addCharCode:], for example,
|
| +/// anything which supports [:write:] and [:writeCharCode:], for example,
|
| /// [StringBuffer]. Note that JS supports \xnn and \unnnn whereas JSON only
|
| /// supports the \unnnn notation. Therefore we use the \unnnn notation.
|
| void writeJsonEscapedCharsOn(String string, buffer) {
|
| void addCodeUnitEscaped(var buffer, int code) {
|
| assert(code < 0x10000);
|
| - buffer.add(r'\u');
|
| + buffer.write(r'\u');
|
| if (code < 0x1000) {
|
| - buffer.add('0');
|
| + buffer.write('0');
|
| if (code < 0x100) {
|
| - buffer.add('0');
|
| + buffer.write('0');
|
| if (code < 0x10) {
|
| - buffer.add('0');
|
| + buffer.write('0');
|
| }
|
| }
|
| }
|
| - buffer.add(code.toRadixString(16));
|
| + buffer.write(code.toRadixString(16));
|
| }
|
|
|
| void writeEscapedOn(String string, var buffer) {
|
| for (int i = 0; i < string.length; i++) {
|
| int code = string.codeUnitAt(i);
|
| if (code == $DQ) {
|
| - buffer.add(r'\"');
|
| + buffer.write(r'\"');
|
| } else if (code == $TAB) {
|
| - buffer.add(r'\t');
|
| + buffer.write(r'\t');
|
| } else if (code == $LF) {
|
| - buffer.add(r'\n');
|
| + buffer.write(r'\n');
|
| } else if (code == $CR) {
|
| - buffer.add(r'\r');
|
| + buffer.write(r'\r');
|
| } else if (code == $DEL) {
|
| addCodeUnitEscaped(buffer, $DEL);
|
| } else if (code == $LS) {
|
| @@ -76,7 +76,7 @@ void writeJsonEscapedCharsOn(String string, buffer) {
|
| } else if (code == $PS) {
|
| addCodeUnitEscaped(buffer, $PS); // 0x2029.
|
| } else if (code == $BACKSLASH) {
|
| - buffer.add(r'\\');
|
| + buffer.write(r'\\');
|
| } else {
|
| if (code < 0x20) {
|
| addCodeUnitEscaped(buffer, code);
|
| @@ -85,7 +85,7 @@ void writeJsonEscapedCharsOn(String string, buffer) {
|
| // everything above 0x7f because that means we don't have to worry
|
| // about whether the web server serves it up as Latin1 or UTF-8.
|
| } else if (code < 0x7f) {
|
| - buffer.addCharCode(code);
|
| + buffer.writeCharCode(code);
|
| } else {
|
| // This will output surrogate pairs in the form \udxxx\udyyy, rather
|
| // than the more logical \u{zzzzzz}. This should work in JavaScript
|
| @@ -105,5 +105,5 @@ void writeJsonEscapedCharsOn(String string, buffer) {
|
| return;
|
| }
|
| }
|
| - buffer.add(string);
|
| + buffer.write(string);
|
| }
|
|
|