OLD | NEW |
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'; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 var parser = new Parser(source, errorListener); | 247 var parser = new Parser(source, errorListener); |
248 var reader = new CharSequenceReader(code); | 248 var reader = new CharSequenceReader(code); |
249 var scanner = new Scanner(null, reader, errorListener); | 249 var scanner = new Scanner(null, reader, errorListener); |
250 var token = scanner.tokenize(); | 250 var token = scanner.tokenize(); |
251 return parser.parseCompilationUnit(token); | 251 return parser.parseCompilationUnit(token); |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 /// The visitor that inserts `touch` method invocations. | 256 /// The visitor that inserts `touch` method invocations. |
257 class InsertTouchInvocationsVisitor extends GeneralizingASTVisitor { | 257 class InsertTouchInvocationsVisitor extends GeneralizingAstVisitor { |
258 final AppInfo appInfo; | 258 final AppInfo appInfo; |
259 final CodeInjector injector; | 259 final CodeInjector injector; |
260 | 260 |
261 InsertTouchInvocationsVisitor(this.appInfo, this.injector); | 261 InsertTouchInvocationsVisitor(this.appInfo, this.injector); |
262 | 262 |
263 visitClassDeclaration(ClassDeclaration node) { | 263 visitClassDeclaration(ClassDeclaration node) { |
264 appInfo.enter('class', node.name.name); | 264 appInfo.enter('class', node.name.name); |
265 super.visitClassDeclaration(node); | 265 super.visitClassDeclaration(node); |
266 appInfo.leave(); | 266 appInfo.leave(); |
267 } | 267 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 var lastOffset = 0; | 330 var lastOffset = 0; |
331 offsetFragmentMap.forEach((offset, fragment) { | 331 offsetFragmentMap.forEach((offset, fragment) { |
332 sb.write(_code.substring(lastOffset, offset)); | 332 sb.write(_code.substring(lastOffset, offset)); |
333 sb.write(fragment); | 333 sb.write(fragment); |
334 lastOffset = offset; | 334 lastOffset = offset; |
335 }); | 335 }); |
336 sb.write(_code.substring(lastOffset, _code.length)); | 336 sb.write(_code.substring(lastOffset, _code.length)); |
337 return sb.toString(); | 337 return sb.toString(); |
338 } | 338 } |
339 } | 339 } |
OLD | NEW |