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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 286 // Looks up variable in this scope and mark as captured if applicable. |
287 // Finds the variable even if it is marked invisible. | 287 // Finds the variable even if it is marked invisible. Returns true if |
288 void CaptureVariable(const String& name); | 288 // the variable was found, false if it was not found. |
| 289 bool CaptureVariable(const String& name); |
289 | 290 |
290 // Look for unresolved forward references to labels in this scope. | 291 // Look for unresolved forward references to labels in this scope. |
291 // If there are any, propagate the forward reference to the next | 292 // If there are any, propagate the forward reference to the next |
292 // outer scope of a switch statement. If there is no outer switch | 293 // outer scope of a switch statement. If there is no outer switch |
293 // statement, return the first unresolved label found. | 294 // statement, return the first unresolved label found. |
294 SourceLabel* CheckUnresolvedLabels(); | 295 SourceLabel* CheckUnresolvedLabels(); |
295 | 296 |
296 // Accessing the variables in the scope. | 297 // Accessing the variables in the scope. |
297 intptr_t num_variables() const { return variables_.length(); } | 298 intptr_t num_variables() const { return variables_.length(); } |
298 LocalVariable* VariableAt(intptr_t index) const { | 299 LocalVariable* VariableAt(intptr_t index) const { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 intptr_t end_token_pos_; // Token index of end of scope. | 365 intptr_t end_token_pos_; // Token index of end of scope. |
365 GrowableArray<LocalVariable*> variables_; | 366 GrowableArray<LocalVariable*> variables_; |
366 GrowableArray<SourceLabel*> labels_; | 367 GrowableArray<SourceLabel*> labels_; |
367 | 368 |
368 DISALLOW_COPY_AND_ASSIGN(LocalScope); | 369 DISALLOW_COPY_AND_ASSIGN(LocalScope); |
369 }; | 370 }; |
370 | 371 |
371 } // namespace dart | 372 } // namespace dart |
372 | 373 |
373 #endif // VM_SCOPES_H_ | 374 #endif // VM_SCOPES_H_ |
OLD | NEW |