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

Unified Diff: src/parsing/preparser.h

Issue 2388183003: PreParsing inner functions: Fix declaration-only variables. (Closed)
Patch Set: flag off Created 4 years, 2 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/ast/scopes.cc ('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 a37aa04436b818c2604913c441ded1dc2967cca3..4b5474854c3bd16342ed206feb5f700971d408a7 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -137,7 +137,8 @@ class PreParserExpression {
static PreParserExpression FromIdentifier(PreParserIdentifier id) {
return PreParserExpression(TypeField::encode(kIdentifierExpression) |
- IdentifierTypeField::encode(id.type_));
+ IdentifierTypeField::encode(id.type_),
+ id.string_);
}
static PreParserExpression BinaryOperation(PreParserExpression left,
@@ -343,8 +344,9 @@ class PreParserExpression {
kAssignment
};
- explicit PreParserExpression(uint32_t expression_code)
- : code_(expression_code) {}
+ explicit PreParserExpression(uint32_t expression_code,
+ const AstRawString* string = nullptr)
+ : code_(expression_code), string_(string) {}
// The first three bits are for the Type.
typedef BitField<Type, 0, 3> TypeField;
@@ -366,6 +368,10 @@ class PreParserExpression {
typedef BitField<bool, TypeField::kNext, 1> HasCoverInitializedNameField;
uint32_t code_;
+ // Non-nullptr if the expression is one identifier.
+ const AstRawString* string_;
+
+ friend class PreParser;
};
@@ -922,11 +928,12 @@ class PreParser : public ParserBase<PreParser> {
}
V8_INLINE void RewriteNonPattern(bool* ok) { ValidateExpression(ok); }
- V8_INLINE void DeclareAndInitializeVariables(
+ void DeclareAndInitializeVariables(
PreParserStatement block,
const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration,
- ZoneList<const AstRawString*>* names, bool* ok) {}
+ ZoneList<const AstRawString*>* names, bool* ok);
+
V8_INLINE ZoneList<const AstRawString*>* DeclareLabel(
ZoneList<const AstRawString*>* labels, PreParserExpression expr,
bool* ok) {
« no previous file with comments | « src/ast/scopes.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698