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

Unified Diff: src/ast/ast.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
« no previous file with comments | « no previous file | src/ast/scopes.h » ('j') | src/ast/scopes.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 5e8255051f8bb556761ff0efe86a2c6b81a50152..cbba803983bc267a6287d0da907bd98d7f3d28c4 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -896,17 +896,22 @@ class BreakStatement final : public JumpStatement {
class ReturnStatement final : public JumpStatement {
public:
+ enum Type { kNormal, kHardReturn };
Dan Ehrenberg 2017/02/08 21:12:56 Bikeshedding suggestion: Instead, have normal retu
caitp 2017/02/08 23:22:15 As explained on IRC: The key fix for the try/fina
Dan Ehrenberg 2017/02/09 06:46:58 I see how you need to differentiate between return
Expression* expression() const { return expression_; }
void set_expression(Expression* e) { expression_ = e; }
+ bool is_hard_return() const { return type_ == kHardReturn; }
private:
friend class AstNodeFactory;
- ReturnStatement(Expression* expression, int pos)
- : JumpStatement(pos, kReturnStatement), expression_(expression) {}
+ ReturnStatement(Expression* expression, Type type, int pos)
+ : JumpStatement(pos, kReturnStatement),
+ expression_(expression),
+ type_(type) {}
Expression* expression_;
+ Type type_ = kNormal;
};
@@ -3209,7 +3214,13 @@ class AstNodeFactory final BASE_EMBEDDED {
}
ReturnStatement* NewReturnStatement(Expression* expression, int pos) {
- return new (zone_) ReturnStatement(expression, pos);
+ return new (zone_)
+ ReturnStatement(expression, ReturnStatement::kNormal, pos);
+ }
+
+ ReturnStatement* NewHardReturnStatement(Expression* expression, int pos) {
+ return new (zone_)
+ ReturnStatement(expression, ReturnStatement::kHardReturn, pos);
}
WithStatement* NewWithStatement(Scope* scope,
« no previous file with comments | « no previous file | src/ast/scopes.h » ('j') | src/ast/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698