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

Side by Side Diff: pkg/kernel/test/round_trip.dart

Issue 2561723003: Merge kernel closure conversion into the Dart SDK (Closed)
Patch Set: Remove path constraint Created 4 years 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
« no previous file with comments | « pkg/kernel/test/closures_test.dart ('k') | pkg/kernel/test/treeshaker_membench.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library kernel.round_trip; 4 library kernel.round_trip;
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'package:kernel/binary/ast_from_binary.dart'; 8 import 'package:kernel/binary/ast_from_binary.dart';
9 import 'package:kernel/binary/ast_to_binary.dart'; 9 import 'package:kernel/binary/ast_to_binary.dart';
10 import 'package:kernel/binary/loader.dart'; 10 import 'package:kernel/binary/loader.dart';
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 /// trace shows what the serializer was doing when the output started to differ. 46 /// trace shows what the serializer was doing when the output started to differ.
47 class BinaryPrinterWithExpectedOutput extends BinaryPrinter { 47 class BinaryPrinterWithExpectedOutput extends BinaryPrinter {
48 final List<int> expectedBytes; 48 final List<int> expectedBytes;
49 int offset = 0; 49 int offset = 0;
50 50
51 static const int eof = -1; 51 static const int eof = -1;
52 52
53 BinaryPrinterWithExpectedOutput(this.expectedBytes) 53 BinaryPrinterWithExpectedOutput(this.expectedBytes)
54 : super(new IOSink(new DummyStreamConsumer())); 54 : super(new IOSink(new DummyStreamConsumer()));
55 55
56
57 String show(int byte) { 56 String show(int byte) {
58 if (byte == eof) return 'EOF'; 57 if (byte == eof) return 'EOF';
59 return '$byte (0x${byte.toRadixString(16).padLeft(2, "0")})'; 58 return '$byte (0x${byte.toRadixString(16).padLeft(2, "0")})';
60 } 59 }
61 60
62 @override 61 @override
63 void writeByte(int byte) { 62 void writeByte(int byte) {
64 if (offset == expectedBytes.length || expectedBytes[offset] != byte) { 63 if (offset == expectedBytes.length || expectedBytes[offset] != byte) {
65 int expected = 64 int expected =
66 (offset >= expectedBytes.length) ? eof : expectedBytes[offset]; 65 (offset >= expectedBytes.length) ? eof : expectedBytes[offset];
67 throw 'At offset $offset: ' 66 throw 'At offset $offset: '
68 'Expected ${show(expected)} but found ${show(byte)}'; 67 'Expected ${show(expected)} but found ${show(byte)}';
69 } 68 }
70 ++offset; 69 ++offset;
71 } 70 }
72 71
73 @override 72 @override
74 void writeBytes(List<int> bytes) { 73 void writeBytes(List<int> bytes) {
75 bytes.forEach(writeByte); 74 bytes.forEach(writeByte);
76 } 75 }
77 } 76 }
OLDNEW
« no previous file with comments | « pkg/kernel/test/closures_test.dart ('k') | pkg/kernel/test/treeshaker_membench.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698