| Index: src/ast/scopes.h
|
| diff --git a/src/ast/scopes.h b/src/ast/scopes.h
|
| index 6f3702132a222cfea136786891272c2cd5c10c26..d686e7d4b69d93d159b851cdc1dc4da5acecc92d 100644
|
| --- a/src/ast/scopes.h
|
| +++ b/src/ast/scopes.h
|
| @@ -21,6 +21,7 @@ class AstRawString;
|
| class Declaration;
|
| class ParseInfo;
|
| class SloppyBlockFunctionStatement;
|
| +class Statement;
|
| class StringSet;
|
| class VariableProxy;
|
|
|
| @@ -37,7 +38,7 @@ class VariableMap: public ZoneHashMap {
|
|
|
| // Records that "name" exists (if not recorded yet) but doesn't create a
|
| // Variable. Useful for preparsing.
|
| - void DeclareName(Zone* zone, const AstRawString* name);
|
| + void DeclareName(Zone* zone, const AstRawString* name, VariableMode mode);
|
|
|
| Variable* Lookup(const AstRawString* name);
|
| void Remove(Variable* var);
|
| @@ -48,9 +49,24 @@ class VariableMap: public ZoneHashMap {
|
| // Sloppy block-scoped function declarations to var-bind
|
| class SloppyBlockFunctionMap : public ZoneHashMap {
|
| public:
|
| + class Delegate : public ZoneObject {
|
| + public:
|
| + explicit Delegate(Scope* scope,
|
| + SloppyBlockFunctionStatement* statement = nullptr)
|
| + : scope_(scope), statement_(statement), next_(nullptr) {}
|
| + void set_statement(Statement* statement);
|
| + void set_next(Delegate* next) { next_ = next; }
|
| + Delegate* next() const { return next_; }
|
| + Scope* scope() const { return scope_; }
|
| +
|
| + private:
|
| + Scope* scope_;
|
| + SloppyBlockFunctionStatement* statement_;
|
| + Delegate* next_;
|
| + };
|
| +
|
| explicit SloppyBlockFunctionMap(Zone* zone);
|
| - void Declare(Zone* zone, const AstRawString* name,
|
| - SloppyBlockFunctionStatement* statement);
|
| + void Declare(Zone* zone, const AstRawString* name, Delegate* delegate);
|
| };
|
|
|
| enum class AnalyzeMode { kRegular, kDebugger };
|
| @@ -747,10 +763,9 @@ class DeclarationScope : public Scope {
|
| // initializers.
|
| void AddLocal(Variable* var);
|
|
|
| - void DeclareSloppyBlockFunction(const AstRawString* name,
|
| - SloppyBlockFunctionStatement* statement) {
|
| - sloppy_block_function_map_.Declare(zone(), name, statement);
|
| - }
|
| + void DeclareSloppyBlockFunction(
|
| + const AstRawString* name, Scope* scope,
|
| + SloppyBlockFunctionStatement* statement = nullptr);
|
|
|
| // Go through sloppy_block_function_map_ and hoist those (into this scope)
|
| // which should be hoisted.
|
|
|