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

Unified Diff: src/ast/ast.h

Issue 2654423004: [async-functions] support await expressions in finally statements (Closed)
Patch Set: I'd like to build with -Wunused-variables locally, but how!? Created 3 years, 11 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 | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »
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 e5c7646ef3a342794ad5db1ded50b13ecd425e73..a17f50a328d8b28d12e2bdde0d5025759aa0478f 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -102,6 +102,7 @@ namespace internal {
V(SuperCallReference) \
V(CaseClause) \
V(EmptyParentheses) \
+ V(InternalVariable) \
V(GetIterator) \
V(DoExpression) \
V(RewritableExpression)
@@ -2514,7 +2515,8 @@ class Yield final : public Expression {
public:
enum OnException { kOnExceptionThrow, kOnExceptionRethrow };
- Expression* generator_object() const { return generator_object_; }
+ enum YieldType { kNormal, kAwait };
+
Expression* expression() const { return expression_; }
OnException on_exception() const {
return OnExceptionField::decode(bit_field_);
@@ -2523,29 +2525,28 @@ class Yield final : public Expression {
return on_exception() == kOnExceptionRethrow;
}
int yield_id() const { return yield_id_; }
+ YieldType yield_type() const { return YieldTypeField::decode(bit_field_); }
- void set_generator_object(Expression* e) { generator_object_ = e; }
void set_expression(Expression* e) { expression_ = e; }
void set_yield_id(int yield_id) { yield_id_ = yield_id; }
private:
friend class AstNodeFactory;
- Yield(Expression* generator_object, Expression* expression, int pos,
- OnException on_exception)
- : Expression(pos, kYield),
- yield_id_(-1),
- generator_object_(generator_object),
- expression_(expression) {
- bit_field_ |= OnExceptionField::encode(on_exception);
+ Yield(Expression* expression, int pos, OnException on_exception,
+ YieldType yield_type)
+ : Expression(pos, kYield), yield_id_(-1), expression_(expression) {
+ bit_field_ |= OnExceptionField::encode(on_exception) |
+ YieldTypeField::encode(yield_type);
}
int yield_id_;
- Expression* generator_object_;
Expression* expression_;
class OnExceptionField
: public BitField<OnException, Expression::kNextBitFieldIndex, 1> {};
+ class YieldTypeField
+ : public BitField<YieldType, OnExceptionField::kNext, 1> {};
};
@@ -2583,6 +2584,12 @@ class FunctionLiteral final : public Expression {
const AstString* raw_name() const { return raw_name_; }
void set_raw_name(const AstString* name) { raw_name_ = name; }
DeclarationScope* scope() const { return scope_; }
+
+ // AST desugaring of initialization of non-simple parameters. If non-null,
+ // forces Ignition/TF pipeline.
+ Block* parameter_init_block() const { return parameter_init_block_; }
+ void set_parameter_init_block(Block* block) { parameter_init_block_ = block; }
+
ZoneList<Statement*>* body() const { return body_; }
void set_function_token_position(int pos) { function_token_position_ = pos; }
int function_token_position() const { return function_token_position_; }
@@ -2732,6 +2739,7 @@ class FunctionLiteral final : public Expression {
has_braces_(has_braces),
raw_name_(name),
scope_(scope),
+ parameter_init_block_(nullptr),
body_(body),
raw_inferred_name_(ast_value_factory->empty_string()),
ast_properties_(zone),
@@ -2765,6 +2773,7 @@ class FunctionLiteral final : public Expression {
const AstString* raw_name_;
DeclarationScope* scope_;
+ Block* parameter_init_block_;
ZoneList<Statement*>* body_;
const AstString* raw_inferred_name_;
Handle<String> inferred_name_;
@@ -2956,6 +2965,23 @@ class EmptyParentheses final : public Expression {
explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {}
};
+class InternalVariable final : public Expression {
+ public:
+ enum Type { kGeneratorObject };
+
+ Type type() const { return type_; }
+
+ const char* name() const;
+
+ private:
+ friend class AstNodeFactory;
+
+ explicit InternalVariable(Type type)
+ : Expression(kNoSourcePosition, kInternalVariable), type_(type) {}
+
+ Type type_;
+};
+
// Represents the spec operation `GetIterator()`
// (defined at https://tc39.github.io/ecma262/#sec-getiterator). Ignition
// desugars this into a LoadIC / JSLoadNamed, CallIC, and a type-check to
@@ -3475,10 +3501,10 @@ class AstNodeFactory final BASE_EMBEDDED {
return assign;
}
- Yield* NewYield(Expression* generator_object, Expression* expression, int pos,
- Yield::OnException on_exception) {
+ Yield* NewYield(Expression* expression, int pos,
+ Yield::OnException on_exception, Yield::YieldType type) {
if (!expression) expression = NewUndefinedLiteral(pos);
- return new (zone_) Yield(generator_object, expression, pos, on_exception);
+ return new (zone_) Yield(expression, pos, on_exception, type);
}
Throw* NewThrow(Expression* exception, int pos) {
@@ -3567,6 +3593,10 @@ class AstNodeFactory final BASE_EMBEDDED {
return new (zone_) EmptyParentheses(pos);
}
+ InternalVariable* NewInternalVariable(InternalVariable::Type type) {
+ return new (zone_) InternalVariable(type);
+ }
+
GetIterator* NewGetIterator(Expression* iterable, int pos) {
return new (zone_) GetIterator(iterable, pos);
}
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698