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

Unified Diff: src/ast/scopes.cc

Issue 2551943003: Fix crash in --print-scopes when Scope::variables_ is empty (Closed)
Patch Set: Simplify Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 1cb3af312d19875ed8c58f927173491f990f6767..404e5075ade835db1469fc6916f4ec0dfe197cd5 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -1508,8 +1508,10 @@ void Scope::Print(int n) {
PrintVar(n1, function);
}
- PrintMap(n1, "// local vars:\n", &variables_, true, function);
- PrintMap(n1, "// dynamic vars:\n", &variables_, false, function);
+ if (variables_.occupancy() > 0) {
+ PrintMap(n1, "// local vars:\n", &variables_, true, function);
+ PrintMap(n1, "// dynamic vars:\n", &variables_, false, function);
+ }
// Print inner scopes (disable by providing negative n).
if (n >= 0) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698