LCOV - code coverage report
Current view: top level - stack_trace-1.10.0/lib/src - vm_trace.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 12 0.0 %
Date: 2021-11-28 14:37:50 Functions: 0 0 -

          Line data    Source code
       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
       3             : // BSD-style license that can be found in the LICENSE file.
       4             : 
       5             : import 'frame.dart';
       6             : 
       7             : /// An implementation of [StackTrace] that emulates the behavior of the VM's
       8             : /// implementation.
       9             : ///
      10             : /// In particular, when [toString] is called, this returns a string in the VM's
      11             : /// stack trace format.
      12             : class VMTrace implements StackTrace {
      13             :   /// The stack frames that comprise this stack trace.
      14             :   final List<Frame> frames;
      15             : 
      16           0 :   VMTrace(this.frames);
      17             : 
      18           0 :   @override
      19             :   String toString() {
      20             :     var i = 1;
      21           0 :     return frames.map((frame) {
      22           0 :       var number = '#${i++}'.padRight(8);
      23           0 :       var member = frame.member!
      24           0 :           .replaceAllMapped(RegExp(r'[^.]+\.<async>'),
      25           0 :               (match) => '${match[1]}.<${match[1]}_async_body>')
      26           0 :           .replaceAll('<fn>', '<anonymous closure>');
      27           0 :       var line = frame.line ?? 0;
      28           0 :       var column = frame.column ?? 0;
      29           0 :       return '$number$member (${frame.uri}:$line:$column)\n';
      30           0 :     }).join();
      31             :   }
      32             : }

Generated by: LCOV version 1.14