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

Unified Diff: src/parsing/preparser.h

Issue 1570793002: [parser] parenthesized Literals are not valid AssignmentPatterns (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO + move ParenthesizedField line above Type-dependent fields/comments Created 4 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/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparser.h
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h
index 9253ad5e518f93b9cfc08393a475912eb6377e85..41d5ab8513626776ea3738db8ca78c5301b3e81f 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -279,6 +279,12 @@ class PreParserExpression {
int position() const { return RelocInfo::kNoPosition; }
void set_function_token_position(int position) {}
+ // Parenthesized expressions in the form `( Expression )`.
+ void set_is_parenthesized() {
+ code_ = ParenthesizedField::update(code_, true);
+ }
+ bool is_parenthesized() const { return ParenthesizedField::decode(code_); }
+
private:
enum Type {
kExpression,
@@ -306,6 +312,13 @@ class PreParserExpression {
// The first three bits are for the Type.
typedef BitField<Type, 0, 3> TypeField;
+ // The high order bit applies only to nodes which would inherit from the
+ // Expression ASTNode --- This is by necessity, due to the fact that
+ // Expression nodes may be represented as multiple Types, not exclusively
+ // through kExpression.
+ // TODO(caitp, adamk): clean up PreParserExpression bitfields.
+ typedef BitField<bool, 31, 1> ParenthesizedField;
+
// The rest of the bits are interpreted depending on the value
// of the Type field, so they can share the storage.
typedef BitField<ExpressionType, TypeField::kNext, 3> ExpressionTypeField;
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698