OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 795 |
796 // Type testing & conversion | 796 // Type testing & conversion |
797 virtual Property* AsProperty() { | 797 virtual Property* AsProperty() { |
798 return var_ == NULL ? NULL : var_->AsProperty(); | 798 return var_ == NULL ? NULL : var_->AsProperty(); |
799 } | 799 } |
800 virtual VariableProxy* AsVariableProxy() { return this; } | 800 virtual VariableProxy* AsVariableProxy() { return this; } |
801 | 801 |
802 Variable* AsVariable() { | 802 Variable* AsVariable() { |
803 return this == NULL || var_ == NULL ? NULL : var_->AsVariable(); | 803 return this == NULL || var_ == NULL ? NULL : var_->AsVariable(); |
804 } | 804 } |
| 805 |
805 virtual bool IsValidLeftHandSide() { | 806 virtual bool IsValidLeftHandSide() { |
806 return var_ == NULL ? true : var_->IsValidLeftHandSide(); | 807 return var_ == NULL ? true : var_->IsValidLeftHandSide(); |
807 } | 808 } |
| 809 |
808 bool IsVariable(Handle<String> n) { | 810 bool IsVariable(Handle<String> n) { |
809 return !is_this() && name().is_identical_to(n); | 811 return !is_this() && name().is_identical_to(n); |
810 } | 812 } |
811 | 813 |
| 814 bool IsArguments() { |
| 815 Variable* variable = AsVariable(); |
| 816 return (variable == NULL) ? false : variable->is_arguments(); |
| 817 } |
| 818 |
812 // If this assertion fails it means that some code has tried to | 819 // If this assertion fails it means that some code has tried to |
813 // treat the special "this" variable as an ordinary variable with | 820 // treat the special "this" variable as an ordinary variable with |
814 // the name "this". | 821 // the name "this". |
815 Handle<String> name() const { return name_; } | 822 Handle<String> name() const { return name_; } |
816 Variable* var() const { return var_; } | 823 Variable* var() const { return var_; } |
817 UseCount* var_uses() { return &var_uses_; } | 824 UseCount* var_uses() { return &var_uses_; } |
818 UseCount* obj_uses() { return &obj_uses_; } | 825 UseCount* obj_uses() { return &obj_uses_; } |
819 bool is_this() const { return is_this_; } | 826 bool is_this() const { return is_this_; } |
820 bool inside_with() const { return inside_with_; } | 827 bool inside_with() const { return inside_with_; } |
821 | 828 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 }; | 890 }; |
884 | 891 |
885 Slot(Variable* var, Type type, int index) | 892 Slot(Variable* var, Type type, int index) |
886 : var_(var), type_(type), index_(index) { | 893 : var_(var), type_(type), index_(index) { |
887 ASSERT(var != NULL); | 894 ASSERT(var != NULL); |
888 } | 895 } |
889 | 896 |
890 virtual void Accept(AstVisitor* v); | 897 virtual void Accept(AstVisitor* v); |
891 | 898 |
892 // Type testing & conversion | 899 // Type testing & conversion |
893 virtual Slot* AsSlot() { return this; } | 900 virtual Slot* AsSlot() { return this; } |
894 | 901 |
895 // Accessors | 902 // Accessors |
896 Variable* var() const { return var_; } | 903 Variable* var() const { return var_; } |
897 Type type() const { return type_; } | 904 Type type() const { return type_; } |
898 int index() const { return index_; } | 905 int index() const { return index_; } |
| 906 bool is_arguments() const { return var_->is_arguments(); } |
899 | 907 |
900 private: | 908 private: |
901 Variable* var_; | 909 Variable* var_; |
902 Type type_; | 910 Type type_; |
903 int index_; | 911 int index_; |
904 }; | 912 }; |
905 | 913 |
906 | 914 |
907 class Property: public Expression { | 915 class Property: public Expression { |
908 public: | 916 public: |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 #undef DEF_VISIT | 1717 #undef DEF_VISIT |
1710 | 1718 |
1711 private: | 1719 private: |
1712 bool stack_overflow_; | 1720 bool stack_overflow_; |
1713 }; | 1721 }; |
1714 | 1722 |
1715 | 1723 |
1716 } } // namespace v8::internal | 1724 } } // namespace v8::internal |
1717 | 1725 |
1718 #endif // V8_AST_H_ | 1726 #endif // V8_AST_H_ |
OLD | NEW |