| 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/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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 ContextScope::Handle(func.context_scope()); | 188 ContextScope::Handle(func.context_scope()); |
| 189 if (!context_scope.IsNull()) { | 189 if (!context_scope.IsNull()) { |
| 190 ASSERT(func.IsLocalFunction()); | 190 ASSERT(func.IsLocalFunction()); |
| 191 for (int i = 0; i < context_scope.num_variables(); i++) { | 191 for (int i = 0; i < context_scope.num_variables(); i++) { |
| 192 VarDesc desc; | 192 VarDesc desc; |
| 193 desc.name = &String::Handle(context_scope.NameAt(i)); | 193 desc.name = &String::Handle(context_scope.NameAt(i)); |
| 194 desc.info.kind = RawLocalVarDescriptors::kContextVar; | 194 desc.info.kind = RawLocalVarDescriptors::kContextVar; |
| 195 desc.info.scope_id = context_scope.ContextLevelAt(i); | 195 desc.info.scope_id = context_scope.ContextLevelAt(i); |
| 196 desc.info.begin_pos = begin_token_pos(); | 196 desc.info.begin_pos = begin_token_pos(); |
| 197 desc.info.end_pos = end_token_pos(); | 197 desc.info.end_pos = end_token_pos(); |
| 198 ASSERT(desc.info.begin_pos <= desc.info.end_pos); |
| 198 desc.info.index = context_scope.ContextIndexAt(i); | 199 desc.info.index = context_scope.ContextIndexAt(i); |
| 199 vars.Add(desc); | 200 vars.Add(desc); |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 // Now collect all variables from local scopes. | 203 // Now collect all variables from local scopes. |
| 203 int16_t scope_id = 0; | 204 int16_t scope_id = 0; |
| 204 CollectLocalVariables(&vars, &scope_id); | 205 CollectLocalVariables(&vars, &scope_id); |
| 205 | 206 |
| 206 const LocalVarDescriptors& var_desc = | 207 const LocalVarDescriptors& var_desc = |
| 207 LocalVarDescriptors::Handle(LocalVarDescriptors::New(vars.length())); | 208 LocalVarDescriptors::Handle(LocalVarDescriptors::New(vars.length())); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 return fixed_parameter_count - (index() - kParamEndSlotFromFp); | 576 return fixed_parameter_count - (index() - kParamEndSlotFromFp); |
| 576 } else { | 577 } else { |
| 577 // Shift negative indexes so that the lowest one is 0 (they are still | 578 // Shift negative indexes so that the lowest one is 0 (they are still |
| 578 // non-positive). | 579 // non-positive). |
| 579 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); | 580 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); |
| 580 } | 581 } |
| 581 } | 582 } |
| 582 | 583 |
| 583 | 584 |
| 584 } // namespace dart | 585 } // namespace dart |
| OLD | NEW |