Chromium Code Reviews| Index: tests/compiler/dart2js/scanner_test.dart |
| diff --git a/tests/compiler/dart2js/scanner_test.dart b/tests/compiler/dart2js/scanner_test.dart |
| index f9f42fa7d7abb0a003a5974d276f71ee3e605a39..0ce83766ed6586d9b110d0e0a12162a5e268f7e3 100644 |
| --- a/tests/compiler/dart2js/scanner_test.dart |
| +++ b/tests/compiler/dart2js/scanner_test.dart |
| @@ -7,13 +7,19 @@ import 'package:compiler/src/scanner/scannerlib.dart'; |
| import 'package:compiler/src/util/characters.dart'; |
| import 'dart:typed_data'; |
| -Token scan(List<int> bytes) => new Utf8BytesScanner.fromBytes(bytes).tokenize(); |
| +Token scan(List<int> bytes) { |
| + List<int> zeroTerminated = new List<int>(bytes.length + 1); |
|
Anders Johnsen
2015/03/11 08:06:01
uint8list?
floitsch
2015/03/11 17:07:12
Done.
|
| + zeroTerminated.setRange(0, bytes.length, bytes); |
| + zeroTerminated[bytes.length] = 0; |
| + return new Utf8BytesScanner.fromBytes(zeroTerminated).tokenize(); |
| +} |
| Token scanUTF8(List<int> bytes) { |
| int l = bytes.length; |
| List<int> stringLiteral = new Uint8List(l + 3); |
| stringLiteral[0] = 0x27; // single quote |
| stringLiteral[l+1] = 0x27; // single quote |
| + // The bytes given to the scanner must be 0-terminated. |
| stringLiteral[l+2] = $EOF; |
| for (int i = 0; i < l; i++) { |
| stringLiteral[i+1] = bytes[i]; |