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

Unified Diff: src/parsing/preparser.h

Issue 2638333002: Parsing:Create the same scopes for non-simple params in PreParser & Parser. (Closed)
Patch Set: rest of the impl 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/parsing/parser-base.h ('k') | no next file » | 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 77fe061f42a40798847e39f6f17fa80a49d5e9b7..e4888037871e27cf19b9c2f0094dc4efe0fe02ee 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -414,10 +414,11 @@ class PreParserList {
// These functions make list->Add(some_expression) work (and do nothing).
PreParserList() : length_(0), variables_(nullptr) {}
PreParserList* operator->() { return this; }
- void Add(T, Zone* zone);
+ void Add(const T& element, Zone* zone);
int length() const { return length_; }
static PreParserList Null() { return PreParserList(-1); }
bool IsNull() const { return length_ == -1; }
+ void Set(int index, const T& element) {}
private:
explicit PreParserList(int n) : length_(n), variables_(nullptr) {}
@@ -430,7 +431,7 @@ class PreParserList {
template <>
inline void PreParserList<PreParserExpression>::Add(
- PreParserExpression expression, Zone* zone) {
+ const PreParserExpression& expression, Zone* zone) {
if (expression.variables_ != nullptr) {
DCHECK(FLAG_lazy_inner_functions);
DCHECK(zone != nullptr);
@@ -445,7 +446,7 @@ inline void PreParserList<PreParserExpression>::Add(
}
template <typename T>
-void PreParserList<T>::Add(T, Zone* zone) {
+void PreParserList<T>::Add(const T& element, Zone* zone) {
++length_;
}
@@ -939,11 +940,6 @@ class PreParser : public ParserBase<PreParser> {
// By making the 'exception handling' explicit, we are forced to check
// for failure at the call sites.
- V8_INLINE PreParserStatementList ParseEagerFunctionBody(
- PreParserIdentifier function_name, int pos,
- const PreParserFormalParameters& parameters, FunctionKind kind,
- FunctionLiteral::FunctionType function_type, bool* ok);
-
// Indicates that we won't switch from the preparser to the preparser; we'll
// just stay where we are.
bool AllowsLazyParsingWithoutUnresolvedVariables() const { return false; }
@@ -1075,6 +1071,16 @@ class PreParser : public ParserBase<PreParser> {
return PreParserStatement::Default();
}
+ V8_INLINE void ParseAndRewriteGeneratorFunctionBody(
+ int pos, FunctionKind kind, PreParserStatementList body, bool* ok) {
+ ParseStatementList(body, Token::RBRACE, ok);
+ }
+ V8_INLINE void CreateFunctionNameAssignment(
+ PreParserIdentifier function_name, int pos,
+ FunctionLiteral::FunctionType function_type,
+ DeclarationScope* function_scope, PreParserStatementList result,
+ int index) {}
+
V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body,
int pos, bool* ok) {
return PreParserExpression::Default();
@@ -1328,6 +1334,23 @@ class PreParser : public ParserBase<PreParser> {
return loop;
}
+ V8_INLINE PreParserStatement BuildParameterInitializationBlock(
+ const PreParserFormalParameters& parameters, bool* ok) {
+ return PreParserStatement::Default();
+ }
+
+ V8_INLINE PreParserStatement
+ BuildRejectPromiseOnException(PreParserStatement init_block) {
+ return PreParserStatement::Default();
+ }
+
+ V8_INLINE void InsertSloppyBlockFunctionVarBindings(DeclarationScope* scope) {
+ scope->HoistSloppyBlockFunctions(nullptr);
+ }
+
+ V8_INLINE void InsertShadowingVarBindingInitializers(
+ PreParserStatement block) {}
+
V8_INLINE PreParserExpression
NewThrowReferenceError(MessageTemplate::Template message, int pos) {
return PreParserExpression::Default();
@@ -1623,29 +1646,6 @@ PreParserExpression PreParser::SpreadCallNew(PreParserExpression function,
return factory()->NewCallNew(function, args, pos);
}
-PreParserStatementList PreParser::ParseEagerFunctionBody(
- PreParserIdentifier function_name, int pos,
- const PreParserFormalParameters& parameters, FunctionKind kind,
- FunctionLiteral::FunctionType function_type, bool* ok) {
- PreParserStatementList result;
-
- DeclarationScope* inner_scope = scope()->AsDeclarationScope();
- if (!parameters.is_simple) inner_scope = NewVarblockScope();
-
- {
- BlockState block_state(&scope_state_, inner_scope);
- ParseStatementList(result, Token::RBRACE, ok);
- if (!*ok) return PreParserStatementList();
- }
-
- Expect(Token::RBRACE, ok);
-
- if (is_sloppy(inner_scope->language_mode())) {
- inner_scope->HoistSloppyBlockFunctions(nullptr);
- }
- return result;
-}
-
PreParserExpression PreParser::CloseTemplateLiteral(TemplateLiteralState* state,
int start,
PreParserExpression tag) {
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698