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 #include <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "src/allocation.h" | 7 #include "src/allocation.h" |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 | 260 |
261 PreParserExpression PreParser::ExpressionFromIdentifier( | 261 PreParserExpression PreParser::ExpressionFromIdentifier( |
262 PreParserIdentifier name, int start_position, InferName infer) { | 262 PreParserIdentifier name, int start_position, InferName infer) { |
263 if (track_unresolved_variables_) { | 263 if (track_unresolved_variables_) { |
264 AstNodeFactory factory(ast_value_factory()); | 264 AstNodeFactory factory(ast_value_factory()); |
265 // Setting the Zone is necessary because zone_ might be the temp Zone, and | 265 // Setting the Zone is necessary because zone_ might be the temp Zone, and |
266 // AstValueFactory doesn't know about it. | 266 // AstValueFactory doesn't know about it. |
267 factory.set_zone(zone()); | 267 factory.set_zone(zone()); |
268 DCHECK_NOT_NULL(name.string_); | 268 DCHECK_NOT_NULL(name.string_); |
269 scope()->NewUnresolved(&factory, name.string_, start_position, | 269 VariableProxy* proxy = scope()->NewUnresolved( |
270 NORMAL_VARIABLE); | 270 &factory, name.string_, start_position, NORMAL_VARIABLE); |
| 271 // We don't know whether the preparsed function assigns or not, so we set |
| 272 // is_assigned pessimistically. |
| 273 proxy->set_is_assigned(); |
271 } | 274 } |
272 return PreParserExpression::FromIdentifier(name, zone()); | 275 return PreParserExpression::FromIdentifier(name, zone()); |
273 } | 276 } |
274 | 277 |
275 void PreParser::DeclareAndInitializeVariables( | 278 void PreParser::DeclareAndInitializeVariables( |
276 PreParserStatement block, | 279 PreParserStatement block, |
277 const DeclarationDescriptor* declaration_descriptor, | 280 const DeclarationDescriptor* declaration_descriptor, |
278 const DeclarationParsingResult::Declaration* declaration, | 281 const DeclarationParsingResult::Declaration* declaration, |
279 ZoneList<const AstRawString*>* names, bool* ok) { | 282 ZoneList<const AstRawString*>* names, bool* ok) { |
280 if (declaration->pattern.identifiers_ != nullptr) { | 283 if (declaration->pattern.identifiers_ != nullptr) { |
(...skipping 16 matching lines...) Expand all Loading... |
297 } | 300 } |
298 } | 301 } |
299 } | 302 } |
300 | 303 |
301 #undef CHECK_OK | 304 #undef CHECK_OK |
302 #undef CHECK_OK_CUSTOM | 305 #undef CHECK_OK_CUSTOM |
303 | 306 |
304 | 307 |
305 } // namespace internal | 308 } // namespace internal |
306 } // namespace v8 | 309 } // namespace v8 |
OLD | NEW |