| 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 #ifndef VM_SCOPES_H_ | 5 #ifndef VM_SCOPES_H_ |
| 6 #define VM_SCOPES_H_ | 6 #define VM_SCOPES_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // statement. | 276 // statement. |
| 277 SourceLabel* LookupInnermostLabel(Token::Kind jump_kind); | 277 SourceLabel* LookupInnermostLabel(Token::Kind jump_kind); |
| 278 | 278 |
| 279 // Lookup the label for the "innermost" catch block if one exists. | 279 // Lookup the label for the "innermost" catch block if one exists. |
| 280 SourceLabel* LookupInnermostCatchLabel(); | 280 SourceLabel* LookupInnermostCatchLabel(); |
| 281 | 281 |
| 282 // Lookup scope of outer switch statement at same function level. | 282 // Lookup scope of outer switch statement at same function level. |
| 283 // Returns NULL if this scope is not embedded in a switch. | 283 // Returns NULL if this scope is not embedded in a switch. |
| 284 LocalScope* LookupSwitchScope(); | 284 LocalScope* LookupSwitchScope(); |
| 285 | 285 |
| 286 // Looks up variable in this scope and mark as captured if applicable. |
| 287 // Finds the variable even if it is marked invisible. |
| 288 void CaptureVariable(const String& name); |
| 289 |
| 286 // Look for unresolved forward references to labels in this scope. | 290 // Look for unresolved forward references to labels in this scope. |
| 287 // If there are any, propagate the forward reference to the next | 291 // If there are any, propagate the forward reference to the next |
| 288 // outer scope of a switch statement. If there is no outer switch | 292 // outer scope of a switch statement. If there is no outer switch |
| 289 // statement, return the first unresolved label found. | 293 // statement, return the first unresolved label found. |
| 290 SourceLabel* CheckUnresolvedLabels(); | 294 SourceLabel* CheckUnresolvedLabels(); |
| 291 | 295 |
| 292 // Accessing the variables in the scope. | 296 // Accessing the variables in the scope. |
| 293 intptr_t num_variables() const { return variables_.length(); } | 297 intptr_t num_variables() const { return variables_.length(); } |
| 294 LocalVariable* VariableAt(intptr_t index) const { | 298 LocalVariable* VariableAt(intptr_t index) const { |
| 295 ASSERT((index >= 0) && (index < variables_.length())); | 299 ASSERT((index >= 0) && (index < variables_.length())); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 intptr_t end_token_pos_; // Token index of end of scope. | 364 intptr_t end_token_pos_; // Token index of end of scope. |
| 361 GrowableArray<LocalVariable*> variables_; | 365 GrowableArray<LocalVariable*> variables_; |
| 362 GrowableArray<SourceLabel*> labels_; | 366 GrowableArray<SourceLabel*> labels_; |
| 363 | 367 |
| 364 DISALLOW_COPY_AND_ASSIGN(LocalScope); | 368 DISALLOW_COPY_AND_ASSIGN(LocalScope); |
| 365 }; | 369 }; |
| 366 | 370 |
| 367 } // namespace dart | 371 } // namespace dart |
| 368 | 372 |
| 369 #endif // VM_SCOPES_H_ | 373 #endif // VM_SCOPES_H_ |
| OLD | NEW |