OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 // A named slot in a heap context. name() is the variable name in the | 71 // A named slot in a heap context. name() is the variable name in the |
72 // context object on the heap, with lookup starting at the current | 72 // context object on the heap, with lookup starting at the current |
73 // context. index() is invalid. | 73 // context. index() is invalid. |
74 LOOKUP | 74 LOOKUP |
75 }; | 75 }; |
76 | 76 |
77 Variable(Scope* scope, | 77 Variable(Scope* scope, |
78 Handle<String> name, | 78 Handle<String> name, |
79 VariableMode mode, | 79 VariableMode mode, |
80 bool is_valid_lhs, | 80 bool is_valid_ref, |
81 Kind kind, | 81 Kind kind, |
82 InitializationFlag initialization_flag, | 82 InitializationFlag initialization_flag, |
83 Interface* interface = Interface::NewValue()); | 83 Interface* interface = Interface::NewValue()); |
84 | 84 |
85 // Printing support | 85 // Printing support |
86 static const char* Mode2String(VariableMode mode); | 86 static const char* Mode2String(VariableMode mode); |
87 | 87 |
88 bool IsValidLeftHandSide() { return is_valid_LHS_; } | 88 bool IsValidReference() { return is_valid_ref_; } |
89 | 89 |
90 // The source code for an eval() call may refer to a variable that is | 90 // The source code for an eval() call may refer to a variable that is |
91 // in an outer scope about which we don't know anything (it may not | 91 // in an outer scope about which we don't know anything (it may not |
92 // be the global scope). scope() is NULL in that case. Currently the | 92 // be the global scope). scope() is NULL in that case. Currently the |
93 // scope is only used to follow the context chain length. | 93 // scope is only used to follow the context chain length. |
94 Scope* scope() const { return scope_; } | 94 Scope* scope() const { return scope_; } |
95 | 95 |
96 Handle<String> name() const { return name_; } | 96 Handle<String> name() const { return name_; } |
97 VariableMode mode() const { return mode_; } | 97 VariableMode mode() const { return mode_; } |
98 bool has_forced_context_allocation() const { | 98 bool has_forced_context_allocation() const { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Location location_; | 165 Location location_; |
166 int index_; | 166 int index_; |
167 int initializer_position_; | 167 int initializer_position_; |
168 | 168 |
169 // If this field is set, this variable references the stored locally bound | 169 // If this field is set, this variable references the stored locally bound |
170 // variable, but it might be shadowed by variable bindings introduced by | 170 // variable, but it might be shadowed by variable bindings introduced by |
171 // sloppy 'eval' calls between the reference scope (inclusive) and the | 171 // sloppy 'eval' calls between the reference scope (inclusive) and the |
172 // binding scope (exclusive). | 172 // binding scope (exclusive). |
173 Variable* local_if_not_shadowed_; | 173 Variable* local_if_not_shadowed_; |
174 | 174 |
175 // Valid as a LHS? (const and this are not valid LHS, for example) | 175 // Valid as a reference? (const and this are not valid, for example) |
176 bool is_valid_LHS_; | 176 bool is_valid_ref_; |
177 | 177 |
178 // Usage info. | 178 // Usage info. |
179 bool force_context_allocation_; // set by variable resolver | 179 bool force_context_allocation_; // set by variable resolver |
180 bool is_used_; | 180 bool is_used_; |
181 InitializationFlag initialization_flag_; | 181 InitializationFlag initialization_flag_; |
182 | 182 |
183 // Module type info. | 183 // Module type info. |
184 Interface* interface_; | 184 Interface* interface_; |
185 }; | 185 }; |
186 | 186 |
187 | 187 |
188 } } // namespace v8::internal | 188 } } // namespace v8::internal |
189 | 189 |
190 #endif // V8_VARIABLES_H_ | 190 #endif // V8_VARIABLES_H_ |
OLD | NEW |