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

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: Improve type clarity 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
« no previous file with comments | « src/rewriter.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 4b8fe4997b46a151439be29e70f9d30de261c240..d9aac2f7e5ff96b2616e8ccaff81391ddeabb277 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -57,6 +57,23 @@ 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,
+ SloppyBlockFunctionStatement* statement);
+
+ typedef ZoneVector<SloppyBlockFunctionStatement*> Vector;
+
+ 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 +561,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 +623,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_;
« no previous file with comments | « src/rewriter.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698