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 "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 bool* found_captured_variables); | 311 bool* found_captured_variables); |
312 | 312 |
313 // Creates variable info for the scope and all its nested scopes. | 313 // Creates variable info for the scope and all its nested scopes. |
314 // Must be called after AllocateVariables() has been called. | 314 // Must be called after AllocateVariables() has been called. |
315 RawLocalVarDescriptors* GetVarDescriptors(const Function& func); | 315 RawLocalVarDescriptors* GetVarDescriptors(const Function& func); |
316 | 316 |
317 // Create a ContextScope object describing all captured variables referenced | 317 // Create a ContextScope object describing all captured variables referenced |
318 // from this scope and belonging to outer scopes. | 318 // from this scope and belonging to outer scopes. |
319 RawContextScope* PreserveOuterScope(int current_context_level) const; | 319 RawContextScope* PreserveOuterScope(int current_context_level) const; |
320 | 320 |
| 321 |
| 322 // Recursively traverses all siblings and children and marks all variables as |
| 323 // captured. |
| 324 void RecursivelyCaptureAllVariables(); |
| 325 |
321 // Creates a LocalScope representing the outer scope of a local function to be | 326 // Creates a LocalScope representing the outer scope of a local function to be |
322 // compiled. This outer scope contains the variables captured by the function | 327 // compiled. This outer scope contains the variables captured by the function |
323 // as specified by the given ContextScope, which was created during the | 328 // as specified by the given ContextScope, which was created during the |
324 // compilation of the enclosing function. | 329 // compilation of the enclosing function. |
325 static LocalScope* RestoreOuterScope(const ContextScope& context_scope); | 330 static LocalScope* RestoreOuterScope(const ContextScope& context_scope); |
326 | 331 |
327 // Create a ContextScope object which will capture "this" for an implicit | 332 // Create a ContextScope object which will capture "this" for an implicit |
328 // closure object. | 333 // closure object. |
329 static RawContextScope* CreateImplicitClosureScope(const Function& func); | 334 static RawContextScope* CreateImplicitClosureScope(const Function& func); |
330 | 335 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // List of names referenced in this scope and its children that | 367 // List of names referenced in this scope and its children that |
363 // are not resolved to local variables. | 368 // are not resolved to local variables. |
364 GrowableArray<NameReference*> referenced_; | 369 GrowableArray<NameReference*> referenced_; |
365 | 370 |
366 DISALLOW_COPY_AND_ASSIGN(LocalScope); | 371 DISALLOW_COPY_AND_ASSIGN(LocalScope); |
367 }; | 372 }; |
368 | 373 |
369 } // namespace dart | 374 } // namespace dart |
370 | 375 |
371 #endif // VM_SCOPES_H_ | 376 #endif // VM_SCOPES_H_ |
OLD | NEW |