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

Unified Diff: src/scopes.h

Issue 1332873003: Implement sloppy-mode block-defined functions (Annex B 3.3) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: An extra test and comment fix Created 5 years, 3 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
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 4b8fe4997b46a151439be29e70f9d30de261c240..9d29a84e8dc11e8f3eb6a4e28b9c934df980e07f 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -57,6 +57,20 @@ class DynamicScopePart : public ZoneObject {
};
+// Sloppy block-scoped function declarations to var-bind
+class SloppyBlockFunctionMap : public ZoneHashMap {
+ public:
+ explicit SloppyBlockFunctionMap(Zone* zone);
+
+ virtual ~SloppyBlockFunctionMap();
+
+ void Declare(const AstRawString* name, DelegateStatement* statement);
+
+ private:
+ Zone* zone_;
+};
+
+
// Global invariants after AST construction: Each reference (i.e. identifier)
// to a JavaScript variable (including global properties) is represented by a
// VariableProxy node. Immediately after AST construction and before variable
@@ -544,6 +558,10 @@ class Scope: public ZoneObject {
return params_.Contains(variables_.Lookup(name));
}
+ SloppyBlockFunctionMap* sloppy_block_function_map() {
+ return &sloppy_block_function_map_;
+ }
+
// Error handling.
void ReportMessage(int start_position, int end_position,
MessageTemplate::Template message,
@@ -602,6 +620,9 @@ class Scope: public ZoneObject {
// Module descriptor; module scopes only.
ModuleDescriptor* module_descriptor_;
+ // Map of function names to lists of functions defined in sloppy blocks
+ SloppyBlockFunctionMap sloppy_block_function_map_;
+
// Illegal redeclaration.
Expression* illegal_redecl_;

Powered by Google App Engine
This is Rietveld 408576698