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

Side by Side Diff: runtime/vm/scopes.cc

Issue 1026963002: Fix generation of context level descriptors (issue 22391). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/ast_printer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/scopes.h" 5 #include "vm/scopes.h"
6 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/stack_frame.h" 8 #include "vm/stack_frame.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 10
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 ASSERT(str.Length() > 0); 289 ASSERT(str.Length() > 0);
290 return str.CharAt(0) == ':'; 290 return str.CharAt(0) == ':';
291 } 291 }
292 292
293 293
294 // Add visible variables that are declared in this scope to vars, then 294 // Add visible variables that are declared in this scope to vars, then
295 // collect visible variables of children, followed by siblings. 295 // collect visible variables of children, followed by siblings.
296 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars, 296 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars,
297 int16_t* scope_id) { 297 int16_t* scope_id) {
298 (*scope_id)++; 298 (*scope_id)++;
299 if (HasContextLevel() && 299 if (num_context_variables() > 0) {
300 ((parent() == NULL) ||
301 (!parent()->HasContextLevel()) ||
302 (parent()->context_level() != context_level()))) {
303 // This is the outermost scope with a context level or this scope's
304 // context level differs from its parent's level.
305 VarDesc desc; 300 VarDesc desc;
306 desc.name = &Symbols::Empty(); // No name. 301 desc.name = &Symbols::Empty(); // No name.
307 desc.info.set_kind(RawLocalVarDescriptors::kContextLevel); 302 desc.info.set_kind(RawLocalVarDescriptors::kContextLevel);
308 desc.info.scope_id = *scope_id; 303 desc.info.scope_id = *scope_id;
309 desc.info.begin_pos = begin_token_pos(); 304 desc.info.begin_pos = begin_token_pos();
310 desc.info.end_pos = end_token_pos(); 305 desc.info.end_pos = end_token_pos();
311 desc.info.set_index(context_level()); 306 desc.info.set_index(context_level());
312 vars->Add(desc); 307 vars->Add(desc);
313 } 308 }
314 for (int i = 0; i < this->variables_.length(); i++) { 309 for (int i = 0; i < this->variables_.length(); i++) {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 return fixed_parameter_count - (index() - kParamEndSlotFromFp); 662 return fixed_parameter_count - (index() - kParamEndSlotFromFp);
668 } else { 663 } else {
669 // Shift negative indexes so that the lowest one is 0 (they are still 664 // Shift negative indexes so that the lowest one is 0 (they are still
670 // non-positive). 665 // non-positive).
671 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); 666 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp);
672 } 667 }
673 } 668 }
674 669
675 670
676 } // namespace dart 671 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast_printer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698