Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/variables.h

Issue 3432022: Clean up some messiness in Scopes. (Closed)
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 Variable(Scope* scope, 115 Variable(Scope* scope,
116 Handle<String> name, 116 Handle<String> name,
117 Mode mode, 117 Mode mode,
118 bool is_valid_lhs, 118 bool is_valid_lhs,
119 Kind kind); 119 Kind kind);
120 120
121 // Printing support 121 // Printing support
122 static const char* Mode2String(Mode mode); 122 static const char* Mode2String(Mode mode);
123 123
124 // Type testing & conversion 124 // Type testing & conversion
125 Property* AsProperty(); 125 Property* AsProperty() const;
126 Variable* AsVariable(); 126 Slot* AsSlot() const;
127
127 bool IsValidLeftHandSide() { return is_valid_LHS_; } 128 bool IsValidLeftHandSide() { return is_valid_LHS_; }
128 129
129 // The source code for an eval() call may refer to a variable that is 130 // The source code for an eval() call may refer to a variable that is
130 // in an outer scope about which we don't know anything (it may not 131 // in an outer scope about which we don't know anything (it may not
131 // be the global scope). scope() is NULL in that case. Currently the 132 // be the global scope). scope() is NULL in that case. Currently the
132 // scope is only used to follow the context chain length. 133 // scope is only used to follow the context chain length.
133 Scope* scope() const { return scope_; } 134 Scope* scope() const { return scope_; }
134 135
135 Handle<String> name() const { return name_; } 136 Handle<String> name() const { return name_; }
136 Mode mode() const { return mode_; } 137 Mode mode() const { return mode_; }
(...skipping 28 matching lines...) Expand all
165 Variable* local_if_not_shadowed() const { 166 Variable* local_if_not_shadowed() const {
166 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); 167 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL);
167 return local_if_not_shadowed_; 168 return local_if_not_shadowed_;
168 } 169 }
169 170
170 void set_local_if_not_shadowed(Variable* local) { 171 void set_local_if_not_shadowed(Variable* local) {
171 local_if_not_shadowed_ = local; 172 local_if_not_shadowed_ = local;
172 } 173 }
173 174
174 Expression* rewrite() const { return rewrite_; } 175 Expression* rewrite() const { return rewrite_; }
175 Slot* slot() const;
176 176
177 StaticType* type() { return &type_; } 177 StaticType* type() { return &type_; }
178 178
179 private: 179 private:
180 Scope* scope_; 180 Scope* scope_;
181 Handle<String> name_; 181 Handle<String> name_;
182 Mode mode_; 182 Mode mode_;
183 bool is_valid_LHS_; 183 bool is_valid_LHS_;
184 Kind kind_; 184 Kind kind_;
185 185
(...skipping 10 matching lines...) Expand all
196 // rewrite_ is usually a Slot or a Property, but may be any expression. 196 // rewrite_ is usually a Slot or a Property, but may be any expression.
197 Expression* rewrite_; 197 Expression* rewrite_;
198 198
199 friend class Scope; // Has explicit access to rewrite_. 199 friend class Scope; // Has explicit access to rewrite_.
200 }; 200 };
201 201
202 202
203 } } // namespace v8::internal 203 } } // namespace v8::internal
204 204
205 #endif // V8_VARIABLES_H_ 205 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698