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

Unified Diff: src/contexts.h

Issue 7671042: Temporal dead zone behaviour for let bindings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test initialization of function declarations. Created 9 years, 4 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 | « no previous file | src/contexts.cc » ('j') | src/contexts.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.h
diff --git a/src/contexts.h b/src/contexts.h
index 3d9e7f4bfe06b481071d7f571a8240c756716980..d3455b24047579a60744c8fc44356fb61afcf405 100644
--- a/src/contexts.h
+++ b/src/contexts.h
@@ -44,6 +44,29 @@ enum ContextLookupFlags {
};
+// ES5 10.2 defines lexical environments with mutable and immutable bindings.
+// Immutable bindings have two states, initialized and uninitialized, and
+// their state is changed by the InitializeImmutableBinding method.
+//
+// The harmony proposal for block scoped bindings also introduces the
+// uninitialized state for mutable bindings. A 'let' declared variable
+// is a mutable binding that is created uninitalized upon activation of its
+// lexical environment and it is initialized when evaluating its declaration
+// statement. Var declared variables are mutable bindings that are
+// immediately initialized upon creation. The BindingFlags enum represents
+// information if a binding has definitely been initialized. 'const' declared
+// variables are created as uninitialized immutable bindings.
+
+// In harmony mode accessing an uninitialized binding produces a reference
+// error.
+enum BindingFlags {
+ MUTABLE_IS_INITIALIZED,
+ MUTABLE_CHECK_INITIALIZED,
+ IMMUTABLE_IS_INITIALIZED,
+ IMMUTABLE_CHECK_INITIALIZED
+};
+
+
// Heap-allocated activation contexts.
//
// Contexts are implemented as FixedArray objects; the Context
@@ -352,7 +375,8 @@ class Context: public FixedArray {
// there was no context found with the corresponding property.
// attributes == ABSENT.
Handle<Object> Lookup(Handle<String> name, ContextLookupFlags flags,
- int* index_, PropertyAttributes* attributes);
+ int* index_, PropertyAttributes* attributes,
+ BindingFlags* binding_flags);
fschneider 2011/08/23 08:36:12 Reformat to make all parameters on a separate line
Steven 2011/08/23 12:35:44 Done.
// Determine if a local variable with the given name exists in a
// context. Do not consider context extension objects. This is
« no previous file with comments | « no previous file | src/contexts.cc » ('j') | src/contexts.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698