Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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, | |
| 141 StrictMode strict_mode) const { | |
| 142 if (mode() == CONST) return op != Token::INIT_CONST; | |
|
rossberg
2014/11/25 15:23:36
Hm, wouldn't it be easier and more accurate to imp
Dmitry Lomov (no reviews)
2014/11/25 15:51:01
Hmm, I like my version better since it puts the va
rossberg
2014/11/25 16:25:02
Looks good.
| |
| 143 | |
| 144 if (mode() == CONST_LEGACY) { | |
| 145 return strict_mode == STRICT && op != Token::INIT_CONST_LEGACY && | |
| 146 op != Token::INIT_CONST; | |
|
rossberg
2014/11/25 15:23:36
Can this even occur when mode is CONST_LEGACY?
Dmitry Lomov (no reviews)
2014/11/25 15:51:01
No, done
| |
| 147 } | |
| 148 | |
| 149 return false; | |
| 150 } | |
| 151 | |
| 138 private: | 152 private: |
| 139 Scope* scope_; | 153 Scope* scope_; |
| 140 const AstRawString* name_; | 154 const AstRawString* name_; |
| 141 VariableMode mode_; | 155 VariableMode mode_; |
| 142 Kind kind_; | 156 Kind kind_; |
| 143 Location location_; | 157 Location location_; |
| 144 int index_; | 158 int index_; |
| 145 int initializer_position_; | 159 int initializer_position_; |
| 146 | 160 |
| 147 // If this field is set, this variable references the stored locally bound | 161 // If this field is set, this variable references the stored locally bound |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 160 MaybeAssignedFlag maybe_assigned_; | 174 MaybeAssignedFlag maybe_assigned_; |
| 161 | 175 |
| 162 // Module type info. | 176 // Module type info. |
| 163 Interface* interface_; | 177 Interface* interface_; |
| 164 }; | 178 }; |
| 165 | 179 |
| 166 | 180 |
| 167 } } // namespace v8::internal | 181 } } // namespace v8::internal |
| 168 | 182 |
| 169 #endif // V8_VARIABLES_H_ | 183 #endif // V8_VARIABLES_H_ |
| OLD | NEW |