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

Unified Diff: tests/compiler/dart2js/sourcemaps/trace_graph.dart

Issue 1617083002: Base JavaScript code position computation on JavaScript tracer. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/sourcemaps/trace_graph.dart
diff --git a/tests/compiler/dart2js/sourcemaps/trace_graph.dart b/tests/compiler/dart2js/sourcemaps/trace_graph.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b21014bc7350f3de2de8156d3c85665347c7a300
--- /dev/null
+++ b/tests/compiler/dart2js/sourcemaps/trace_graph.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library sourcemap.trace_graph;
+
+import 'dart:collection';
+
+import 'package:compiler/src/io/source_information.dart';
+import 'package:compiler/src/io/position_information.dart';
+
+import 'sourcemap_html_helper.dart';
+
+class TraceGraph {
+ List<TraceStep> steps = <TraceStep>[];
+ TraceStep entry;
+ Queue stack = new Queue();
+
+ void addStep(TraceStep step) {
+ steps.add(step);
+ step.stack = stack.toList();
+ }
+
+ void pushBranch(branch) {
+ stack.addLast(branch);
+ }
+
+ void popBranch() {
+ stack.removeLast();
+ }
+}
+
+class TraceStep {
+ final int id;
+ final node;
+ final Offset offset;
+ final List text;
+ final SourceLocation sourceLocation;
+
+ TraceStep next;
+ Map<dynamic, TraceStep> branchMap;
+
+ List stack;
+
+ TraceStep(
+ this.id,
+ this.node,
+ this.offset,
+ this.text,
+ [this.sourceLocation]);
+
+ String toString() => '<span style="background:${toColorCss(id)}">$id</span>';
+}
+
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/sourcemap_html_helper.dart ('k') | tests/compiler/dart2js/type_representation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698