| 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 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 }; | 1072 }; |
| 1073 | 1073 |
| 1074 | 1074 |
| 1075 class VariableProxy: public Expression { | 1075 class VariableProxy: public Expression { |
| 1076 public: | 1076 public: |
| 1077 explicit VariableProxy(Variable* var); | 1077 explicit VariableProxy(Variable* var); |
| 1078 | 1078 |
| 1079 DECLARE_NODE_TYPE(VariableProxy) | 1079 DECLARE_NODE_TYPE(VariableProxy) |
| 1080 | 1080 |
| 1081 // Type testing & conversion | 1081 // Type testing & conversion |
| 1082 virtual Property* AsProperty() { | 1082 Variable* AsVariable() { return (this == NULL) ? NULL : var_; } |
| 1083 return var_ == NULL ? NULL : var_->AsProperty(); | |
| 1084 } | |
| 1085 | |
| 1086 Variable* AsVariable() { | |
| 1087 if (this == NULL || var_ == NULL) return NULL; | |
| 1088 Expression* rewrite = var_->rewrite(); | |
| 1089 if (rewrite == NULL || rewrite->AsSlot() != NULL) return var_; | |
| 1090 return NULL; | |
| 1091 } | |
| 1092 | 1083 |
| 1093 virtual bool IsValidLeftHandSide() { | 1084 virtual bool IsValidLeftHandSide() { |
| 1094 return var_ == NULL ? true : var_->IsValidLeftHandSide(); | 1085 return var_ == NULL ? true : var_->IsValidLeftHandSide(); |
| 1095 } | 1086 } |
| 1096 | 1087 |
| 1097 virtual bool IsTrivial() { | 1088 virtual bool IsTrivial() { |
| 1098 // Reading from a mutable variable is a side effect, but the | 1089 // Reading from a mutable variable is a side effect, but the |
| 1099 // variable for 'this' is immutable. | 1090 // variable for 'this' is immutable. |
| 1100 return is_this_ || is_trivial_; | 1091 return is_this_ || is_trivial_; |
| 1101 } | 1092 } |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 AST_NODE_LIST(DEF_VISIT) | 2176 AST_NODE_LIST(DEF_VISIT) |
| 2186 #undef DEF_VISIT | 2177 #undef DEF_VISIT |
| 2187 | 2178 |
| 2188 private: | 2179 private: |
| 2189 bool stack_overflow_; | 2180 bool stack_overflow_; |
| 2190 }; | 2181 }; |
| 2191 | 2182 |
| 2192 } } // namespace v8::internal | 2183 } } // namespace v8::internal |
| 2193 | 2184 |
| 2194 #endif // V8_AST_H_ | 2185 #endif // V8_AST_H_ |
| OLD | NEW |