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

Unified Diff: runtime/vm/scopes.cc

Issue 8983034: Getting value of local variables on stack trace (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 12 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/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.cc
===================================================================
--- runtime/vm/scopes.cc (revision 2970)
+++ runtime/vm/scopes.cc (working copy)
@@ -173,24 +173,21 @@
}
-static int CompareVariableRanges(
- LocalVariable* const* a, LocalVariable* const* b) {
- if ((*a)->token_index() < (*b)->token_index()) return -1;
- if ((*a)->token_index() > (*b)->token_index()) return 1;
- return 0;
-}
-
-
RawLocalVarDescriptors* LocalScope::GetVarDescriptors() {
GrowableArray<LocalVariable*> vars(8);
CollectLocalVariables(&vars);
- vars.Sort(&CompareVariableRanges);
const LocalVarDescriptors& var_desc =
LocalVarDescriptors::Handle(LocalVarDescriptors::New(vars.length()));
+ intptr_t scope_id = -1;
+ LocalScope* current_scope = NULL;
for (int i = 0; i < vars.length(); i++) {
LocalVariable* var = vars[i];
+ if (current_scope != var->owner()) {
+ current_scope = var->owner();
+ scope_id += 1;
+ }
siva 2012/01/05 02:01:45 This seems kind of fragile as it assumes that all
hausner 2012/01/05 22:33:21 True. CollectLocalVariables() function below makes
var_desc.SetVar(i, var->name(), var->index(),
- var->token_index(), var->owner()->end_token_index());
+ scope_id, var->token_index(), var->owner()->end_token_index());
}
return var_desc.raw();
}
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698