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

Side by Side Diff: pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart

Issue 2846463003: Instrument analyzer's type analysis and run front_end inference tests. (Closed)
Patch Set: Updates. Created 3 years, 7 months 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:convert'; 5 import 'dart:convert';
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:front_end/src/base/instrumentation.dart'; 8 import 'package:front_end/src/base/instrumentation.dart';
9 import 'package:front_end/src/fasta/messages.dart'; 9 import 'package:front_end/src/fasta/messages.dart';
10 import 'package:front_end/src/fasta/scanner.dart'; 10 import 'package:front_end/src/fasta/scanner.dart';
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 }); 71 });
72 }); 72 });
73 } 73 }
74 74
75 /// Updates the source file at [uri] based on the actual property/value 75 /// Updates the source file at [uri] based on the actual property/value
76 /// pairs that were observed. 76 /// pairs that were observed.
77 Future<Null> fixSource(Uri uri) async { 77 Future<Null> fixSource(Uri uri) async {
78 var fixes = _fixes[uri]; 78 var fixes = _fixes[uri];
79 if (fixes == null) return; 79 if (fixes == null) return;
80 File file = new File.fromUri(uri); 80 File file = new File.fromUri(uri);
81 var bytes = await file.readAsBytes(); 81 var bytes = (await file.readAsBytes()).toList();
82 // Apply the fixes in reverse order so that offsets don't need to be 82 // Apply the fixes in reverse order so that offsets don't need to be
83 // adjusted after each fix. 83 // adjusted after each fix.
84 fixes.sort((a, b) => b.offset.compareTo(a.offset)); 84 fixes.sort((a, b) => b.offset.compareTo(a.offset));
85 for (var fix in fixes) { 85 for (var fix in fixes) {
86 bytes.replaceRange( 86 bytes.replaceRange(
87 fix.offset, fix.offset + fix.length, UTF8.encode(fix.replacement)); 87 fix.offset, fix.offset + fix.length, UTF8.encode(fix.replacement));
88 } 88 }
89 await file.writeAsBytes(bytes); 89 await file.writeAsBytes(bytes);
90 } 90 }
91 91
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 this.property, this.value, this.commentOffset, this.commentLength); 220 this.property, this.value, this.commentOffset, this.commentLength);
221 } 221 }
222 222
223 class _Fix { 223 class _Fix {
224 final int offset; 224 final int offset;
225 final int length; 225 final int length;
226 final String replacement; 226 final String replacement;
227 227
228 _Fix(this.offset, this.length, this.replacement); 228 _Fix(this.offset, this.length, this.replacement);
229 } 229 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/base/instrumentation.dart ('k') | pkg/front_end/test/fasta/kompile.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698