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 14 matching lines...) Expand all Loading... |
25 const String& name, | 25 const String& name, |
26 const AbstractType& type) | 26 const AbstractType& type) |
27 : token_pos_(token_pos), | 27 : token_pos_(token_pos), |
28 name_(name), | 28 name_(name), |
29 owner_(NULL), | 29 owner_(NULL), |
30 type_(type), | 30 type_(type), |
31 const_value_(NULL), | 31 const_value_(NULL), |
32 is_final_(false), | 32 is_final_(false), |
33 is_captured_(false), | 33 is_captured_(false), |
34 is_invisible_(false), | 34 is_invisible_(false), |
| 35 is_captured_parameter_(false), |
35 index_(LocalVariable::kUninitializedIndex) { | 36 index_(LocalVariable::kUninitializedIndex) { |
36 ASSERT(type.IsZoneHandle()); | 37 ASSERT(type.IsZoneHandle()); |
37 ASSERT(type.IsFinalized()); | 38 ASSERT(type.IsFinalized()); |
38 ASSERT(name.IsSymbol()); | 39 ASSERT(name.IsSymbol()); |
39 } | 40 } |
40 | 41 |
41 intptr_t token_pos() const { return token_pos_; } | 42 intptr_t token_pos() const { return token_pos_; } |
42 const String& name() const { return name_; } | 43 const String& name() const { return name_; } |
43 LocalScope* owner() const { return owner_; } | 44 LocalScope* owner() const { return owner_; } |
44 void set_owner(LocalScope* owner) { | 45 void set_owner(LocalScope* owner) { |
(...skipping 21 matching lines...) Expand all Loading... |
66 void set_index(int index) { | 67 void set_index(int index) { |
67 ASSERT(index != kUninitializedIndex); | 68 ASSERT(index != kUninitializedIndex); |
68 index_ = index; | 69 index_ = index; |
69 } | 70 } |
70 | 71 |
71 void set_invisible(bool value) { | 72 void set_invisible(bool value) { |
72 is_invisible_ = value; | 73 is_invisible_ = value; |
73 } | 74 } |
74 bool is_invisible() const { return is_invisible_; } | 75 bool is_invisible() const { return is_invisible_; } |
75 | 76 |
| 77 bool is_captured_parameter() const { return is_captured_parameter_; } |
| 78 void set_is_captured_parameter(bool value) { |
| 79 is_captured_parameter_ = value; |
| 80 } |
| 81 |
76 bool IsConst() const { | 82 bool IsConst() const { |
77 return const_value_ != NULL; | 83 return const_value_ != NULL; |
78 } | 84 } |
79 | 85 |
80 void SetConstValue(const Instance& value) { | 86 void SetConstValue(const Instance& value) { |
81 ASSERT(value.IsZoneHandle() || value.IsReadOnlyHandle()); | 87 ASSERT(value.IsZoneHandle() || value.IsReadOnlyHandle()); |
82 const_value_ = &value; | 88 const_value_ = &value; |
83 } | 89 } |
84 | 90 |
85 const Instance* ConstValue() const { | 91 const Instance* ConstValue() const { |
(...skipping 17 matching lines...) Expand all Loading... |
103 LocalScope* owner_; // Local scope declaring this variable. | 109 LocalScope* owner_; // Local scope declaring this variable. |
104 | 110 |
105 const AbstractType& type_; // Declaration type of local variable. | 111 const AbstractType& type_; // Declaration type of local variable. |
106 | 112 |
107 const Instance* const_value_; // NULL or compile-time const value. | 113 const Instance* const_value_; // NULL or compile-time const value. |
108 | 114 |
109 bool is_final_; // If true, this variable is readonly. | 115 bool is_final_; // If true, this variable is readonly. |
110 bool is_captured_; // If true, this variable lives in the context, otherwise | 116 bool is_captured_; // If true, this variable lives in the context, otherwise |
111 // in the stack frame. | 117 // in the stack frame. |
112 bool is_invisible_; | 118 bool is_invisible_; |
| 119 bool is_captured_parameter_; |
113 int index_; // Allocation index in words relative to frame pointer (if not | 120 int index_; // Allocation index in words relative to frame pointer (if not |
114 // captured), or relative to the context pointer (if captured). | 121 // captured), or relative to the context pointer (if captured). |
115 | 122 |
116 friend class LocalScope; | 123 friend class LocalScope; |
117 DISALLOW_COPY_AND_ASSIGN(LocalVariable); | 124 DISALLOW_COPY_AND_ASSIGN(LocalVariable); |
118 }; | 125 }; |
119 | 126 |
120 | 127 |
121 class NameReference : public ZoneAllocated { | 128 class NameReference : public ZoneAllocated { |
122 public: | 129 public: |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 // List of names referenced in this scope and its children that | 374 // List of names referenced in this scope and its children that |
368 // are not resolved to local variables. | 375 // are not resolved to local variables. |
369 GrowableArray<NameReference*> referenced_; | 376 GrowableArray<NameReference*> referenced_; |
370 | 377 |
371 DISALLOW_COPY_AND_ASSIGN(LocalScope); | 378 DISALLOW_COPY_AND_ASSIGN(LocalScope); |
372 }; | 379 }; |
373 | 380 |
374 } // namespace dart | 381 } // namespace dart |
375 | 382 |
376 #endif // VM_SCOPES_H_ | 383 #endif // VM_SCOPES_H_ |
OLD | NEW |