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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 for (int i = 0; i < vars.length(); i++) { | 207 for (int i = 0; i < vars.length(); i++) { |
208 var_desc.SetVar(i, *(vars[i].name), &vars[i].info); | 208 var_desc.SetVar(i, *(vars[i].name), &vars[i].info); |
209 } | 209 } |
210 return var_desc.raw(); | 210 return var_desc.raw(); |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 // The parser creates internal variables that start with ":" | 214 // The parser creates internal variables that start with ":" |
215 static bool IsInternalIdentifier(const String& str) { | 215 static bool IsInternalIdentifier(const String& str) { |
216 ASSERT(str.Length() > 0); | 216 ASSERT(str.Length() > 0); |
217 return str.CharAt(0) == ':'; | 217 return str.CodeUnitAt(0) == ':'; |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 // Add variables that are declared in this scope to vars, then collect | 221 // Add variables that are declared in this scope to vars, then collect |
222 // variables of children, followed by siblings. | 222 // variables of children, followed by siblings. |
223 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars, | 223 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars, |
224 int16_t* scope_id) { | 224 int16_t* scope_id) { |
225 (*scope_id)++; | 225 (*scope_id)++; |
226 if (HasContextLevel() && | 226 if (HasContextLevel() && |
227 ((parent() == NULL) || | 227 ((parent() == NULL) || |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } else { | 551 } else { |
552 // Shift negative indexes so that the lowest one is 0 (they are still | 552 // Shift negative indexes so that the lowest one is 0 (they are still |
553 // non-positive). | 553 // non-positive). |
554 return fixed_parameter_count - | 554 return fixed_parameter_count - |
555 (index() - ParsedFunction::kFirstLocalSlotIndex); | 555 (index() - ParsedFunction::kFirstLocalSlotIndex); |
556 } | 556 } |
557 } | 557 } |
558 | 558 |
559 | 559 |
560 } // namespace dart | 560 } // namespace dart |
OLD | NEW |