OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of html; | 5 part of html; |
6 | 6 |
7 class _ConsoleVariables { | 7 class _ConsoleVariables { |
8 Map<String, Object> _data = new Map<String, Object>(); | 8 Map<String, Object> _data = new Map<String, Object>(); |
9 | 9 |
10 /** | 10 /** |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 static List parseStackTrace(StackTrace stackTrace) { | 73 static List parseStackTrace(StackTrace stackTrace) { |
74 final regExp = new RegExp(r'#\d\s+(.*) \((.*):(\d+):(\d+)\)'); | 74 final regExp = new RegExp(r'#\d\s+(.*) \((.*):(\d+):(\d+)\)'); |
75 List result = []; | 75 List result = []; |
76 for (var match in regExp.allMatches(stackTrace.toString())) { | 76 for (var match in regExp.allMatches(stackTrace.toString())) { |
77 result.add([match.group(1), match.group(2), int.parse(match.group(3)), int
.parse(match.group(4))]); | 77 result.add([match.group(1), match.group(2), int.parse(match.group(3)), int
.parse(match.group(4))]); |
78 } | 78 } |
79 return result; | 79 return result; |
80 } | 80 } |
81 | 81 |
| 82 static List captureParsedStackTrace() { |
| 83 try { |
| 84 // Throwing an exception is the only way to generate a stack trace. |
| 85 throw new Exception(); |
| 86 } catch (e, stackTrace) { |
| 87 return parseStackTrace(stackTrace); |
| 88 } |
| 89 } |
| 90 |
82 static void populateMap(Map result, List list) { | 91 static void populateMap(Map result, List list) { |
83 for (int i = 0; i < list.length; i += 2) { | 92 for (int i = 0; i < list.length; i += 2) { |
84 result[list[i]] = list[i + 1]; | 93 result[list[i]] = list[i + 1]; |
85 } | 94 } |
86 } | 95 } |
87 | 96 |
88 static bool isMap(obj) => obj is Map; | 97 static bool isMap(obj) => obj is Map; |
89 | 98 |
90 static List toListIfIterable(obj) => obj is Iterable ? obj.toList() : null; | 99 static List toListIfIterable(obj) => obj is Iterable ? obj.toList() : null; |
91 | 100 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 _scheduleImmediateHelper._schedule(callback); | 604 _scheduleImmediateHelper._schedule(callback); |
596 }; | 605 }; |
597 | 606 |
598 get _pureIsolateScheduleImmediateClosure => ((void callback()) => | 607 get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
599 throw new UnimplementedError("scheduleMicrotask in background isolates " | 608 throw new UnimplementedError("scheduleMicrotask in background isolates " |
600 "are not supported in the browser")); | 609 "are not supported in the browser")); |
601 | 610 |
602 void _initializeCustomElement(Element e) { | 611 void _initializeCustomElement(Element e) { |
603 _Utils.initializeCustomElement(e); | 612 _Utils.initializeCustomElement(e); |
604 } | 613 } |
OLD | NEW |