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

Unified Diff: src/ast/ast.h

Issue 1751613004: Get rid of the different kinds of yield in the AST & full-codegen. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do an inline call. Created 4 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/prettyprinter.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 5fdffa506ce9f602d82779c6c3674942cc3fff9c..4b546633a214e8c5b6d717cd5b79f03dd7f7898d 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -2506,37 +2506,29 @@ class RewritableExpression : public Expression {
Expression* expr_;
};
-
+// Our Yield is different from the JS yield in that it "returns" its argument as
+// is, without wrapping it in an iterator result object. Such wrapping, if
+// desired, must be done beforehand (see the parser).
class Yield final : public Expression {
public:
DECLARE_NODE_TYPE(Yield)
- enum Kind {
- kInitial, // The initial yield that returns the unboxed generator object.
- kSuspend, // A normal yield: { value: EXPRESSION, done: false }
- kDelegating, // A yield*.
- kFinal // A return: { value: EXPRESSION, done: true }
- };
-
Expression* generator_object() const { return generator_object_; }
Expression* expression() const { return expression_; }
- Kind yield_kind() const { return yield_kind_; }
void set_generator_object(Expression* e) { generator_object_ = e; }
void set_expression(Expression* e) { expression_ = e; }
protected:
Yield(Zone* zone, Expression* generator_object, Expression* expression,
- Kind yield_kind, int pos)
+ int pos)
: Expression(zone, pos),
generator_object_(generator_object),
- expression_(expression),
- yield_kind_(yield_kind) {}
+ expression_(expression) {}
private:
Expression* generator_object_;
Expression* expression_;
- Kind yield_kind_;
};
@@ -3374,11 +3366,10 @@ class AstNodeFactory final BASE_EMBEDDED {
Yield* NewYield(Expression *generator_object,
Expression* expression,
- Yield::Kind yield_kind,
int pos) {
if (!expression) expression = NewUndefinedLiteral(pos);
return new (local_zone_)
- Yield(local_zone_, generator_object, expression, yield_kind, pos);
+ Yield(local_zone_, generator_object, expression, pos);
}
Throw* NewThrow(Expression* exception, int pos) {
« no previous file with comments | « no previous file | src/ast/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698