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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/codegen-arm.cc » ('j') | src/codegen-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index a1bd6bbd53c9455e9dab2290f8135ea9ab77b1c7..0f455137672b62a64dac7682f8ef218f5346e3ad 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -887,8 +887,13 @@ class Slot: public Expression {
class Property: public Expression {
public:
- Property(Expression* obj, Expression* key, int pos)
- : obj_(obj), key_(key), pos_(pos) { }
+ // Synthetic properties are property lookups introduced by the system,
+ // to objects that aren't visible to the user. Function calls to synthetic
+ // properties should use the global object as receiver, not the base object
+ // of the resolved Reference.
+ enum Type { NORMAL, SYNTHETIC };
+ Property(Expression* obj, Expression* key, int pos, Type type = NORMAL)
+ : obj_(obj), key_(key), pos_(pos), type_(type) { }
virtual void Accept(AstVisitor* v);
@@ -900,6 +905,7 @@ class Property: public Expression {
Expression* obj() const { return obj_; }
Expression* key() const { return key_; }
int position() const { return pos_; }
+ bool is_synthetic() const { return type_ == SYNTHETIC; }
// Returns a property singleton property access on 'this'. Used
// during preparsing.
@@ -909,8 +915,9 @@ class Property: public Expression {
Expression* obj_;
Expression* key_;
int pos_;
+ Type type_;
- // Dummy property used during preparsing
+ // Dummy property used during preparsing.
static Property this_property_;
};
« 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