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

Unified Diff: src/parsing/preparser.h

Issue 2322243002: Preparse inner functions. (Closed)
Patch Set: fixes Created 4 years, 1 month 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 8c2fb66abf9324e0734e9ebe689aaf9bcbcc973c..7ea3921d3900676ecc56cd66ed68ee8c70a13d43 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -112,10 +112,12 @@ class PreParserIdentifier {
kAsyncIdentifier
};
- explicit PreParserIdentifier(Type type) : type_(type) {}
+ explicit PreParserIdentifier(Type type) : type_(type), string_(nullptr) {}
Type type_;
-
+ // Only non-nullptr when PreParser.track_unresolved_variables_ is true.
+ const AstRawString* string_;
friend class PreParserExpression;
+ friend class PreParser;
};
@@ -761,7 +763,8 @@ class PreParser : public ParserBase<PreParser> {
ParserRecorder* log, uintptr_t stack_limit)
: ParserBase<PreParser>(zone, scanner, stack_limit, NULL,
ast_value_factory, log),
- use_counts_(nullptr) {}
+ use_counts_(nullptr),
+ track_unresolved_variables_(false) {}
// Pre-parse the program from the character stream; returns true on
// success (even if parsing failed, the pre-parse data successfully
@@ -807,10 +810,10 @@ class PreParser : public ParserBase<PreParser> {
// keyword and parameters, and have consumed the initial '{'.
// At return, unless an error occurred, the scanner is positioned before the
// the final '}'.
- PreParseResult PreParseLazyFunction(LanguageMode language_mode,
- FunctionKind kind,
- bool has_simple_parameters,
+ PreParseResult PreParseLazyFunction(FunctionKind kind,
+ DeclarationScope* function_scope,
bool parsing_module, ParserRecorder* log,
+ bool track_unresolved_variables,
bool may_abort, int* use_counts);
private:
@@ -839,9 +842,9 @@ class PreParser : public ParserBase<PreParser> {
const PreParserFormalParameters& parameters, FunctionKind kind,
FunctionLiteral::FunctionType function_type, bool* ok);
- V8_INLINE LazyParsingResult
- SkipLazyFunctionBody(int* materialized_literal_count,
- int* expected_property_count, bool may_abort, bool* ok) {
+ V8_INLINE LazyParsingResult SkipLazyFunctionBody(
+ int* materialized_literal_count, int* expected_property_count,
+ bool track_unresolved_variables, bool may_abort, bool* ok) {
UNREACHABLE();
return kLazyParsingComplete;
}
@@ -1254,11 +1257,9 @@ class PreParser : public ParserBase<PreParser> {
return PreParserExpression::Default();
}
- V8_INLINE PreParserExpression ExpressionFromIdentifier(
+ PreParserExpression ExpressionFromIdentifier(
PreParserIdentifier name, int start_position, int end_position,
- InferName infer = InferName::kYes) {
- return PreParserExpression::FromIdentifier(name);
- }
+ InferName infer = InferName::kYes);
V8_INLINE PreParserExpression ExpressionFromString(int pos) {
if (scanner()->UnescapedLiteralMatches("use strict", 10)) {
@@ -1373,6 +1374,7 @@ class PreParser : public ParserBase<PreParser> {
// Preparser's private field members.
int* use_counts_;
+ bool track_unresolved_variables_;
};
PreParserExpression PreParser::SpreadCall(PreParserExpression function,
« 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