Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1406)

Side by Side Diff: src/ast.h

Issue 42009: Fix issue 267: Functions now called with global object as receiver. (Closed)
Patch Set: Now with regression test Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/codegen-arm.cc » ('j') | src/codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 880
881 private: 881 private:
882 Variable* var_; 882 Variable* var_;
883 Type type_; 883 Type type_;
884 int index_; 884 int index_;
885 }; 885 };
886 886
887 887
888 class Property: public Expression { 888 class Property: public Expression {
889 public: 889 public:
890 Property(Expression* obj, Expression* key, int pos) 890 // Synthetic properties are property lookups introduced by the system,
891 : obj_(obj), key_(key), pos_(pos) { } 891 // to objects that aren't visible to the user. Function calls to synthetic
892 // properties should use the global object as receiver, not the base object
893 // of the resolved Reference.
894 enum Type { NORMAL, SYNTHETIC };
895 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL)
896 : obj_(obj), key_(key), pos_(pos), type_(type) { }
892 897
893 virtual void Accept(AstVisitor* v); 898 virtual void Accept(AstVisitor* v);
894 899
895 // Type testing & conversion 900 // Type testing & conversion
896 virtual Property* AsProperty() { return this; } 901 virtual Property* AsProperty() { return this; }
897 902
898 virtual bool IsValidLeftHandSide() { return true; } 903 virtual bool IsValidLeftHandSide() { return true; }
899 904
900 Expression* obj() const { return obj_; } 905 Expression* obj() const { return obj_; }
901 Expression* key() const { return key_; } 906 Expression* key() const { return key_; }
902 int position() const { return pos_; } 907 int position() const { return pos_; }
908 bool is_synthetic() const { return type_ == SYNTHETIC; }
903 909
904 // Returns a property singleton property access on 'this'. Used 910 // Returns a property singleton property access on 'this'. Used
905 // during preparsing. 911 // during preparsing.
906 static Property* this_property() { return &this_property_; } 912 static Property* this_property() { return &this_property_; }
907 913
908 private: 914 private:
909 Expression* obj_; 915 Expression* obj_;
910 Expression* key_; 916 Expression* key_;
911 int pos_; 917 int pos_;
918 Type type_;
912 919
913 // Dummy property used during preparsing 920 // Dummy property used during preparsing.
914 static Property this_property_; 921 static Property this_property_;
915 }; 922 };
916 923
917 924
918 class Call: public Expression { 925 class Call: public Expression {
919 public: 926 public:
920 Call(Expression* expression, 927 Call(Expression* expression,
921 ZoneList<Expression*>* arguments, 928 ZoneList<Expression*>* arguments,
922 int pos) 929 int pos)
923 : expression_(expression), 930 : expression_(expression),
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 #undef DEF_VISIT 1683 #undef DEF_VISIT
1677 1684
1678 private: 1685 private:
1679 bool stack_overflow_; 1686 bool stack_overflow_;
1680 }; 1687 };
1681 1688
1682 1689
1683 } } // namespace v8::internal 1690 } } // namespace v8::internal
1684 1691
1685 #endif // V8_AST_H_ 1692 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/codegen-arm.cc » ('j') | src/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698