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

Unified Diff: src/variables.h

Issue 1005063002: Strawman: check strong mode free variables against the global object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: arrow func param fix Created 5 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 | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/variables.h
diff --git a/src/variables.h b/src/variables.h
index 4696e0543d30a0d3315495de19ec7fd1ae5d3e62..3517b06254817bb327584c3945c621adcf9b7cc4 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -130,6 +130,25 @@ class Variable: public ZoneObject {
static int CompareIndex(Variable* const* v, Variable* const* w);
+ void RecordStrongModeReference(int start_position, int end_position) {
+ // Record the earliest reference to the variable. Used in error messages for
+ // strong mode references to undeclared variables.
+ if (has_strong_mode_reference_ &&
+ strong_mode_reference_start_position_ < start_position)
+ return;
+ has_strong_mode_reference_ = true;
+ strong_mode_reference_start_position_ = start_position;
+ strong_mode_reference_end_position_ = end_position;
+ }
+
+ bool has_strong_mode_reference() const { return has_strong_mode_reference_; }
+ int strong_mode_reference_start_position() const {
+ return strong_mode_reference_start_position_;
+ }
+ int strong_mode_reference_end_position() const {
+ return strong_mode_reference_end_position_;
+ }
+
private:
Scope* scope_;
const AstRawString* name_;
@@ -138,6 +157,11 @@ class Variable: public ZoneObject {
Location location_;
int index_;
int initializer_position_;
+ // Tracks whether the variable is bound to a VariableProxy which is in strong
+ // mode, and if yes, the source location of the reference.
+ bool has_strong_mode_reference_;
+ int strong_mode_reference_start_position_;
+ int strong_mode_reference_end_position_;
// If this field is set, this variable references the stored locally bound
// variable, but it might be shadowed by variable bindings introduced by
« no previous file with comments | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698