| 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 library source_map_stack_trace; | |
| 6 | |
| 7 import 'package:path/path.dart' as p; | 5 import 'package:path/path.dart' as p; |
| 8 import 'package:source_maps/source_maps.dart'; | 6 import 'package:source_maps/source_maps.dart'; |
| 9 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
| 10 | 8 |
| 11 /// Convert [stackTrace], a stack trace generated by dart2js-compiled | 9 /// Convert [stackTrace], a stack trace generated by dart2js-compiled |
| 12 /// JavaScript, to a native-looking stack trace using [sourceMap]. | 10 /// JavaScript, to a native-looking stack trace using [sourceMap]. |
| 13 /// | 11 /// |
| 14 /// [minified] indicates whether or not the dart2js code was minified. If it | 12 /// [minified] indicates whether or not the dart2js code was minified. If it |
| 15 /// hasn't, this tries to clean up the stack frame member names. | 13 /// hasn't, this tries to clean up the stack frame member names. |
| 16 /// | 14 /// |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 .replaceAll(new RegExp(r"[a-zA-Z_0-9]+\$"), "") | 99 .replaceAll(new RegExp(r"[a-zA-Z_0-9]+\$"), "") |
| 102 // Get rid of the static method prefix. The class name also exists in the | 100 // Get rid of the static method prefix. The class name also exists in the |
| 103 // invocation, so we're not getting rid of any information. | 101 // invocation, so we're not getting rid of any information. |
| 104 .replaceAll(new RegExp(r"^[a-zA-Z_0-9]+.(static|dart)."), "") | 102 .replaceAll(new RegExp(r"^[a-zA-Z_0-9]+.(static|dart)."), "") |
| 105 // Convert underscores after identifiers to dots. This runs the risk of | 103 // Convert underscores after identifiers to dots. This runs the risk of |
| 106 // incorrectly converting members that contain underscores, but those are | 104 // incorrectly converting members that contain underscores, but those are |
| 107 // contrary to the style guide anyway. | 105 // contrary to the style guide anyway. |
| 108 .replaceAllMapped(new RegExp(r"([a-zA-Z0-9]+)_"), | 106 .replaceAllMapped(new RegExp(r"([a-zA-Z0-9]+)_"), |
| 109 (match) => match[1] + "."); | 107 (match) => match[1] + "."); |
| 110 } | 108 } |
| OLD | NEW |