| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 *has_function = true; | 477 *has_function = true; |
| 478 value->AsFunctionLiteral()->set_pretenure(); | 478 value->AsFunctionLiteral()->set_pretenure(); |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 // If we assign a function literal to a property we pretenure the | 482 // If we assign a function literal to a property we pretenure the |
| 483 // literal so it can be added as a constant function property. | 483 // literal so it can be added as a constant function property. |
| 484 static void CheckAssigningFunctionLiteralToProperty(Expression* left, | 484 static void CheckAssigningFunctionLiteralToProperty(Expression* left, |
| 485 Expression* right); | 485 Expression* right); |
| 486 | 486 |
| 487 // Signal a reference error if the expression is an invalid left-hand side | 487 // Determine whether the expression is a valid assignment left-hand side. |
| 488 // expression. We could report this as a syntax error but for compatibility | 488 static bool IsValidLeftHandSide(Expression* expression) { |
| 489 // with JSC we choose to report the error at runtime. | 489 return expression->IsValidLeftHandSide(); |
| 490 Expression* ValidateAssignmentLeftHandSide(Expression* expression) const; | 490 } |
| 491 | 491 |
| 492 // Determine if the expression is a variable proxy and mark it as being used | 492 // Determine if the expression is a variable proxy and mark it as being used |
| 493 // in an assignment or with a increment/decrement operator. This is currently | 493 // in an assignment or with a increment/decrement operator. This is currently |
| 494 // used on for the statically checking assignments to harmony const bindings. | 494 // used on for the statically checking assignments to harmony const bindings. |
| 495 static Expression* MarkExpressionAsLValue(Expression* expression); | 495 static Expression* MarkExpressionAsLValue(Expression* expression); |
| 496 | 496 |
| 497 // Checks LHS expression for assignment and prefix/postfix increment/decrement | 497 // Checks LHS expression for assignment and prefix/postfix increment/decrement |
| 498 // in strict mode. | 498 // in strict mode. |
| 499 void CheckStrictModeLValue(Expression*expression, bool* ok); | 499 void CheckStrictModeLValue(Expression*expression, bool* ok); |
| 500 | 500 |
| 501 // Reporting errors. | 501 // Reporting errors. |
| 502 void ReportMessageAt(Scanner::Location source_location, | 502 void ReportMessageAt(Scanner::Location source_location, |
| 503 const char* message, | 503 const char* message, |
| 504 Vector<const char*> args); | 504 Vector<const char*> args, |
| 505 void ReportMessage(const char* message, Vector<Handle<String> > args); | 505 bool is_reference_error = false); |
| 506 void ReportMessage(const char* message, |
| 507 Vector<Handle<String> > args, |
| 508 bool is_reference_error = false); |
| 506 void ReportMessageAt(Scanner::Location source_location, | 509 void ReportMessageAt(Scanner::Location source_location, |
| 507 const char* message, | 510 const char* message, |
| 508 Vector<Handle<String> > args); | 511 Vector<Handle<String> > args, |
| 512 bool is_reference_error = false); |
| 509 | 513 |
| 510 // "null" return type creators. | 514 // "null" return type creators. |
| 511 static Handle<String> EmptyIdentifier() { | 515 static Handle<String> EmptyIdentifier() { |
| 512 return Handle<String>(); | 516 return Handle<String>(); |
| 513 } | 517 } |
| 514 static Expression* EmptyExpression() { | 518 static Expression* EmptyExpression() { |
| 515 return NULL; | 519 return NULL; |
| 516 } | 520 } |
| 517 static Literal* EmptyLiteral() { | 521 static Literal* EmptyLiteral() { |
| 518 return NULL; | 522 return NULL; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 private: | 831 private: |
| 828 static const int kLiteralTypeSlot = 0; | 832 static const int kLiteralTypeSlot = 0; |
| 829 static const int kElementsSlot = 1; | 833 static const int kElementsSlot = 1; |
| 830 | 834 |
| 831 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 835 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 832 }; | 836 }; |
| 833 | 837 |
| 834 } } // namespace v8::internal | 838 } } // namespace v8::internal |
| 835 | 839 |
| 836 #endif // V8_PARSER_H_ | 840 #endif // V8_PARSER_H_ |
| OLD | NEW |