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

Unified Diff: src/ast/scopes.h

Issue 2407163003: PreParser: track variable declarations and parameters (Closed)
Patch Set: more tests Created 4 years 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/scopes.cc » ('j') | src/parsing/preparser.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.h
diff --git a/src/ast/scopes.h b/src/ast/scopes.h
index fa289733066386d5635780a9359cdbd13a714302..15a5f79b7aed6ecd41df076d9c18ec78ffa8a0b1 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -34,6 +34,10 @@ class VariableMap: public ZoneHashMap {
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned,
bool* added = nullptr);
+ // Records that "name" exists but doesn't create a Variable. Useful for
+ // preparsing.
+ void DeclareName(Zone* zone, const AstRawString* name);
+
Variable* Lookup(const AstRawString* name);
void Remove(Variable* var);
void Add(Zone* zone, Variable* var);
@@ -157,6 +161,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
bool* sloppy_mode_block_scope_function_redefinition,
bool* ok);
+ void DeclareVariableName(const AstRawString* name, VariableMode mode);
+
// Declarations list.
ThreadedList<Declaration>* declarations() { return &decls_; }
@@ -526,7 +532,6 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
// list along the way, so full resolution cannot be done afterwards.
// If a ParseInfo* is passed, non-free variables will be resolved.
VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope,
- bool try_to_resolve = true,
ParseInfo* info = nullptr,
VariableProxy* stack = nullptr);
@@ -578,6 +583,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
void SetDefaults();
friend class DeclarationScope;
+ friend class ScopeTestHelper;
};
class DeclarationScope : public Scope {
@@ -649,6 +655,9 @@ class DeclarationScope : public Scope {
Variable* DeclareParameter(const AstRawString* name, VariableMode mode,
bool is_optional, bool is_rest, bool* is_duplicate,
AstValueFactory* ast_value_factory);
+ void DeclareParameterName(const AstRawString* name, bool is_optional,
+ bool is_rest, bool* is_duplicate,
+ AstValueFactory* ast_value_factory);
// Declare an implicit global variable in this scope which must be a
// script scope. The variable was introduced (possibly from an inner
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | src/parsing/preparser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698