Index: src/contexts.h |
diff --git a/src/contexts.h b/src/contexts.h |
index fe0e22ef573d5c0d7500dc2f523a4c5d32029be6..45efbffa47dc3312bfdaae590f352883f78ff04e 100644 |
--- a/src/contexts.h |
+++ b/src/contexts.h |
@@ -46,24 +46,43 @@ 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. |
+// their state is changed by the InitializeImmutableBinding method. The |
+// BindingFlags enum represents information if a binding has definitely been |
+// initialized. A mutable binding does not need to be checked and thus has |
+// the BindingFlag MUTABLE_IS_INITIALIZED. |
+// |
+// There are two possibilities for immutable bindings |
+// * 'const' declared variables. They are initialized when evaluating the |
+// corresponding declaration statement. They need to be checked for being |
+// initialized and thus get the flag IMMUTABLE_CHECK_INITIALIZED. |
+// * The function name of a named function literal. The binding is immediately |
+// initialized when entering the function and thus does not need to be |
+// checked. it gets the BindingFlag IMMUTABLE_IS_INITIALIZED. |
+// Accessing an uninitialized binding produces the undefined value. |
// |
// 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. |
+// uninitialized state for mutable bindings. |
+// * A 'let' declared variable. They are initialized when evaluating the |
+// corresponding declaration statement. They need to be checked for being |
+// initialized and thus get the flag MUTABLE_CHECK_INITIALIZED. |
+// * A 'var' declared variable. It is initialized immediately upon creation |
+// and thus doesn't need to be checked. It gets the flag |
+// MUTABLE_IS_INITIALIZED. |
+// * Catch bound variables, function parameters and variables introduced by |
+// function declarations are initialized immediately and do not need to be |
+// checked. Thus they get the flag MUTABLE_IS_INITIALIZED. |
+// Immutable bindings in harmony mode get the _HARMONY flag variants. Accessing |
+// an uninitialized binding produces a reference error. |
+// |
+// In V8 uninitialized bindings are set to the hole value upon creation and set |
+// to a different value upon initialization. |
enum BindingFlags { |
MUTABLE_IS_INITIALIZED, |
MUTABLE_CHECK_INITIALIZED, |
IMMUTABLE_IS_INITIALIZED, |
IMMUTABLE_CHECK_INITIALIZED, |
+ IMMUTABLE_IS_INITIALIZED_HARMONY, |
+ IMMUTABLE_CHECK_INITIALIZED_HARMONY, |
MISSING_BINDING |
}; |