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

Unified Diff: runtime/observatory/lib/src/elements/script_inset.dart

Issue 1126363005: Show tooltip with local variable value in Observatory debugger (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 | « runtime/observatory/lib/src/elements/debugger.html ('k') | runtime/observatory/lib/src/service/object.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/elements/script_inset.dart
diff --git a/runtime/observatory/lib/src/elements/script_inset.dart b/runtime/observatory/lib/src/elements/script_inset.dart
index 164c134a0b654b689b710d3a2a2736148faec24e..f2610bc7f0181c20bd6909d283e616c38cad43fb 100644
--- a/runtime/observatory/lib/src/elements/script_inset.dart
+++ b/runtime/observatory/lib/src/elements/script_inset.dart
@@ -9,6 +9,7 @@ import 'dart:html';
import 'observatory_element.dart';
import 'service_ref.dart';
import 'package:observatory/service.dart';
+import 'package:observatory/utils.dart';
import 'package:polymer/polymer.dart';
const nbsp = "\u00A0";
@@ -95,6 +96,24 @@ class CurrentExecutionAnnotation extends Annotation {
}
}
+class LocalVariableAnnotation extends Annotation {
+ final value;
+
+ LocalVariableAnnotation(LocalVarLocation location, this.value) {
+ line = location.line;
+ columnStart = location.column;
+ columnStop = location.endColumn;
+ }
+
+ void applyStyleTo(element) {
+ if (element == null) {
+ return; // TODO(rmacnak): Handling overlapping annotations.
+ }
+ element.style.fontWeight = "bold";
+ element.title = "${value.shortName}";
+ }
+}
+
class CallSiteAnnotation extends Annotation {
CallSite callSite;
@@ -219,6 +238,7 @@ class ScriptInsetElement extends ObservatoryElement {
@published int startPos;
@published int endPos;
@published bool inDebuggerContext = false;
+ @published ObservableList variables;
int _currentLine;
int _currentCol;
@@ -251,20 +271,24 @@ class ScriptInsetElement extends ObservatoryElement {
}
void currentPosChanged(oldValue) {
- update();
+ _updateTask.queue();
_scrollToCurrentPos();
}
void startPosChanged(oldValue) {
- update();
+ _updateTask.queue();
}
void endPosChanged(oldValue) {
- update();
+ _updateTask.queue();
}
void scriptChanged(oldValue) {
- update();
+ _updateTask.queue();
+ }
+
+ void variablesChanged(oldValue) {
+ _updateTask.queue();
}
Element a(String text) => new AnchorElement()..text = text;
@@ -288,7 +312,9 @@ class ScriptInsetElement extends ObservatoryElement {
Element container;
+ Task _updateTask;
void update() {
+ assert(_updateTask != null);
if (script == null) {
// We may have previously had a script.
if (container != null) {
@@ -377,6 +403,22 @@ class ScriptInsetElement extends ObservatoryElement {
}
}
+ // We have local variable information.
+ if (variables != null) {
+ // For each variable.
+ for (var variable in variables) {
+ // Find variable usage locations.
+ var locations = script.scanForLocalVariableLocations(
+ variable['name'], variable['tokenPos'], variable['endTokenPos']);
+
+ // Annotate locations.
+ for (var location in locations) {
+ annotations.add(new LocalVariableAnnotation(location,
+ variable['value']));
+ }
+ }
+ }
+
annotations.sort();
}
@@ -561,5 +603,8 @@ class ScriptInsetElement extends ObservatoryElement {
return e;
}
- ScriptInsetElement.created() : super.created();
+ ScriptInsetElement.created()
+ : super.created() {
+ _updateTask = new Task(update);
+ }
}
« no previous file with comments | « runtime/observatory/lib/src/elements/debugger.html ('k') | runtime/observatory/lib/src/service/object.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698