OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
8 | 8 |
9 import 'class.dart'; | 9 import 'class.dart'; |
10 import 'frame.dart'; | 10 import 'frame.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 '\v': r'\v', | 21 '\v': r'\v', |
22 '\x7F': r'\x7F', // delete | 22 '\x7F': r'\x7F', // delete |
23 }; | 23 }; |
24 | 24 |
25 /// A regular expression matching the Dart VM stack frame method name for an | 25 /// A regular expression matching the Dart VM stack frame method name for an |
26 /// asynchronous body. | 26 /// asynchronous body. |
27 final _asyncBody = new RegExp(r'<(<anonymous closure>|[^>]+)_async_body>'); | 27 final _asyncBody = new RegExp(r'<(<anonymous closure>|[^>]+)_async_body>'); |
28 | 28 |
29 /// Transforms [stream] with a [StreamTransformer] that transforms data events | 29 /// Transforms [stream] with a [StreamTransformer] that transforms data events |
30 /// using [handleData]. | 30 /// using [handleData]. |
31 Stream/*<T>*/ transform/*<S, T>*/(Stream/*<S>*/ stream, | 31 Stream<T> transform<S, T>(Stream<S> stream, |
32 void handleData(/*=S*/ data, EventSink/*<T>*/ sink)) => | 32 void handleData(S data, EventSink<T> sink)) => |
33 stream.transform( | 33 stream.transform( |
34 new StreamTransformer.fromHandlers(handleData: handleData)); | 34 new StreamTransformer.fromHandlers(handleData: handleData)); |
35 | 35 |
36 /// Loads a `stack_trace` [Frame] for [frame]. | 36 /// Loads a `stack_trace` [Frame] for [frame]. |
37 /// | 37 /// |
38 /// If [scripts] is passed, it should be a map of [VMScript]s that have already | 38 /// If [scripts] is passed, it should be a map of [VMScript]s that have already |
39 /// been loaded, indexed by [name]. This function modifys the map so that it can | 39 /// been loaded, indexed by [name]. This function modifys the map so that it can |
40 /// be passed in to future invocations to avoid unnecessary loads. | 40 /// be passed in to future invocations to avoid unnecessary loads. |
41 Future<Frame> frameToFrame(VMFrame frame, [Map<String, VMScript> scripts]) | 41 Future<Frame> frameToFrame(VMFrame frame, [Map<String, VMScript> scripts]) |
42 async { | 42 async { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (mapped != null) return mapped; | 79 if (mapped != null) return mapped; |
80 return _getHexLiteral(match[0]); | 80 return _getHexLiteral(match[0]); |
81 }); | 81 }); |
82 } | 82 } |
83 | 83 |
84 /// Given single-character string, return the hex-escaped equivalent. | 84 /// Given single-character string, return the hex-escaped equivalent. |
85 String _getHexLiteral(String input) { | 85 String _getHexLiteral(String input) { |
86 int rune = input.runes.single; | 86 int rune = input.runes.single; |
87 return r'\x' + rune.toRadixString(16).toUpperCase().padLeft(2, '0'); | 87 return r'\x' + rune.toRadixString(16).toUpperCase().padLeft(2, '0'); |
88 } | 88 } |
OLD | NEW |