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

Unified Diff: src/ast/scopes.h

Issue 2685683002: [async-await] (simpler) fix for Return in try/finally in async functions (Closed)
Patch Set: add some comments + cleanup using BuildHardReturn Created 3 years, 10 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: src/ast/scopes.h
diff --git a/src/ast/scopes.h b/src/ast/scopes.h
index ea37890c5e4875406996b0a5916141fc2459fc82..d5e9326f16a12750b8268752b882ec6e9f9c7f32 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -680,6 +680,11 @@ class DeclarationScope : public Scope {
// calls sloppy eval.
Variable* DeclareFunctionVar(const AstRawString* name);
+ // Declare some special internal variables which must be accessible to
+ // Ignition without ScopeInfo.
+ Variable* DeclareGeneratorObjectVar(const AstRawString* name);
+ Variable* DeclarePromiseVar(const AstRawString* name);
+
// Declare a parameter in this scope. When there are duplicated
// parameters the rightmost one 'wins'. However, the implementation
// expects all parameters to be declared and from left to right.
@@ -718,6 +723,17 @@ class DeclarationScope : public Scope {
return function_;
}
+ Variable* generator_object_var() const {
+ DCHECK(is_function_scope() || is_module_scope());
+ return generator_object_;
+ }
+
+ Variable* promise_var() const {
+ DCHECK(is_function_scope());
+ DCHECK(IsAsyncFunction(function_kind_));
+ return promise_;
+ }
+
// Parameters. The left-most parameter has index 0.
// Only valid for function and module scopes.
Variable* parameter(int index) const {
@@ -874,6 +890,11 @@ class DeclarationScope : public Scope {
Variable* arguments_;
// Convenience variable; Subclass constructor only
Variable* this_function_;
+
+ // Generator object, if any; generator function scopes and module scopes only.
+ Variable* generator_object_;
+ // Promise, if any; async function scopes only.
+ Variable* promise_;
Dan Ehrenberg 2017/02/08 21:12:56 Will there be more live DeclarationScopes than Fun
};
class ModuleScope final : public DeclarationScope {

Powered by Google App Engine
This is Rietveld 408576698