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

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

Issue 288343005: Revert bad fix. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scopes.h ('k') | tests/language/regress_18435_test.dart » ('j') | 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 while (current_scope != NULL) { 44 while (current_scope != NULL) {
45 if (current_scope == scope) { 45 if (current_scope == scope) {
46 return true; 46 return true;
47 } 47 }
48 current_scope = current_scope->parent(); 48 current_scope = current_scope->parent();
49 } 49 }
50 return false; 50 return false;
51 } 51 }
52 52
53 53
54 void LocalScope::Clear() {
55 variables_.Clear();
56 }
57
58
59 bool LocalScope::AddVariable(LocalVariable* variable) { 54 bool LocalScope::AddVariable(LocalVariable* variable) {
60 ASSERT(variable != NULL); 55 ASSERT(variable != NULL);
61 if (LocalLookupVariable(variable->name()) != NULL) { 56 if (LocalLookupVariable(variable->name()) != NULL) {
62 return false; 57 return false;
63 } 58 }
64 variables_.Add(variable); 59 variables_.Add(variable);
65 if (variable->owner() == NULL) { 60 if (variable->owner() == NULL) {
66 // Variables must be added to their owner scope first. Subsequent calls 61 // Variables must be added to their owner scope first. Subsequent calls
67 // to 'add' treat the variable as an alias. 62 // to 'add' treat the variable as an alias.
68 variable->set_owner(this); 63 variable->set_owner(this);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 return fixed_parameter_count - (index() - kParamEndSlotFromFp); 631 return fixed_parameter_count - (index() - kParamEndSlotFromFp);
637 } else { 632 } else {
638 // Shift negative indexes so that the lowest one is 0 (they are still 633 // Shift negative indexes so that the lowest one is 0 (they are still
639 // non-positive). 634 // non-positive).
640 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); 635 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp);
641 } 636 }
642 } 637 }
643 638
644 639
645 } // namespace dart 640 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scopes.h ('k') | tests/language/regress_18435_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698