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

Side by Side Diff: pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart

Issue 42863002: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// A library for code coverage support for Dart. 5 /// A library for code coverage support for Dart.
6 library runtime.coverage.impl; 6 library runtime.coverage.impl;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection' show SplayTreeMap; 9 import 'dart:collection' show SplayTreeMap;
10 import 'dart:io'; 10 import 'dart:io';
11 11
12 import 'package:path/path.dart' as pathos; 12 import 'package:path/path.dart' as pathos;
13 13
14 import 'package:analyzer_experimental/src/generated/scanner.dart' show StringSca nner; 14 import 'package:analyzer_experimental/src/generated/java_core.dart' show CharSeq uence;
15 import 'package:analyzer_experimental/src/generated/scanner.dart' show CharSeque nceReader, Scanner;
15 import 'package:analyzer_experimental/src/generated/parser.dart' show Parser; 16 import 'package:analyzer_experimental/src/generated/parser.dart' show Parser;
16 import 'package:analyzer_experimental/src/generated/ast.dart'; 17 import 'package:analyzer_experimental/src/generated/ast.dart';
17 import 'package:analyzer_experimental/src/generated/engine.dart' show RecordingE rrorListener; 18 import 'package:analyzer_experimental/src/generated/engine.dart' show RecordingE rrorListener;
18 19
19 import '../log.dart' as log; 20 import '../log.dart' as log;
20 import 'models.dart'; 21 import 'models.dart';
21 22
22 /// Run the [targetPath] with code coverage rewriting. 23 /// Run the [targetPath] with code coverage rewriting.
23 /// Redirects stdandard process streams. 24 /// Redirects stdandard process streams.
24 /// On process exit dumps coverage statistics into the [outPath]. 25 /// On process exit dumps coverage statistics into the [outPath].
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 unit.accept(new InsertTouchInvocationsVisitor(appInfo, injector)); 240 unit.accept(new InsertTouchInvocationsVisitor(appInfo, injector));
240 } 241 }
241 // Done. 242 // Done.
242 return injector.getResult(); 243 return injector.getResult();
243 } 244 }
244 245
245 CompilationUnit _parseCode(String code) { 246 CompilationUnit _parseCode(String code) {
246 var source = null; 247 var source = null;
247 var errorListener = new RecordingErrorListener(); 248 var errorListener = new RecordingErrorListener();
248 var parser = new Parser(source, errorListener); 249 var parser = new Parser(source, errorListener);
249 var scanner = new StringScanner(source, code, errorListener); 250 var reader = new CharSequenceReader(new CharSequence(code));
251 var scanner = new Scanner(null, reader, errorListener);
250 var token = scanner.tokenize(); 252 var token = scanner.tokenize();
251 return parser.parseCompilationUnit(token); 253 return parser.parseCompilationUnit(token);
252 } 254 }
253 } 255 }
254 256
255 257
256 /// The visitor that inserts `touch` method invocations. 258 /// The visitor that inserts `touch` method invocations.
257 class InsertTouchInvocationsVisitor extends GeneralizingASTVisitor { 259 class InsertTouchInvocationsVisitor extends GeneralizingASTVisitor {
258 final AppInfo appInfo; 260 final AppInfo appInfo;
259 final CodeInjector injector; 261 final CodeInjector injector;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 var lastOffset = 0; 332 var lastOffset = 0;
331 offsetFragmentMap.forEach((offset, fragment) { 333 offsetFragmentMap.forEach((offset, fragment) {
332 sb.write(_code.substring(lastOffset, offset)); 334 sb.write(_code.substring(lastOffset, offset));
333 sb.write(fragment); 335 sb.write(fragment);
334 lastOffset = offset; 336 lastOffset = offset;
335 }); 337 });
336 sb.write(_code.substring(lastOffset, _code.length)); 338 sb.write(_code.substring(lastOffset, _code.length));
337 return sb.toString(); 339 return sb.toString();
338 } 340 }
339 } 341 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/services/formatter_impl.dart ('k') | pkg/analyzer_experimental/test/generated/ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698