Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 3d53b5fb0e4c82708f3468a257ec79ecd24b0f54..e36eb9b32182e481fa8f91e749758e61e228c733 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -320,6 +320,20 @@ class Expression: public AstNode { |
}; |
+/** |
+ * A sentinel used during pre parsing that represents some expression |
+ * that is a valid left hand side without having to actually build |
+ * the expression. |
+ */ |
+class ValidLeftHandSideSentinel: public Expression { |
+ public: |
+ explicit ValidLeftHandSideSentinel(Isolate* isolate) : Expression(isolate) {} |
+ virtual bool IsValidLeftHandSide() { return true; } |
+ virtual void Accept(AstVisitor* v) { UNREACHABLE(); } |
+ virtual bool IsInlineable() const; |
+}; |
+ |
+ |
class BreakableStatement: public Statement { |
public: |
enum Type { |
@@ -1160,11 +1174,24 @@ class VariableProxy: public Expression { |
bool is_this, |
bool inside_with, |
int position = RelocInfo::kNoPosition); |
+ VariableProxy(Isolate* isolate, bool is_this); |
friend class Scope; |
}; |
+class VariableProxySentinel: public VariableProxy { |
+ public: |
+ virtual bool IsValidLeftHandSide() { return !is_this(); } |
+ |
+ private: |
+ VariableProxySentinel(Isolate* isolate, bool is_this) |
+ : VariableProxy(isolate, is_this) { } |
+ |
+ friend class AstSentinels; |
+}; |
+ |
+ |
class Slot: public Expression { |
public: |
enum Type { |
@@ -1322,6 +1349,36 @@ class Call: public Expression { |
}; |
+class AstSentinels { |
+ public: |
+ ~AstSentinels() { } |
+ |
+ // Returns a property singleton property access on 'this'. Used |
+ // during preparsing. |
+ Property* this_property() { return &this_property_; } |
+ VariableProxySentinel* this_proxy() { return &this_proxy_; } |
+ VariableProxySentinel* identifier_proxy() { return &identifier_proxy_; } |
+ ValidLeftHandSideSentinel* valid_left_hand_side_sentinel() { |
+ return &valid_left_hand_side_sentinel_; |
+ } |
+ Call* call_sentinel() { return &call_sentinel_; } |
+ EmptyStatement* empty_statement() { return &empty_statement_; } |
+ |
+ private: |
+ AstSentinels(); |
+ VariableProxySentinel this_proxy_; |
+ VariableProxySentinel identifier_proxy_; |
+ ValidLeftHandSideSentinel valid_left_hand_side_sentinel_; |
+ Property this_property_; |
+ Call call_sentinel_; |
+ EmptyStatement empty_statement_; |
+ |
+ friend class Isolate; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AstSentinels); |
+}; |
+ |
+ |
class CallNew: public Expression { |
public: |
CallNew(Isolate* isolate, |