Index: src/ast.h |
=================================================================== |
--- src/ast.h (revision 3576) |
+++ src/ast.h (working copy) |
@@ -187,6 +187,11 @@ |
virtual bool IsValidJSON() { return false; } |
virtual bool IsValidLeftHandSide() { return false; } |
+ // Symbols that cannot be parsed as array indices are considered property |
+ // names. We do not treat symbols that can be array indexes as property |
+ // names because [] for string objects is handled only by keyed ICs. |
+ virtual bool IsPropertyName() { return false; } |
+ |
// Mark the expression as being compiled as an expression |
// statement. This is used to transform postfix increments to |
// (faster) prefix increments. |
@@ -707,6 +712,14 @@ |
virtual bool IsValidJSON() { return true; } |
+ virtual bool IsPropertyName() { |
+ if (handle_->IsSymbol()) { |
+ uint32_t ignored; |
+ return !String::cast(*handle_)->AsArrayIndex(&ignored); |
+ } |
+ return false; |
+ } |
+ |
// Identity testers. |
bool IsNull() const { return handle_.is_identical_to(Factory::null_value()); } |
bool IsTrue() const { return handle_.is_identical_to(Factory::true_value()); } |