Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: tests/compiler/dart2js/sourcemaps/trace_graph.dart

Issue 2431223006: Add stacktrace_test (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/stacktrace_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 sourcemap.trace_graph; 5 library sourcemap.trace_graph;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:compiler/src/io/source_information.dart'; 9 import 'package:compiler/src/io/source_information.dart';
10 import 'package:compiler/src/io/position_information.dart'; 10 import 'package:compiler/src/io/position_information.dart';
11 import 'package:compiler/src/js/js_debug.dart'; 11 import 'package:compiler/src/js/js_debug.dart';
12 12
13 import 'sourcemap_html_helper.dart'; 13 import 'sourcemap_html_helper.dart';
14 14
15 class TraceGraph { 15 class TraceGraph {
16 List<TraceStep> steps = <TraceStep>[]; 16 List<TraceStep> steps = <TraceStep>[];
17 TraceStep entry; 17 TraceStep entry;
18 Queue stack = new Queue(); 18 Queue stack = new Queue();
19 Map<int, TraceStep> offsetMap = {}; 19 Map<int, TraceStep> offsetMap = {};
20 20
21 void addStep(TraceStep step) { 21 void addStep(TraceStep step) {
22 steps.add(step); 22 steps.add(step);
23 int offset = step.offset.subexpressionOffset; 23 int offset = step.offset.value;
24 TraceStep existingStep = offsetMap[offset]; 24 TraceStep existingStep = offsetMap[offset];
25 if (existingStep != null) { 25 if (existingStep != null) {
26 // TODO(johnniwinther): Fix problems with reuse of JS nodes from 26 // TODO(johnniwinther): Fix problems with reuse of JS nodes from
27 // templates. 27 // templates.
28 if (identical(existingStep.node, step.node)) { 28 if (identical(existingStep.node, step.node)) {
29 print('duplicate node: ${nodeToString(step.node)}'); 29 print('duplicate node: ${nodeToString(step.node)}');
30 } else { 30 } else {
31 print('duplicate offset: ${offset} : ${nodeToString(step.node)}'); 31 print('duplicate offset: ${offset} : ${nodeToString(step.node)}');
32 } 32 }
33 print(' ${existingStep.id}:${existingStep.text}:${existingStep.offset}'); 33 print(' ${existingStep.id}:${existingStep.text}:${existingStep.offset}');
(...skipping 23 matching lines...) Expand all
57 TraceStep next; 57 TraceStep next;
58 Map<dynamic, TraceStep> branchMap; 58 Map<dynamic, TraceStep> branchMap;
59 59
60 List stack; 60 List stack;
61 61
62 TraceStep(this.kind, this.id, this.node, this.offset, this.text, 62 TraceStep(this.kind, this.id, this.node, this.offset, this.text,
63 [this.sourceLocation]); 63 [this.sourceLocation]);
64 64
65 String toString() => '<span style="background:${toColorCss(id)}">$id</span>'; 65 String toString() => '<span style="background:${toColorCss(id)}">$id</span>';
66 } 66 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/stacktrace_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698