OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_PARSING_PREPARSER_H | 5 #ifndef V8_PARSING_PREPARSER_H |
6 #define V8_PARSING_PREPARSER_H | 6 #define V8_PARSING_PREPARSER_H |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 static PreParserExpression UseStrictStringLiteral() { | 196 static PreParserExpression UseStrictStringLiteral() { |
197 return PreParserExpression(TypeField::encode(kStringLiteralExpression) | | 197 return PreParserExpression(TypeField::encode(kStringLiteralExpression) | |
198 IsUseStrictField::encode(true)); | 198 IsUseStrictField::encode(true)); |
199 } | 199 } |
200 | 200 |
201 static PreParserExpression UseAsmStringLiteral() { | 201 static PreParserExpression UseAsmStringLiteral() { |
202 return PreParserExpression(TypeField::encode(kStringLiteralExpression) | | 202 return PreParserExpression(TypeField::encode(kStringLiteralExpression) | |
203 IsUseAsmField::encode(true)); | 203 IsUseAsmField::encode(true)); |
204 } | 204 } |
205 | 205 |
206 static PreParserExpression This() { | 206 static PreParserExpression This(ZoneList<VariableProxy*>* variables) { |
207 return PreParserExpression(TypeField::encode(kExpression) | | 207 return PreParserExpression(TypeField::encode(kExpression) | |
208 ExpressionTypeField::encode(kThisExpression)); | 208 ExpressionTypeField::encode(kThisExpression), |
| 209 variables); |
209 } | 210 } |
210 | 211 |
211 static PreParserExpression ThisProperty() { | 212 static PreParserExpression ThisProperty() { |
212 return PreParserExpression( | 213 return PreParserExpression( |
213 TypeField::encode(kExpression) | | 214 TypeField::encode(kExpression) | |
214 ExpressionTypeField::encode(kThisPropertyExpression)); | 215 ExpressionTypeField::encode(kThisPropertyExpression)); |
215 } | 216 } |
216 | 217 |
217 static PreParserExpression Property() { | 218 static PreParserExpression Property() { |
218 return PreParserExpression( | 219 return PreParserExpression( |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 | 1488 |
1488 V8_INLINE PreParserIdentifier GetNextSymbol() const { | 1489 V8_INLINE PreParserIdentifier GetNextSymbol() const { |
1489 return PreParserIdentifier::Default(); | 1490 return PreParserIdentifier::Default(); |
1490 } | 1491 } |
1491 | 1492 |
1492 V8_INLINE PreParserIdentifier GetNumberAsSymbol() const { | 1493 V8_INLINE PreParserIdentifier GetNumberAsSymbol() const { |
1493 return PreParserIdentifier::Default(); | 1494 return PreParserIdentifier::Default(); |
1494 } | 1495 } |
1495 | 1496 |
1496 V8_INLINE PreParserExpression ThisExpression(int pos = kNoSourcePosition) { | 1497 V8_INLINE PreParserExpression ThisExpression(int pos = kNoSourcePosition) { |
1497 return PreParserExpression::This(); | 1498 ZoneList<VariableProxy*>* variables = nullptr; |
| 1499 if (track_unresolved_variables_) { |
| 1500 AstNodeFactory factory(ast_value_factory()); |
| 1501 // Setting the Zone is necessary because zone_ might be the temp Zone, and |
| 1502 // AstValueFactory doesn't know about it. |
| 1503 factory.set_zone(zone()); |
| 1504 VariableProxy* proxy = scope()->NewUnresolved( |
| 1505 &factory, ast_value_factory()->this_string(), pos, THIS_VARIABLE); |
| 1506 |
| 1507 variables = new (zone()) ZoneList<VariableProxy*>(1, zone()); |
| 1508 variables->Add(proxy, zone()); |
| 1509 } |
| 1510 return PreParserExpression::This(variables); |
1498 } | 1511 } |
1499 | 1512 |
1500 V8_INLINE PreParserExpression NewSuperPropertyReference(int pos) { | 1513 V8_INLINE PreParserExpression NewSuperPropertyReference(int pos) { |
1501 return PreParserExpression::Default(); | 1514 return PreParserExpression::Default(); |
1502 } | 1515 } |
1503 | 1516 |
1504 V8_INLINE PreParserExpression NewSuperCallReference(int pos) { | 1517 V8_INLINE PreParserExpression NewSuperCallReference(int pos) { |
1505 return PreParserExpression::SuperCallReference(); | 1518 return PreParserExpression::SuperCallReference(); |
1506 } | 1519 } |
1507 | 1520 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 function_state_->NextMaterializedLiteralIndex(); | 1693 function_state_->NextMaterializedLiteralIndex(); |
1681 function_state_->NextMaterializedLiteralIndex(); | 1694 function_state_->NextMaterializedLiteralIndex(); |
1682 } | 1695 } |
1683 return EmptyExpression(); | 1696 return EmptyExpression(); |
1684 } | 1697 } |
1685 | 1698 |
1686 } // namespace internal | 1699 } // namespace internal |
1687 } // namespace v8 | 1700 } // namespace v8 |
1688 | 1701 |
1689 #endif // V8_PARSING_PREPARSER_H | 1702 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |