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

Unified Diff: pkg/compiler/lib/src/js/js_debug.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
« no previous file with comments | « pkg/compiler/lib/src/js/js.dart ('k') | pkg/compiler/lib/src/js/js_source_mapping.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js/js_debug.dart
diff --git a/pkg/compiler/lib/src/js/js_debug.dart b/pkg/compiler/lib/src/js/js_debug.dart
index 43ec1309d03b492d2feecec4ad84de60f69c2a74..c8cbd0de1636c1b6e7aeb8cb20bcd54bc9209e4a 100644
--- a/pkg/compiler/lib/src/js/js_debug.dart
+++ b/pkg/compiler/lib/src/js/js_debug.dart
@@ -7,7 +7,12 @@
library js.debug;
import 'package:js_ast/js_ast.dart';
-import '../util/util.dart' show Indentation, Tagging;
+
+import '../io/code_output.dart' show
+ BufferedCodeOutput;
+import '../util/util.dart' show
+ Indentation,
+ Tagging;
/// Unparse the JavaScript [node].
String nodeToString(Node node) {
@@ -25,8 +30,8 @@ String nodeToString(Node node) {
class DebugPrinter extends BaseVisitor with Indentation, Tagging<Node> {
StringBuffer sb = new StringBuffer();
- void visitNodeWithChildren(Node node, String type) {
- openNode(node, type);
+ void visitNodeWithChildren(Node node, String type, [Map params]) {
+ openNode(node, type, params);
node.visitChildren(this);
closeNode();
}
@@ -42,6 +47,11 @@ class DebugPrinter extends BaseVisitor with Indentation, Tagging<Node> {
}
@override
+ void visitBinary(Binary node) {
+ visitNodeWithChildren(node, '${node.runtimeType}', {'op': node.op});
+ }
+
+ @override
void visitLiteralString(LiteralString node) {
openAndCloseNode(node, '${node.runtimeType}', {'value': node.value});
}
@@ -57,7 +67,8 @@ class DebugPrinter extends BaseVisitor with Indentation, Tagging<Node> {
}
/// Simple printing context that doesn't throw on errors.
-class LenientPrintingContext extends SimpleJavaScriptPrintingContext {
+class LenientPrintingContext extends SimpleJavaScriptPrintingContext
+ implements BufferedCodeOutput {
@override
void error(String message) {
buffer.write('>>$message<<');
« no previous file with comments | « pkg/compiler/lib/src/js/js.dart ('k') | pkg/compiler/lib/src/js/js_source_mapping.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698