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

Side by Side Diff: src/variables.h

Issue 749633002: harmony-scoping: make assignment to 'const' a late error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more Created 6 years 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_VARIABLES_H_ 5 #ifndef V8_VARIABLES_H_
6 #define V8_VARIABLES_H_ 6 #define V8_VARIABLES_H_
7 7
8 #include "src/ast-value-factory.h" 8 #include "src/ast-value-factory.h"
9 #include "src/interface.h" 9 #include "src/interface.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 Interface* interface() const { return interface_; } 129 Interface* interface() const { return interface_; }
130 130
131 void AllocateTo(Location location, int index) { 131 void AllocateTo(Location location, int index) {
132 location_ = location; 132 location_ = location;
133 index_ = index; 133 index_ = index;
134 } 134 }
135 135
136 static int CompareIndex(Variable* const* v, Variable* const* w); 136 static int CompareIndex(Variable* const* v, Variable* const* w);
137 137
138 // Shall an error be thrown if assignment with 'op' operation is perfomed
139 // on this variable in given language mode?
140 bool IsSignallingAssignmentToConst(Token::Value op,
rossberg 2014/11/26 08:31:46 Can you also move this to full-codegen.h? This is
Dmitry Lomov (no reviews) 2014/11/26 10:30:56 Done.
141 StrictMode strict_mode) const {
142 if (strict_mode == SLOPPY) return false;
143
144 if (mode() == CONST) return op != Token::INIT_CONST;
145
146 if (mode() == CONST_LEGACY) return op != Token::INIT_CONST_LEGACY;
147
148 return false;
149 }
150
138 private: 151 private:
139 Scope* scope_; 152 Scope* scope_;
140 const AstRawString* name_; 153 const AstRawString* name_;
141 VariableMode mode_; 154 VariableMode mode_;
142 Kind kind_; 155 Kind kind_;
143 Location location_; 156 Location location_;
144 int index_; 157 int index_;
145 int initializer_position_; 158 int initializer_position_;
146 159
147 // If this field is set, this variable references the stored locally bound 160 // If this field is set, this variable references the stored locally bound
(...skipping 12 matching lines...) Expand all
160 MaybeAssignedFlag maybe_assigned_; 173 MaybeAssignedFlag maybe_assigned_;
161 174
162 // Module type info. 175 // Module type info.
163 Interface* interface_; 176 Interface* interface_;
164 }; 177 };
165 178
166 179
167 } } // namespace v8::internal 180 } } // namespace v8::internal
168 181
169 #endif // V8_VARIABLES_H_ 182 #endif // V8_VARIABLES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698