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

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

Issue 295803003: Fix issue 18435. (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
54 bool LocalScope::AddVariable(LocalVariable* variable) { 59 bool LocalScope::AddVariable(LocalVariable* variable) {
55 ASSERT(variable != NULL); 60 ASSERT(variable != NULL);
56 if (LocalLookupVariable(variable->name()) != NULL) { 61 if (LocalLookupVariable(variable->name()) != NULL) {
57 return false; 62 return false;
58 } 63 }
59 variables_.Add(variable); 64 variables_.Add(variable);
60 if (variable->owner() == NULL) { 65 if (variable->owner() == NULL) {
61 // Variables must be added to their owner scope first. Subsequent calls 66 // Variables must be added to their owner scope first. Subsequent calls
62 // to 'add' treat the variable as an alias. 67 // to 'add' treat the variable as an alias.
63 variable->set_owner(this); 68 variable->set_owner(this);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 return fixed_parameter_count - (index() - kParamEndSlotFromFp); 636 return fixed_parameter_count - (index() - kParamEndSlotFromFp);
632 } else { 637 } else {
633 // Shift negative indexes so that the lowest one is 0 (they are still 638 // Shift negative indexes so that the lowest one is 0 (they are still
634 // non-positive). 639 // non-positive).
635 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); 640 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp);
636 } 641 }
637 } 642 }
638 643
639 644
640 } // namespace dart 645 } // 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