Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/util/util.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/util/util.dart b/sdk/lib/_internal/compiler/implementation/util/util.dart |
| index 2638fd84173295ccfd875579754940fb7ea10795..54fbbe262035717ac048ec4b0f1120cf61ebbea5 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/util/util.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/util/util.dart |
| @@ -77,6 +77,11 @@ class _StackTraceLine { |
| _StackTraceLine(this.index, this.file, this.lineNo, |
| this.columnNo, this.method); |
| + |
| + String toString() { |
| + return 'index=$index, file=$file, ' |
| + 'lineNo=$lineNo, columnNo=$columnNo, method=$method'; |
| + } |
| } |
| // TODO(johnniwinther): Use this format for --throw-on-error. |
| @@ -123,14 +128,31 @@ String prettifyStackTrace(StackTrace s, |
| int lastColon = line.lastIndexOf(':', rightParenPos); |
| int nextToLastColon = line.lastIndexOf(':', lastColon-1); |
| - String lineNo = line.substring(nextToLastColon+1, lastColon); |
| + String lineNo; |
| + String columnNo; |
| + if (nextToLastColon != -1) { |
| + lineNo = line.substring(nextToLastColon+1, lastColon); |
| + columnNo = line.substring(lastColon+1, rightParenPos); |
| + try { |
| + int.parse(lineNo); |
| + } on FormatException catch (e) { |
| + lineNo = columnNo; |
| + columnNo = ''; |
| + nextToLastColon = lastColon; |
| + } |
| + } else { |
| + lineNo = line.substring(lastColon+1, rightParenPos); |
| + columnNo = ''; |
| + nextToLastColon = lastColon; |
| + } |
| + |
| if (lineNo.length > maxLineNoLength) { |
| maxLineNoLength = lineNo.length; |
| } |
| - String columnNo = line.substring(lastColon+1, rightParenPos); |
| if (columnNo.length > maxColumnNoLength) { |
| maxColumnNoLength = columnNo.length; |
| } |
| + |
| String file = line.substring(leftParenPos+1, nextToLastColon); |
| if (filePrefix != null && file.startsWith(filePrefix)) { |
| file = file.substring(filePrefix.length); |
| @@ -143,6 +165,8 @@ String prettifyStackTrace(StackTrace s, |
| method = method.replaceAll('<anonymous closure>', lambda); |
| } |
| lines.add(new _StackTraceLine(index, file, lineNo, columnNo, method)); |
| + //print(line); |
| + //print(lines.last); |
|
ahe
2013/09/30 11:05:26
Delete debug code.
Johnni Winther
2013/10/01 11:21:48
Done.
|
| } |
| StringBuffer sb = new StringBuffer(); |