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

Unified Diff: runtime/vm/ast_printer.cc

Issue 293013005: Fix issue 18435 (2nd attempt). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/vm/ast_printer.h ('k') | runtime/vm/code_generator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast_printer.cc
===================================================================
--- runtime/vm/ast_printer.cc (revision 36398)
+++ runtime/vm/ast_printer.cc (working copy)
@@ -391,29 +391,37 @@
}
+void AstPrinter::PrintLocalScopeVariable(const LocalScope* scope,
+ LocalVariable* var) {
+ ASSERT(scope != NULL);
+ ASSERT(var != NULL);
+ OS::Print("(%s%s '%s'",
+ var->is_final() ? "final " : "",
+ String::Handle(var->type().Name()).ToCString(),
+ var->name().ToCString());
+ if (var->owner() != scope) {
+ OS::Print(" alias");
+ }
+ if (var->HasIndex()) {
+ OS::Print(" @%d", var->index());
+ if (var->is_captured()) {
+ OS::Print(" ctx %d", var->owner()->context_level());
+ }
+ } else if (var->owner()->function_level() != 0) {
+ OS::Print(" lev %d", var->owner()->function_level());
+ }
+ OS::Print(" valid %" Pd "-%" Pd ")",
+ var->token_pos(),
+ scope->end_token_pos());
+}
+
+
void AstPrinter::PrintLocalScope(const LocalScope* scope,
int start_index) {
ASSERT(scope != NULL);
for (int i = start_index; i < scope->num_variables(); i++) {
LocalVariable* var = scope->VariableAt(i);
- OS::Print("(%s%s '%s'",
- var->is_final() ? "final " : "",
- String::Handle(var->type().Name()).ToCString(),
- var->name().ToCString());
- if (var->owner() != scope) {
- OS::Print(" alias");
- }
- if (var->HasIndex()) {
- OS::Print(" @%d", var->index());
- if (var->is_captured()) {
- OS::Print(" ctx %d", var->owner()->context_level());
- }
- } else if (var->owner()->function_level() != 0) {
- OS::Print(" lev %d", var->owner()->function_level());
- }
- OS::Print(" valid %" Pd "-%" Pd ")",
- var->token_pos(),
- scope->end_token_pos());
+ PrintLocalScopeVariable(scope, var);
}
const LocalScope* child = scope->child();
while (child != NULL) {
@@ -455,7 +463,7 @@
int pos = 0; // Current position of variable in scope.
while (pos < num_params) {
LocalVariable* param = scope->VariableAt(pos);
- ASSERT(param->owner() == scope);
+ ASSERT(param->owner() == scope); // No aliases should precede parameters.
OS::Print("(param %s%s '%s'",
param->is_final() ? "final " : "",
String::Handle(param->type().Name()).ToCString(),
« no previous file with comments | « runtime/vm/ast_printer.h ('k') | runtime/vm/code_generator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698