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: runtime/vm/parser.h

Issue 10665009: Fix parent function of deeply nested closures (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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: runtime/vm/parser.h
===================================================================
--- runtime/vm/parser.h (revision 9036)
+++ runtime/vm/parser.h (working copy)
@@ -139,9 +139,12 @@
struct Block;
class TryBlocks;
- // The function being parsed.
+ // The function for which we will generate code.
const Function& current_function() const;
+ // The innermost function being parsed.
+ const Function& innermost_function() const;
+
// Note that a local function may be parsed multiple times. It is first parsed
// when its outermost enclosing function is being parsed. It is then parsed
// again when an enclosing function calls this local function or calls
@@ -151,10 +154,13 @@
// itself nested in a static function, is parsed 3 times (unless it does not
// end up being invoked).
// Now, current_function() always points to the outermost function being
- // parsed (i.e. the function that is being invoked), and is not updated while
- // parsing a nested function of that outermost function.
- // Therefore, the statements being parsed may or may not belong to the body of
- // the current_function(); they may belong to nested functions.
+ // compiled (i.e. the function that is being invoked), and is not updated
+ // while parsing a nested function of that outermost function.
+ // Therefore, the statements being parsed may or may not belong to the body
+ // of the current_function(); they may belong to nested functions.
+ // innermost_function() is the function that is currently being parsed.
+ // It is either the same as current_function(), or a lexically nested
+ // function.
// The function level of the current parsing scope reflects the function
// nesting. The function level is zero while parsing the body of the
// current_function(), but is greater than zero while parsing the body of
@@ -519,9 +525,12 @@
bool SetAllowFunctionLiterals(bool value);
bool allow_function_literals_;
- // The function currently being parsed.
+ // The function currently being compiled.
const Function& current_function_;
+ // The function currently being parsed.
+ Function& innermost_function_;
+
// The class or interface currently being parsed, or the owner class of the
// function currently being parsed. It is used for primary identifier lookups.
Class& current_class_;
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/parser.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698