| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 VariableProxy* value() const { return value_; } | 941 VariableProxy* value() const { return value_; } |
| 942 | 942 |
| 943 private: | 943 private: |
| 944 Literal* key_; | 944 Literal* key_; |
| 945 VariableProxy* value_; | 945 VariableProxy* value_; |
| 946 }; | 946 }; |
| 947 | 947 |
| 948 | 948 |
| 949 class VariableProxy: public Expression { | 949 class VariableProxy: public Expression { |
| 950 public: | 950 public: |
| 951 explicit VariableProxy(Variable* var); |
| 952 |
| 951 virtual void Accept(AstVisitor* v); | 953 virtual void Accept(AstVisitor* v); |
| 952 | 954 |
| 953 // Type testing & conversion | 955 // Type testing & conversion |
| 954 virtual Property* AsProperty() { | 956 virtual Property* AsProperty() { |
| 955 return var_ == NULL ? NULL : var_->AsProperty(); | 957 return var_ == NULL ? NULL : var_->AsProperty(); |
| 956 } | 958 } |
| 957 | 959 |
| 958 virtual VariableProxy* AsVariableProxy() { | 960 virtual VariableProxy* AsVariableProxy() { |
| 959 return this; | 961 return this; |
| 960 } | 962 } |
| 961 | 963 |
| 962 Variable* AsVariable() { | 964 Variable* AsVariable() { |
| 963 return this == NULL || var_ == NULL ? NULL : var_->AsVariable(); | 965 if (this == NULL || var_ == NULL) return NULL; |
| 966 Expression* rewrite = var_->rewrite(); |
| 967 if (rewrite == NULL || rewrite->AsSlot() != NULL) return var_; |
| 968 return NULL; |
| 964 } | 969 } |
| 965 | 970 |
| 966 virtual bool IsValidLeftHandSide() { | 971 virtual bool IsValidLeftHandSide() { |
| 967 return var_ == NULL ? true : var_->IsValidLeftHandSide(); | 972 return var_ == NULL ? true : var_->IsValidLeftHandSide(); |
| 968 } | 973 } |
| 969 | 974 |
| 970 virtual bool IsTrivial() { | 975 virtual bool IsTrivial() { |
| 971 // Reading from a mutable variable is a side effect, but the | 976 // Reading from a mutable variable is a side effect, but the |
| 972 // variable for 'this' is immutable. | 977 // variable for 'this' is immutable. |
| 973 return is_this_ || is_trivial_; | 978 return is_this_ || is_trivial_; |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 AST_NODE_LIST(DEF_VISIT) | 1919 AST_NODE_LIST(DEF_VISIT) |
| 1915 #undef DEF_VISIT | 1920 #undef DEF_VISIT |
| 1916 | 1921 |
| 1917 private: | 1922 private: |
| 1918 bool stack_overflow_; | 1923 bool stack_overflow_; |
| 1919 }; | 1924 }; |
| 1920 | 1925 |
| 1921 } } // namespace v8::internal | 1926 } } // namespace v8::internal |
| 1922 | 1927 |
| 1923 #endif // V8_AST_H_ | 1928 #endif // V8_AST_H_ |
| OLD | NEW |