OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 | 23 |
24 LocalScope::LocalScope(LocalScope* parent, int function_level, int loop_level) | 24 LocalScope::LocalScope(LocalScope* parent, int function_level, int loop_level) |
25 : parent_(parent), | 25 : parent_(parent), |
26 child_(NULL), | 26 child_(NULL), |
27 sibling_(NULL), | 27 sibling_(NULL), |
28 function_level_(function_level), | 28 function_level_(function_level), |
29 loop_level_(loop_level), | 29 loop_level_(loop_level), |
30 context_level_(LocalScope::kUnitializedContextLevel), | 30 context_level_(LocalScope::kUnitializedContextLevel), |
31 num_context_variables_(0), | 31 num_context_variables_(0), |
32 begin_token_pos_(Scanner::kNoSourcePos), | 32 begin_token_pos_(Token::kNoSourcePos), |
33 end_token_pos_(Scanner::kNoSourcePos), | 33 end_token_pos_(Token::kNoSourcePos), |
34 variables_(), | 34 variables_(), |
35 labels_(), | 35 labels_(), |
36 referenced_() { | 36 referenced_() { |
37 // Hook this node into the children of the parent, unless the parent has a | 37 // Hook this node into the children of the parent, unless the parent has a |
38 // different function_level, since the local scope of a nested function can | 38 // different function_level, since the local scope of a nested function can |
39 // be discarded after it has been parsed. | 39 // be discarded after it has been parsed. |
40 if ((parent != NULL) && (parent->function_level() == function_level)) { | 40 if ((parent != NULL) && (parent->function_level() == function_level)) { |
41 sibling_ = parent->child_; | 41 sibling_ = parent->child_; |
42 parent->child_ = this; | 42 parent->child_ = this; |
43 } | 43 } |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return fixed_parameter_count - (index() - kParamEndSlotFromFp); | 668 return fixed_parameter_count - (index() - kParamEndSlotFromFp); |
669 } else { | 669 } else { |
670 // Shift negative indexes so that the lowest one is 0 (they are still | 670 // Shift negative indexes so that the lowest one is 0 (they are still |
671 // non-positive). | 671 // non-positive). |
672 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); | 672 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); |
673 } | 673 } |
674 } | 674 } |
675 | 675 |
676 | 676 |
677 } // namespace dart | 677 } // namespace dart |
OLD | NEW |