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

Unified Diff: src/ast.h

Issue 943543002: [strong] Declaration-after-use errors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: computed prop names comment fix Created 5 years, 10 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/ast.cc » ('j') | no next file with comments »
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 9b86d0b51292f6291b734962af0f8912e8218f4d..3a273f38655fc4db74be4a23cce46620d1b242ac 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1631,6 +1631,8 @@ class VariableProxy FINAL : public Expression {
bit_field_ = IsResolvedField::update(bit_field_, true);
}
+ int end_position() const { return end_position_; }
+
// Bind this proxy to the variable var.
void BindTo(Variable* var);
@@ -1653,10 +1655,11 @@ class VariableProxy FINAL : public Expression {
}
protected:
- VariableProxy(Zone* zone, Variable* var, int position);
+ VariableProxy(Zone* zone, Variable* var, int start_position,
+ int end_position);
VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
- int position);
+ int start_position, int end_position);
class IsThisField : public BitField8<bool, 0, 1> {};
class IsAssignedField : public BitField8<bool, 1, 1> {};
@@ -1670,6 +1673,10 @@ class VariableProxy FINAL : public Expression {
const AstRawString* raw_name_; // if !is_resolved_
Variable* var_; // if is_resolved_
};
+ // Position is stored in the AstNode superclass, but VariableProxy needs to
+ // know its end position too (for error messages). It cannot be inferred from
+ // the variable name length because it can contain escapes.
+ int end_position_;
};
@@ -3353,14 +3360,16 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
}
VariableProxy* NewVariableProxy(Variable* var,
- int pos = RelocInfo::kNoPosition) {
- return new (zone_) VariableProxy(zone_, var, pos);
+ int start_position = RelocInfo::kNoPosition,
+ int end_position = RelocInfo::kNoPosition) {
+ return new (zone_) VariableProxy(zone_, var, start_position, end_position);
}
- VariableProxy* NewVariableProxy(const AstRawString* name,
- bool is_this,
- int position = RelocInfo::kNoPosition) {
- return new (zone_) VariableProxy(zone_, name, is_this, position);
+ VariableProxy* NewVariableProxy(const AstRawString* name, bool is_this,
+ int start_position = RelocInfo::kNoPosition,
+ int end_position = RelocInfo::kNoPosition) {
+ return new (zone_)
+ VariableProxy(zone_, name, is_this, start_position, end_position);
}
Property* NewProperty(Expression* obj, Expression* key, int pos) {
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698