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

Unified Diff: src/contexts.h

Issue 2303113004: Improve the explanation of a context's extension slot. (Closed)
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
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 dc8c75ff59c8e7bc87af458bc83c338bcadd7f38..65fac4045d3b66856011810803fe03473f198128 100644
--- a/src/contexts.h
+++ b/src/contexts.h
@@ -298,18 +298,29 @@ class ScriptContextTable : public FixedArray {
//
// [ previous ] A pointer to the previous context.
//
-// [ extension ] A pointer to a ContextExtension object, or "the hole". Used
-// to implement 'with' statements and dynamic declarations
-// (through 'eval'). The object in a 'with' statement is
-// stored in the extension slot of a 'with' context.
-// Dynamically declared variables/functions are also added
-// to lazily allocated extension object. Context::Lookup
-// searches the extension object for properties.
-// For script and block contexts, contains the respective
-// ScopeInfo. For block contexts representing sloppy declaration
-// block scopes, it may also be a struct being a
-// ContextExtension, pairing the ScopeInfo with an extension
-// object.
+// [ extension ] Additional data.
+//
+// For script contexts, it contains the respective ScopeInfo.
+//
+// For catch contexts, it contains a ContextExtension object
+// consisting of the ScopeInfo and the name of the catch
+// variable.
+//
+// For module contexts, it contains the module object.
+//
+// For block contexts, it contains either the respective
+// ScopeInfo or a ContextExtension object consisting of the
+// ScopeInfo and an "extension object" (see below).
+//
+// For with contexts, it contains a ContextExtension object
+// consisting of the ScopeInfo and an "extension object".
+//
+// An "extension object" is used to dynamically extend a context
+// with additional variables, namely in the implementation of the
+// 'with' construct and the 'eval' construct. For instance,
+// Context::Lookup also searches the extension object for
+// properties. (Storing the extension object is the original
+// purpose of this context slot, hence the name.)
//
// [ native_context ] A pointer to the native context.
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698