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

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

Issue 10832126: Store pointer instead of reference to LocalVariable in ast and flow graph. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/parser.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/ast.h" 7 #include "vm/ast.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/parser.h" 10 #include "vm/parser.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (current_scope == scope) { 51 if (current_scope == scope) {
52 return true; 52 return true;
53 } 53 }
54 current_scope = current_scope->parent(); 54 current_scope = current_scope->parent();
55 } 55 }
56 return false; 56 return false;
57 } 57 }
58 58
59 59
60 bool LocalScope::AddVariable(LocalVariable* variable) { 60 bool LocalScope::AddVariable(LocalVariable* variable) {
61 ASSERT(variable != NULL);
61 if (LocalLookupVariable(variable->name()) != NULL) { 62 if (LocalLookupVariable(variable->name()) != NULL) {
62 return false; 63 return false;
63 } 64 }
64 variables_.Add(variable); 65 variables_.Add(variable);
65 if (variable->owner() == NULL) { 66 if (variable->owner() == NULL) {
66 // Variables must be added to their owner scope first. Subsequent calls 67 // Variables must be added to their owner scope first. Subsequent calls
67 // to 'add' treat the variable as an alias. 68 // to 'add' treat the variable as an alias.
68 variable->set_owner(this); 69 variable->set_owner(this);
69 } 70 }
70 return true; 71 return true;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } else { 552 } else {
552 // Shift negative indexes so that the lowest one is 0 (they are still 553 // Shift negative indexes so that the lowest one is 0 (they are still
553 // non-positive). 554 // non-positive).
554 return fixed_parameter_count - 555 return fixed_parameter_count -
555 (index() - ParsedFunction::kFirstLocalSlotIndex); 556 (index() - ParsedFunction::kFirstLocalSlotIndex);
556 } 557 }
557 } 558 }
558 559
559 560
560 } // namespace dart 561 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698